├── .gitignore
├── .npmignore
├── typings
├── atom
│ └── index.d.ts
└── atom-ide
│ └── index.d.ts
├── test
├── runner.js
├── helpers.ts
├── utils.test.ts
├── auto-languageclient.test.ts
├── adapters
│ ├── custom-linter-push-v2-adapter.test.ts
│ ├── signature-help-adapter.test.ts
│ ├── code-highlight-adapter.test.ts
│ ├── datatip-adapter.test.ts
│ ├── document-sync-adapter.test.ts
│ ├── code-action-adapter.test.ts
│ ├── linter-push-v2-adapter.test.ts
│ ├── apply-edit-adapter.test.ts
│ ├── code-format-adapter.test.ts
│ └── outline-view-adapter.test.ts
├── convert.test.ts
└── languageclient.test.ts
├── tsconfig.json
├── lib
├── main.ts
├── adapters
│ ├── code-highlight-adapter.ts
│ ├── logging-console-adapter.ts
│ ├── signature-help-adapter.ts
│ ├── rename-adapter.ts
│ ├── datatip-adapter.ts
│ ├── find-references-adapter.ts
│ ├── apply-edit-adapter.ts
│ ├── definition-adapter.ts
│ ├── code-action-adapter.ts
│ ├── notifications-adapter.ts
│ ├── linter-push-v2-adapter.ts
│ ├── code-format-adapter.ts
│ └── outline-view-adapter.ts
├── logger.ts
├── download-file.ts
├── utils.ts
├── convert.ts
└── server-manager.ts
├── .github
└── workflows
│ └── main.yml
├── tslint.json
├── LICENSE.md
├── package.json
├── script
└── cibuild
├── CHANGELOG.md
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 | build/
4 | yarn.lock
5 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .npmignore
2 | .gitignore
3 | .travis.yml
4 | appveyor.yml
5 | appveyor.ps1
6 | lib/
7 | test/
8 | script/
9 |
--------------------------------------------------------------------------------
/typings/atom/index.d.ts:
--------------------------------------------------------------------------------
1 | export { };
2 | declare module 'atom' {
3 | interface TextEditor {
4 | getNonWordCharacters(position: Point): string;
5 | }
6 |
7 | /** Non-public Notification api */
8 | interface NotificationExt extends Notification {
9 | isDismissed?: () => boolean;
10 | getOptions?: () => NotificationOptions | null;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/test/runner.js:
--------------------------------------------------------------------------------
1 | const { TestRunnerParams } = require("atom");
2 | const { createRunner } = require('@atom/mocha-test-runner');
3 |
4 | module.exports = createRunner({
5 | htmlTitle: `atom-languageclient Tests - pid ${process.pid}`,
6 | reporter: process.env.MOCHA_REPORTER || 'list',
7 | },
8 | (mocha) => {
9 | mocha.timeout(parseInt(process.env.MOCHA_TIMEOUT || '5000', 10));
10 | if (process.env.APPVEYOR_API_URL) {
11 | mocha.reporter(require('mocha-appveyor-reporter'));
12 | }
13 | },
14 | );
15 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "es6",
5 | "outDir": "build",
6 | "lib": ["es7", "dom"],
7 | "declaration": true,
8 | "inlineSources": true,
9 | "inlineSourceMap": true,
10 | "strict": true,
11 | "noImplicitAny": true,
12 | "noFallthroughCasesInSwitch": true,
13 | "noImplicitReturns": true,
14 | "noUnusedLocals": true,
15 | "baseUrl": "./"
16 | },
17 | "include": [
18 | "typings/**/*.ts",
19 | "lib/**/*.ts",
20 | "test/**/*.ts"
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/lib/main.ts:
--------------------------------------------------------------------------------
1 | // tslint:disable:no-reference
2 | ///
3 | ///
4 | // tslint:enable:no-reference
5 |
6 | import AutoLanguageClient from './auto-languageclient';
7 | import Convert from './convert';
8 | import { Logger, ConsoleLogger, FilteredLogger } from './logger';
9 | import DownloadFile from './download-file';
10 | import LinterPushV2Adapter from './adapters/linter-push-v2-adapter';
11 |
12 | export * from './auto-languageclient';
13 | export {
14 | AutoLanguageClient,
15 | Convert,
16 | Logger,
17 | ConsoleLogger,
18 | FilteredLogger,
19 | DownloadFile,
20 | LinterPushV2Adapter,
21 | };
22 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on: [push]
4 |
5 | env:
6 | CI: true
7 |
8 | jobs:
9 | Test:
10 | strategy:
11 | matrix:
12 | os: [ubuntu-latest, macos-latest, windows-latest]
13 | channel: [stable, beta]
14 | runs-on: ${{ matrix.os }}
15 | steps:
16 | - uses: actions/checkout@v1
17 | - uses: UziTech/action-setup-atom@v2
18 | with:
19 | version: ${{ matrix.channel }}
20 | - name: Install windows-build-tools
21 | if: ${{ matrix.os == 'windows-latest' }}
22 | run: |
23 | npm i windows-build-tools@4.0.0
24 | - name: Install dependencies
25 | run: apm install
26 | - name: Run tests
27 | run: atom --test test
28 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultSeverity": "error",
3 | "extends": [
4 | "tslint:recommended"
5 | ],
6 | "jsRules": {},
7 | "rules": {
8 | "quotemark": false,
9 | "object-literal-sort-keys": false,
10 | "ordered-imports": false,
11 | "member-ordering": false,
12 | "one-line": false,
13 | "interface-name": false,
14 | "variable-name": false,
15 | "max-classes-per-file": false,
16 | "no-unused-expression": false,
17 | "no-empty": false,
18 | "one-variable-per-declaration": false,
19 | "whitespace": [
20 | true,
21 | "check-branch",
22 | "check-decl",
23 | "check-operator",
24 | "check-separator",
25 | "check-type",
26 | "check-typecast",
27 | "check-module"
28 | ]
29 | },
30 | "rulesDirectory": []
31 | }
32 |
--------------------------------------------------------------------------------
/test/helpers.ts:
--------------------------------------------------------------------------------
1 | import * as sinon from 'sinon';
2 | import * as rpc from 'vscode-jsonrpc';
3 | import { TextEditor } from 'atom';
4 |
5 | export function createSpyConnection(): rpc.MessageConnection {
6 | return {
7 | listen: sinon.spy(),
8 | onClose: sinon.spy(),
9 | onError: sinon.spy(),
10 | onDispose: sinon.spy(),
11 | onUnhandledNotification: sinon.spy(),
12 | onRequest: sinon.spy(),
13 | onNotification: sinon.spy(),
14 | dispose: sinon.spy(),
15 | sendRequest: sinon.spy(),
16 | sendNotification: sinon.spy(),
17 | trace: sinon.spy(),
18 | inspect: sinon.spy(),
19 | };
20 | }
21 |
22 | export function createFakeEditor(path?: string): TextEditor {
23 | const editor = new TextEditor();
24 | sinon.stub(editor, 'getSelectedBufferRange');
25 | sinon.spy(editor, 'setTextInBufferRange');
26 | editor.setTabLength(4);
27 | editor.setSoftTabs(true);
28 | editor.getBuffer().setPath(path || '/a/b/c/d.js');
29 | return editor;
30 | }
31 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017 GitHub Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/test/utils.test.ts:
--------------------------------------------------------------------------------
1 | import * as Utils from '../lib/utils';
2 | import { createFakeEditor } from './helpers';
3 | import { expect } from 'chai';
4 | import { Point } from 'atom';
5 |
6 | describe('Utils', () => {
7 | describe('getWordAtPosition', () => {
8 | let editor: any;
9 | beforeEach(() => {
10 | editor = createFakeEditor('test.txt');
11 | editor.setText('blah test1234 test-two');
12 | });
13 |
14 | it('gets the word at position from a text editor', () => {
15 | // "blah"
16 | let range = Utils.getWordAtPosition(editor, new Point(0, 0));
17 | expect(range.serialize()).eql([[0, 0], [0, 4]]);
18 |
19 | // "test1234"
20 | range = Utils.getWordAtPosition(editor, new Point(0, 7));
21 | expect(range.serialize()).eql([[0, 5], [0, 13]]);
22 |
23 | // "test"
24 | range = Utils.getWordAtPosition(editor, new Point(0, 14));
25 | expect(range.serialize()).eql([[0, 14], [0, 18]]);
26 | });
27 |
28 | it('returns empty ranges for non-words', () => {
29 | const range = Utils.getWordAtPosition(editor, new Point(0, 4));
30 | expect(range.serialize()).eql([[0, 4], [0, 4]]);
31 | });
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "atom-languageclient",
3 | "version": "0.9.9",
4 | "description": "Integrate Language Servers with Atom",
5 | "repository": "https://github.com/atom/atom-languageclient",
6 | "license": "MIT",
7 | "main": "./build/lib/main",
8 | "types": "./build/lib/main.d.ts",
9 | "scripts": {
10 | "clean": "rm -rf build",
11 | "compile": "tsc",
12 | "watch": "tsc -watch",
13 | "lint": "tslint -c tslint.json 'lib/**/*.ts' 'test/**/*.ts' 'typings/**/*.d.ts'",
14 | "prepare": "npm run clean && npm run compile",
15 | "test": "npm run compile && npm run lint && atom --test build/test"
16 | },
17 | "atomTestRunner": "./test/runner",
18 | "dependencies": {
19 | "fuzzaldrin-plus": "^0.6.0",
20 | "vscode-jsonrpc": "4.0.0",
21 | "vscode-languageserver-protocol": "3.12.0",
22 | "vscode-languageserver-types": "3.12.0"
23 | },
24 | "devDependencies": {
25 | "@atom/mocha-test-runner": "^1.5.0",
26 | "@types/atom": "^1.31.0",
27 | "@types/chai": "^4.1.7",
28 | "@types/fuzzaldrin-plus": "0.6.0",
29 | "@types/mocha": "^5.2.5",
30 | "@types/node": "8.9.3",
31 | "@types/sinon": "^4.1.3",
32 | "chai": "^4.2.0",
33 | "mocha": "^5.2.0",
34 | "mocha-appveyor-reporter": "^0.4.2",
35 | "sinon": "^7.0.0",
36 | "tslint": "^5.11.0",
37 | "typescript": "~3.1.6"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/test/auto-languageclient.test.ts:
--------------------------------------------------------------------------------
1 | import AutoLanguageClient from '../lib/auto-languageclient';
2 | import { expect } from 'chai';
3 |
4 | describe('AutoLanguageClient', () => {
5 | describe('shouldSyncForEditor', () => {
6 | class CustomAutoLanguageClient extends AutoLanguageClient {
7 | public getGrammarScopes() {
8 | return ['Java', 'Python'];
9 | }
10 | }
11 |
12 | const client = new CustomAutoLanguageClient();
13 |
14 | function mockEditor(uri: string, scopeName: string): any {
15 | return {
16 | getPath: () => uri,
17 | getGrammar: () => {
18 | return { scopeName };
19 | },
20 | };
21 | }
22 |
23 | it('selects documents in project and in supported language', () => {
24 | const editor = mockEditor('/path/to/somewhere', client.getGrammarScopes()[0]);
25 | expect(client.shouldSyncForEditor(editor, '/path/to/somewhere')).equals(true);
26 | });
27 |
28 | it('does not select documents outside of project', () => {
29 | const editor = mockEditor('/path/to/elsewhere/file', client.getGrammarScopes()[0]);
30 | expect(client.shouldSyncForEditor(editor, '/path/to/somewhere')).equals(false);
31 | });
32 |
33 | it('does not select documents in unsupported language', () => {
34 | const editor = mockEditor('/path/to/somewhere', client.getGrammarScopes()[0] + '-dummy');
35 | expect(client.shouldSyncForEditor(editor, '/path/to/somewhere')).equals(false);
36 | });
37 |
38 | it('does not select documents in unsupported language outside of project', () => {
39 | const editor = mockEditor('/path/to/elsewhere/file', client.getGrammarScopes()[0] + '-dummy');
40 | expect(client.shouldSyncForEditor(editor, '/path/to/somewhere')).equals(false);
41 | });
42 | });
43 | });
44 |
--------------------------------------------------------------------------------
/lib/adapters/code-highlight-adapter.ts:
--------------------------------------------------------------------------------
1 | import assert = require('assert');
2 | import Convert from '../convert';
3 | import {
4 | Point,
5 | TextEditor,
6 | Range,
7 | } from 'atom';
8 | import {
9 | LanguageClientConnection,
10 | ServerCapabilities,
11 | } from '../languageclient';
12 |
13 | export default class CodeHighlightAdapter {
14 | /**
15 | * @returns A {Boolean} indicating this adapter can adapt the server based on the
16 | * given serverCapabilities.
17 | */
18 | public static canAdapt(serverCapabilities: ServerCapabilities): boolean {
19 | return serverCapabilities.documentHighlightProvider === true;
20 | }
21 |
22 | /**
23 | * Public: Creates highlight markers for a given editor position.
24 | * Throws an error if documentHighlightProvider is not a registered capability.
25 | *
26 | * @param connection A {LanguageClientConnection} to the language server that provides highlights.
27 | * @param serverCapabilities The {ServerCapabilities} of the language server that will be used.
28 | * @param editor The Atom {TextEditor} containing the text to be highlighted.
29 | * @param position The Atom {Point} to fetch highlights for.
30 | * @returns A {Promise} of an {Array} of {Range}s to be turned into highlights.
31 | */
32 | public static async highlight(
33 | connection: LanguageClientConnection,
34 | serverCapabilities: ServerCapabilities,
35 | editor: TextEditor,
36 | position: Point,
37 | ): Promise {
38 | assert(serverCapabilities.documentHighlightProvider, 'Must have the documentHighlight capability');
39 | const highlights = await connection.documentHighlight(Convert.editorToTextDocumentPositionParams(editor, position));
40 | return highlights.map((highlight) => {
41 | return Convert.lsRangeToAtomRange(highlight.range);
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/test/adapters/custom-linter-push-v2-adapter.test.ts:
--------------------------------------------------------------------------------
1 | import LinterPushV2Adapter from '../../lib/adapters/linter-push-v2-adapter';
2 | import * as ls from '../../lib/languageclient';
3 | import { expect } from 'chai';
4 | import { Point, Range } from 'atom';
5 |
6 | const messageUrl = 'dummy';
7 | const messageSolutions: any[] = ['dummy'];
8 |
9 | class CustomLinterPushV2Adapter extends LinterPushV2Adapter {
10 | public diagnosticToV2Message(path: string, diagnostic: ls.Diagnostic) {
11 | const message = super.diagnosticToV2Message(path, diagnostic);
12 | message.url = messageUrl;
13 | message.solutions = messageSolutions;
14 | return message;
15 | }
16 | }
17 |
18 | describe('CustomLinterPushV2Adapter', () => {
19 | describe('diagnosticToMessage', () => {
20 | it('converts Diagnostic and path to a linter$Message', () => {
21 | const filePath = '/a/b/c/d';
22 | const diagnostic: ls.Diagnostic = {
23 | message: 'This is a message',
24 | range: {
25 | start: { line: 1, character: 2 },
26 | end: { line: 3, character: 4 },
27 | },
28 | source: 'source',
29 | code: 'code',
30 | severity: ls.DiagnosticSeverity.Information,
31 | };
32 |
33 | const connection: any = { onPublishDiagnostics() { } };
34 | const adapter = new CustomLinterPushV2Adapter(connection);
35 | const result = adapter.diagnosticToV2Message(filePath, diagnostic);
36 |
37 | expect(result.excerpt).equals(diagnostic.message);
38 | expect(result.linterName).equals(diagnostic.source);
39 | expect(result.location.file).equals(filePath);
40 | expect(result.location.position).deep.equals(new Range(new Point(1, 2), new Point(3, 4)));
41 | expect(result.severity).equals('info');
42 | expect(result.url).equals(messageUrl);
43 | expect(result.solutions).deep.equals(messageSolutions);
44 | });
45 | });
46 | });
47 |
--------------------------------------------------------------------------------
/test/adapters/signature-help-adapter.test.ts:
--------------------------------------------------------------------------------
1 | import { Disposable, Point } from 'atom';
2 | import SignatureHelpAdapter from '../../lib/adapters/signature-help-adapter';
3 | import { createFakeEditor, createSpyConnection } from '../helpers';
4 | import { expect } from 'chai';
5 | import * as sinon from 'sinon';
6 |
7 | describe('SignatureHelpAdapter', () => {
8 | describe('canAdapt', () => {
9 | it('checks for signatureHelpProvider', () => {
10 | expect(SignatureHelpAdapter.canAdapt({})).to.equal(false);
11 | expect(SignatureHelpAdapter.canAdapt({ signatureHelpProvider: {} })).to.equal(true);
12 | });
13 | });
14 |
15 | describe('can attach to a server', () => {
16 | it('subscribes to onPublishDiagnostics', async () => {
17 | const connection = createSpyConnection();
18 | (connection as any).signatureHelp = sinon.stub().resolves({ signatures: [] });
19 |
20 | const adapter = new SignatureHelpAdapter(
21 | {
22 | connection,
23 | capabilities: {
24 | signatureHelpProvider: {
25 | triggerCharacters: ['(', ','],
26 | },
27 | },
28 | } as any,
29 | ['source.js'],
30 | );
31 | const spy = sinon.stub().returns(new Disposable());
32 | adapter.attach(spy);
33 | expect(spy.calledOnce).to.be.true;
34 | const provider = spy.firstCall.args[0];
35 | expect(provider.priority).to.equal(1);
36 | expect(provider.grammarScopes).to.deep.equal(['source.js']);
37 | expect(provider.triggerCharacters).to.deep.equal(new Set(['(', ',']));
38 | expect(typeof provider.getSignatureHelp).to.equal('function');
39 |
40 | const result = await provider.getSignatureHelp(createFakeEditor('test.txt'), new Point(0, 1));
41 | expect((connection as any).signatureHelp.calledOnce).to.be.true;
42 | const params = (connection as any).signatureHelp.firstCall.args[0];
43 | expect(params).to.deep.equal({
44 | textDocument: { uri: 'file:///test.txt' },
45 | position: { line: 0, character: 1 },
46 | });
47 | expect(result).to.deep.equal({ signatures: [] });
48 | });
49 | });
50 | });
51 |
--------------------------------------------------------------------------------
/lib/adapters/logging-console-adapter.ts:
--------------------------------------------------------------------------------
1 | import { ConsoleApi } from 'atom-ide';
2 | import {
3 | LanguageClientConnection,
4 | LogMessageParams,
5 | MessageType,
6 | } from '../languageclient';
7 |
8 | /** Adapts Atom's user notifications to those of the language server protocol. */
9 | export default class LoggingConsoleAdapter {
10 | private _consoles: Set = new Set();
11 |
12 | /**
13 | * Create a new {LoggingConsoleAdapter} that will listen for log messages
14 | * via the supplied {LanguageClientConnection}.
15 | *
16 | * @param connection A {LanguageClientConnection} to the language server that will provide log messages.
17 | */
18 | constructor(connection: LanguageClientConnection) {
19 | connection.onLogMessage(this.logMessage.bind(this));
20 | }
21 |
22 | /** Dispose this adapter ensuring any resources are freed and events unhooked. */
23 | public dispose(): void {
24 | this.detachAll();
25 | }
26 |
27 | /**
28 | * Public: Attach this {LoggingConsoleAdapter} to a given {ConsoleApi}.
29 | *
30 | * @param console A {ConsoleApi} that wants to receive messages.
31 | */
32 | public attach(console: ConsoleApi): void {
33 | this._consoles.add(console);
34 | }
35 |
36 | /** Public: Remove all {ConsoleApi}'s attached to this adapter. */
37 | public detachAll(): void {
38 | this._consoles.clear();
39 | }
40 |
41 | /**
42 | * Log a message using the Atom IDE UI Console API.
43 | *
44 | * @param params The {LogMessageParams} received from the language server
45 | * indicating the details of the message to be loggedd.
46 | */
47 | private logMessage(params: LogMessageParams): void {
48 | switch (params.type) {
49 | case MessageType.Error: {
50 | this._consoles.forEach((c) => c.error(params.message));
51 | return;
52 | }
53 | case MessageType.Warning: {
54 | this._consoles.forEach((c) => c.warn(params.message));
55 | return;
56 | }
57 | case MessageType.Info: {
58 | this._consoles.forEach((c) => c.info(params.message));
59 | return;
60 | }
61 | case MessageType.Log: {
62 | this._consoles.forEach((c) => c.log(params.message));
63 | return;
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/lib/adapters/signature-help-adapter.ts:
--------------------------------------------------------------------------------
1 | import * as atomIde from 'atom-ide';
2 | import assert = require('assert');
3 | import Convert from '../convert';
4 | import { ActiveServer } from '../server-manager';
5 | import {
6 | CompositeDisposable,
7 | Point,
8 | TextEditor,
9 | } from 'atom';
10 | import {
11 | LanguageClientConnection,
12 | ServerCapabilities,
13 | SignatureHelp,
14 | } from '../languageclient';
15 |
16 | export default class SignatureHelpAdapter {
17 | private _disposables: CompositeDisposable = new CompositeDisposable();
18 | private _connection: LanguageClientConnection;
19 | private _capabilities: ServerCapabilities;
20 | private _grammarScopes: string[];
21 |
22 | constructor(server: ActiveServer, grammarScopes: string[]) {
23 | this._connection = server.connection;
24 | this._capabilities = server.capabilities;
25 | this._grammarScopes = grammarScopes;
26 | }
27 |
28 | /**
29 | * @returns A {Boolean} indicating this adapter can adapt the server based on the
30 | * given serverCapabilities.
31 | */
32 | public static canAdapt(serverCapabilities: ServerCapabilities): boolean {
33 | return serverCapabilities.signatureHelpProvider != null;
34 | }
35 |
36 | public dispose() {
37 | this._disposables.dispose();
38 | }
39 |
40 | public attach(register: atomIde.SignatureHelpRegistry): void {
41 | const { signatureHelpProvider } = this._capabilities;
42 | assert(signatureHelpProvider != null);
43 |
44 | let triggerCharacters: Set | undefined;
45 | if (signatureHelpProvider && Array.isArray(signatureHelpProvider.triggerCharacters)) {
46 | triggerCharacters = new Set(signatureHelpProvider.triggerCharacters);
47 | }
48 |
49 | this._disposables.add(
50 | register({
51 | priority: 1,
52 | grammarScopes: this._grammarScopes,
53 | triggerCharacters,
54 | getSignatureHelp: this.getSignatureHelp.bind(this),
55 | }),
56 | );
57 | }
58 |
59 | /** Public: Retrieves signature help for a given editor and position. */
60 | public getSignatureHelp(editor: TextEditor, point: Point): Promise {
61 | return this._connection.signatureHelp(Convert.editorToTextDocumentPositionParams(editor, point));
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/lib/adapters/rename-adapter.ts:
--------------------------------------------------------------------------------
1 | import * as atomIde from 'atom-ide';
2 | import Convert from '../convert';
3 | import {
4 | Point,
5 | TextEditor,
6 | } from 'atom';
7 | import {
8 | LanguageClientConnection,
9 | RenameParams,
10 | ServerCapabilities,
11 | TextDocumentEdit,
12 | TextEdit,
13 | } from '../languageclient';
14 |
15 | export default class RenameAdapter {
16 | public static canAdapt(serverCapabilities: ServerCapabilities): boolean {
17 | return serverCapabilities.renameProvider === true;
18 | }
19 |
20 | public static async getRename(
21 | connection: LanguageClientConnection,
22 | editor: TextEditor,
23 | point: Point,
24 | newName: string,
25 | ): Promise