@lewin671/lsp-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +64 -0
- package/lib/common/Feature.d.ts +192 -0
- package/lib/common/Feature.js +159 -0
- package/lib/common/Feature.js.map +1 -0
- package/lib/common/LanguageClient.d.ts +230 -0
- package/lib/common/LanguageClient.js +512 -0
- package/lib/common/LanguageClient.js.map +1 -0
- package/lib/common/features/CompletionFeature.d.ts +23 -0
- package/lib/common/features/CompletionFeature.js +101 -0
- package/lib/common/features/CompletionFeature.js.map +1 -0
- package/lib/common/features/DefinitionFeature.d.ts +23 -0
- package/lib/common/features/DefinitionFeature.js +49 -0
- package/lib/common/features/DefinitionFeature.js.map +1 -0
- package/lib/common/features/DiagnosticFeature.d.ts +15 -0
- package/lib/common/features/DiagnosticFeature.js +39 -0
- package/lib/common/features/DiagnosticFeature.js.map +1 -0
- package/lib/common/features/DocumentSymbolFeature.d.ts +23 -0
- package/lib/common/features/DocumentSymbolFeature.js +87 -0
- package/lib/common/features/DocumentSymbolFeature.js.map +1 -0
- package/lib/common/features/FormattingFeature.d.ts +32 -0
- package/lib/common/features/FormattingFeature.js +72 -0
- package/lib/common/features/FormattingFeature.js.map +1 -0
- package/lib/common/features/HoverFeature.d.ts +23 -0
- package/lib/common/features/HoverFeature.js +49 -0
- package/lib/common/features/HoverFeature.js.map +1 -0
- package/lib/common/features/ReferencesFeature.d.ts +23 -0
- package/lib/common/features/ReferencesFeature.js +48 -0
- package/lib/common/features/ReferencesFeature.js.map +1 -0
- package/lib/common/features/RenameFeature.d.ts +37 -0
- package/lib/common/features/RenameFeature.js +72 -0
- package/lib/common/features/RenameFeature.js.map +1 -0
- package/lib/common/features/index.d.ts +8 -0
- package/lib/common/features/index.js +21 -0
- package/lib/common/features/index.js.map +1 -0
- package/lib/common/utils/index.d.ts +2 -0
- package/lib/common/utils/index.js +19 -0
- package/lib/common/utils/index.js.map +1 -0
- package/lib/common/utils/is.d.ts +15 -0
- package/lib/common/utils/is.js +56 -0
- package/lib/common/utils/is.js.map +1 -0
- package/lib/common/utils/uuid.d.ts +17 -0
- package/lib/common/utils/uuid.js +87 -0
- package/lib/common/utils/uuid.js.map +1 -0
- package/lib/demo/custom-lsp/client.d.ts +1 -0
- package/lib/demo/custom-lsp/client.js +86 -0
- package/lib/demo/custom-lsp/client.js.map +1 -0
- package/lib/demo/custom-lsp/server.d.ts +1 -0
- package/lib/demo/custom-lsp/server.js +64 -0
- package/lib/demo/custom-lsp/server.js.map +1 -0
- package/lib/demo/go-demo/client.d.ts +14 -0
- package/lib/demo/go-demo/client.js +697 -0
- package/lib/demo/go-demo/client.js.map +1 -0
- package/lib/demo/typescript-demo/client.d.ts +14 -0
- package/lib/demo/typescript-demo/client.js +680 -0
- package/lib/demo/typescript-demo/client.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/index.d.ts +9 -0
- package/lib/demo/typescript-demo/sample-project/src/index.js +65 -0
- package/lib/demo/typescript-demo/sample-project/src/index.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/math.d.ts +38 -0
- package/lib/demo/typescript-demo/sample-project/src/math.js +63 -0
- package/lib/demo/typescript-demo/sample-project/src/math.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/models/person.d.ts +41 -0
- package/lib/demo/typescript-demo/sample-project/src/models/person.js +53 -0
- package/lib/demo/typescript-demo/sample-project/src/models/person.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/services/calculator.d.ts +39 -0
- package/lib/demo/typescript-demo/sample-project/src/services/calculator.js +69 -0
- package/lib/demo/typescript-demo/sample-project/src/services/calculator.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/services/user-service.d.ts +40 -0
- package/lib/demo/typescript-demo/sample-project/src/services/user-service.js +88 -0
- package/lib/demo/typescript-demo/sample-project/src/services/user-service.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +32 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/IHost.d.ts +19 -0
- package/lib/interfaces/IHost.js +3 -0
- package/lib/interfaces/IHost.js.map +1 -0
- package/lib/transports/ITransport.d.ts +8 -0
- package/lib/transports/ITransport.js +3 -0
- package/lib/transports/ITransport.js.map +1 -0
- package/lib/transports/StdioTransport.d.ts +13 -0
- package/lib/transports/StdioTransport.js +27 -0
- package/lib/transports/StdioTransport.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ClientCapabilities, ServerCapabilities, DefinitionParams, Definition, DefinitionLink, DocumentSelector } from 'vscode-languageserver-protocol';
|
|
2
|
+
import { Feature, StaticFeature, FeatureState } from '../Feature';
|
|
3
|
+
import { LanguageClient } from '../LanguageClient';
|
|
4
|
+
/**
|
|
5
|
+
* Definition feature - implements LSP go to definition capability
|
|
6
|
+
*/
|
|
7
|
+
export declare class DefinitionFeature implements Feature, StaticFeature {
|
|
8
|
+
private client;
|
|
9
|
+
private _serverSupportsDefinition;
|
|
10
|
+
constructor(client: LanguageClient);
|
|
11
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
12
|
+
initialize(capabilities: ServerCapabilities, documentSelector?: DocumentSelector): void;
|
|
13
|
+
getState(): FeatureState;
|
|
14
|
+
clear(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if definition is supported
|
|
17
|
+
*/
|
|
18
|
+
get isSupported(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Go to definition
|
|
21
|
+
*/
|
|
22
|
+
provideDefinition(params: DefinitionParams): Promise<Definition | DefinitionLink[] | null>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefinitionFeature = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const Feature_1 = require("../Feature");
|
|
6
|
+
/**
|
|
7
|
+
* Definition feature - implements LSP go to definition capability
|
|
8
|
+
*/
|
|
9
|
+
class DefinitionFeature {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this._serverSupportsDefinition = false;
|
|
13
|
+
}
|
|
14
|
+
fillClientCapabilities(capabilities) {
|
|
15
|
+
const definitionSupport = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'definition');
|
|
16
|
+
definitionSupport.dynamicRegistration = true;
|
|
17
|
+
definitionSupport.linkSupport = true;
|
|
18
|
+
}
|
|
19
|
+
initialize(capabilities, documentSelector) {
|
|
20
|
+
if (capabilities.definitionProvider) {
|
|
21
|
+
this._serverSupportsDefinition = true;
|
|
22
|
+
console.log('[DefinitionFeature] Server supports definition');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
getState() {
|
|
26
|
+
return { kind: 'static' };
|
|
27
|
+
}
|
|
28
|
+
clear() {
|
|
29
|
+
this._serverSupportsDefinition = false;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if definition is supported
|
|
33
|
+
*/
|
|
34
|
+
get isSupported() {
|
|
35
|
+
return this._serverSupportsDefinition;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Go to definition
|
|
39
|
+
*/
|
|
40
|
+
async provideDefinition(params) {
|
|
41
|
+
const connection = this.client.getConnection();
|
|
42
|
+
if (!connection || !this._serverSupportsDefinition) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, params);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.DefinitionFeature = DefinitionFeature;
|
|
49
|
+
//# sourceMappingURL=DefinitionFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefinitionFeature.js","sourceRoot":"","sources":["../../../src/common/features/DefinitionFeature.ts"],"names":[],"mappings":";;;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ities, DocumentSelector } from 'vscode-languageserver-protocol';
|
|
2
|
+
import { Feature, StaticFeature, FeatureState } from '../Feature';
|
|
3
|
+
import { LanguageClient } from '../LanguageClient';
|
|
4
|
+
/**
|
|
5
|
+
* Diagnostic feature - handles publish diagnostics from server
|
|
6
|
+
*/
|
|
7
|
+
export declare class DiagnosticFeature implements Feature, StaticFeature {
|
|
8
|
+
private client;
|
|
9
|
+
private _disposable;
|
|
10
|
+
constructor(client: LanguageClient);
|
|
11
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
12
|
+
initialize(capabilities: ServerCapabilities, documentSelector?: DocumentSelector): void;
|
|
13
|
+
getState(): FeatureState;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiagnosticFeature = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const Feature_1 = require("../Feature");
|
|
6
|
+
/**
|
|
7
|
+
* Diagnostic feature - handles publish diagnostics from server
|
|
8
|
+
*/
|
|
9
|
+
class DiagnosticFeature {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
fillClientCapabilities(capabilities) {
|
|
14
|
+
const diagnostics = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'publishDiagnostics');
|
|
15
|
+
diagnostics.relatedInformation = true;
|
|
16
|
+
diagnostics.tagSupport = {
|
|
17
|
+
valueSet: [vscode_languageserver_protocol_1.DiagnosticTag.Unnecessary, vscode_languageserver_protocol_1.DiagnosticTag.Deprecated]
|
|
18
|
+
};
|
|
19
|
+
diagnostics.versionSupport = true;
|
|
20
|
+
diagnostics.codeDescriptionSupport = true;
|
|
21
|
+
diagnostics.dataSupport = true;
|
|
22
|
+
}
|
|
23
|
+
initialize(capabilities, documentSelector) {
|
|
24
|
+
// Diagnostics are handled in the LanguageClient's built-in listeners
|
|
25
|
+
// We just need to ensure the capability is set up properly
|
|
26
|
+
console.log('[DiagnosticFeature] Diagnostics support initialized');
|
|
27
|
+
}
|
|
28
|
+
getState() {
|
|
29
|
+
return { kind: 'static' };
|
|
30
|
+
}
|
|
31
|
+
clear() {
|
|
32
|
+
if (this._disposable) {
|
|
33
|
+
this._disposable.dispose();
|
|
34
|
+
this._disposable = undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.DiagnosticFeature = DiagnosticFeature;
|
|
39
|
+
//# sourceMappingURL=DiagnosticFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagnosticFeature.js","sourceRoot":"","sources":["../../../src/common/features/DiagnosticFeature.ts"],"names":[],"mappings":";;;AAAA,mFAOwC;AACxC,wCAKoB;AAGpB;;GAEG;AACH,MAAa,iBAAiB;IAG1B,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C,sBAAsB,CAAC,YAAgC;QACnD,MAAM,WAAW,GAAG,IAAA,gBAAM,EAAC,IAAA,gBAAM,EAAC,YAAY,EAAE,cAAc,CAAE,EAAE,oBAAoB,CAAE,CAAC;QACzF,WAAW,CAAC,kBAAkB,GAAG,IAAI,CAAC;QACtC,WAAW,CAAC,UAAU,GAAG;YACrB,QAAQ,EAAE,CAAC,8CAAa,CAAC,WAAW,EAAE,8CAAa,CAAC,UAAU,CAAC;SAClE,CAAC;QACF,WAAW,CAAC,cAAc,GAAG,IAAI,CAAC;QAClC,WAAW,CAAC,sBAAsB,GAAG,IAAI,CAAC;QAC1C,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,UAAU,CAAC,YAAgC,EAAE,gBAAmC;QAC5E,qEAAqE;QACrE,2DAA2D;QAC3D,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACvE,CAAC;IAED,QAAQ;QACJ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QACjC,CAAC;IACL,CAAC;CACJ;AAhCD,8CAgCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ClientCapabilities, ServerCapabilities, DocumentSymbolParams, DocumentSymbol, SymbolInformation, DocumentSelector } from 'vscode-languageserver-protocol';
|
|
2
|
+
import { Feature, StaticFeature, FeatureState } from '../Feature';
|
|
3
|
+
import { LanguageClient } from '../LanguageClient';
|
|
4
|
+
/**
|
|
5
|
+
* Document Symbol feature - implements LSP document symbols capability
|
|
6
|
+
*/
|
|
7
|
+
export declare class DocumentSymbolFeature implements Feature, StaticFeature {
|
|
8
|
+
private client;
|
|
9
|
+
private _serverSupportsDocumentSymbol;
|
|
10
|
+
constructor(client: LanguageClient);
|
|
11
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
12
|
+
initialize(capabilities: ServerCapabilities, documentSelector?: DocumentSelector): void;
|
|
13
|
+
getState(): FeatureState;
|
|
14
|
+
clear(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if document symbols is supported
|
|
17
|
+
*/
|
|
18
|
+
get isSupported(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Get document symbols
|
|
21
|
+
*/
|
|
22
|
+
getDocumentSymbols(params: DocumentSymbolParams): Promise<DocumentSymbol[] | SymbolInformation[] | null>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentSymbolFeature = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const Feature_1 = require("../Feature");
|
|
6
|
+
/**
|
|
7
|
+
* Supported symbol kinds
|
|
8
|
+
*/
|
|
9
|
+
const SupportedSymbolKinds = [
|
|
10
|
+
vscode_languageserver_protocol_1.SymbolKind.File,
|
|
11
|
+
vscode_languageserver_protocol_1.SymbolKind.Module,
|
|
12
|
+
vscode_languageserver_protocol_1.SymbolKind.Namespace,
|
|
13
|
+
vscode_languageserver_protocol_1.SymbolKind.Package,
|
|
14
|
+
vscode_languageserver_protocol_1.SymbolKind.Class,
|
|
15
|
+
vscode_languageserver_protocol_1.SymbolKind.Method,
|
|
16
|
+
vscode_languageserver_protocol_1.SymbolKind.Property,
|
|
17
|
+
vscode_languageserver_protocol_1.SymbolKind.Field,
|
|
18
|
+
vscode_languageserver_protocol_1.SymbolKind.Constructor,
|
|
19
|
+
vscode_languageserver_protocol_1.SymbolKind.Enum,
|
|
20
|
+
vscode_languageserver_protocol_1.SymbolKind.Interface,
|
|
21
|
+
vscode_languageserver_protocol_1.SymbolKind.Function,
|
|
22
|
+
vscode_languageserver_protocol_1.SymbolKind.Variable,
|
|
23
|
+
vscode_languageserver_protocol_1.SymbolKind.Constant,
|
|
24
|
+
vscode_languageserver_protocol_1.SymbolKind.String,
|
|
25
|
+
vscode_languageserver_protocol_1.SymbolKind.Number,
|
|
26
|
+
vscode_languageserver_protocol_1.SymbolKind.Boolean,
|
|
27
|
+
vscode_languageserver_protocol_1.SymbolKind.Array,
|
|
28
|
+
vscode_languageserver_protocol_1.SymbolKind.Object,
|
|
29
|
+
vscode_languageserver_protocol_1.SymbolKind.Key,
|
|
30
|
+
vscode_languageserver_protocol_1.SymbolKind.Null,
|
|
31
|
+
vscode_languageserver_protocol_1.SymbolKind.EnumMember,
|
|
32
|
+
vscode_languageserver_protocol_1.SymbolKind.Struct,
|
|
33
|
+
vscode_languageserver_protocol_1.SymbolKind.Event,
|
|
34
|
+
vscode_languageserver_protocol_1.SymbolKind.Operator,
|
|
35
|
+
vscode_languageserver_protocol_1.SymbolKind.TypeParameter
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* Document Symbol feature - implements LSP document symbols capability
|
|
39
|
+
*/
|
|
40
|
+
class DocumentSymbolFeature {
|
|
41
|
+
constructor(client) {
|
|
42
|
+
this.client = client;
|
|
43
|
+
this._serverSupportsDocumentSymbol = false;
|
|
44
|
+
}
|
|
45
|
+
fillClientCapabilities(capabilities) {
|
|
46
|
+
const documentSymbolCapability = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'documentSymbol');
|
|
47
|
+
documentSymbolCapability.dynamicRegistration = true;
|
|
48
|
+
documentSymbolCapability.symbolKind = {
|
|
49
|
+
valueSet: SupportedSymbolKinds
|
|
50
|
+
};
|
|
51
|
+
documentSymbolCapability.hierarchicalDocumentSymbolSupport = true;
|
|
52
|
+
documentSymbolCapability.tagSupport = {
|
|
53
|
+
valueSet: [vscode_languageserver_protocol_1.SymbolTag.Deprecated]
|
|
54
|
+
};
|
|
55
|
+
documentSymbolCapability.labelSupport = true;
|
|
56
|
+
}
|
|
57
|
+
initialize(capabilities, documentSelector) {
|
|
58
|
+
if (capabilities.documentSymbolProvider) {
|
|
59
|
+
this._serverSupportsDocumentSymbol = true;
|
|
60
|
+
console.log('[DocumentSymbolFeature] Server supports document symbols');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
getState() {
|
|
64
|
+
return { kind: 'static' };
|
|
65
|
+
}
|
|
66
|
+
clear() {
|
|
67
|
+
this._serverSupportsDocumentSymbol = false;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Check if document symbols is supported
|
|
71
|
+
*/
|
|
72
|
+
get isSupported() {
|
|
73
|
+
return this._serverSupportsDocumentSymbol;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get document symbols
|
|
77
|
+
*/
|
|
78
|
+
async getDocumentSymbols(params) {
|
|
79
|
+
const connection = this.client.getConnection();
|
|
80
|
+
if (!connection || !this._serverSupportsDocumentSymbol) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, params);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.DocumentSymbolFeature = DocumentSymbolFeature;
|
|
87
|
+
//# sourceMappingURL=DocumentSymbolFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentSymbolFeature.js","sourceRoot":"","sources":["../../../src/common/features/DocumentSymbolFeature.ts"],"names":[],"mappings":";;;AAAA,mFAUwC;AACxC,wCAKoB;AAGpB;;GAEG;AACH,MAAM,oBAAoB,GAAiB;IACvC,2CAAU,CAAC,IAAI;IACf,2CAAU,CAAC,MAAM;IACjB,2CAAU,CAAC,SAAS;IACpB,2CAAU,CAAC,OAAO;IAClB,2CAAU,CAAC,KAAK;IAChB,2CAAU,CAAC,MAAM;IACjB,2CAAU,CAAC,QAAQ;IACnB,2CAAU,CAAC,KAAK;IAChB,2CAAU,CAAC,WAAW;IACtB,2CAAU,CAAC,IAAI;IACf,2CAAU,CAAC,SAAS;IACpB,2CAAU,CAAC,QAAQ;IACnB,2CAAU,CAAC,QAAQ;IACnB,2CAAU,CAAC,QAAQ;IACnB,2CAAU,CAAC,MAAM;IACjB,2CAAU,CAAC,MAAM;IACjB,2CAAU,CAAC,OAAO;IAClB,2CAAU,CAAC,KAAK;IAChB,2CAAU,CAAC,MAAM;IACjB,2CAAU,CAAC,GAAG;IACd,2CAAU,CAAC,IAAI;IACf,2CAAU,CAAC,UAAU;IACrB,2CAAU,CAAC,MAAM;IACjB,2CAAU,CAAC,KAAK;IAChB,2CAAU,CAAC,QAAQ;IACnB,2CAAU,CAAC,aAAa;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAa,qBAAqB;IAG9B,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QAFlC,kCAA6B,GAAY,KAAK,CAAC;IAEV,C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
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ClientCapabilities, ServerCapabilities, DocumentFormattingParams, DocumentRangeFormattingParams, TextEdit, DocumentSelector } from 'vscode-languageserver-protocol';
|
|
2
|
+
import { Feature, StaticFeature, FeatureState } from '../Feature';
|
|
3
|
+
import { LanguageClient } from '../LanguageClient';
|
|
4
|
+
/**
|
|
5
|
+
* Formatting feature - implements LSP document formatting capability
|
|
6
|
+
*/
|
|
7
|
+
export declare class FormattingFeature implements Feature, StaticFeature {
|
|
8
|
+
private client;
|
|
9
|
+
private _serverSupportsFormatting;
|
|
10
|
+
private _serverSupportsRangeFormatting;
|
|
11
|
+
constructor(client: LanguageClient);
|
|
12
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
13
|
+
initialize(capabilities: ServerCapabilities, documentSelector?: DocumentSelector): void;
|
|
14
|
+
getState(): FeatureState;
|
|
15
|
+
clear(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Check if formatting is supported
|
|
18
|
+
*/
|
|
19
|
+
get isFormattingSupported(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Check if range formatting is supported
|
|
22
|
+
*/
|
|
23
|
+
get isRangeFormattingSupported(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Format entire document
|
|
26
|
+
*/
|
|
27
|
+
formatDocument(params: DocumentFormattingParams): Promise<TextEdit[] | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Format document range
|
|
30
|
+
*/
|
|
31
|
+
formatRange(params: DocumentRangeFormattingParams): Promise<TextEdit[] | null>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormattingFeature = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const Feature_1 = require("../Feature");
|
|
6
|
+
/**
|
|
7
|
+
* Formatting feature - implements LSP document formatting capability
|
|
8
|
+
*/
|
|
9
|
+
class FormattingFeature {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this._serverSupportsFormatting = false;
|
|
13
|
+
this._serverSupportsRangeFormatting = false;
|
|
14
|
+
}
|
|
15
|
+
fillClientCapabilities(capabilities) {
|
|
16
|
+
const formattingCapability = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'formatting');
|
|
17
|
+
formattingCapability.dynamicRegistration = true;
|
|
18
|
+
const rangeFormattingCapability = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'rangeFormatting');
|
|
19
|
+
rangeFormattingCapability.dynamicRegistration = true;
|
|
20
|
+
}
|
|
21
|
+
initialize(capabilities, documentSelector) {
|
|
22
|
+
if (capabilities.documentFormattingProvider) {
|
|
23
|
+
this._serverSupportsFormatting = true;
|
|
24
|
+
console.log('[FormattingFeature] Server supports document formatting');
|
|
25
|
+
}
|
|
26
|
+
if (capabilities.documentRangeFormattingProvider) {
|
|
27
|
+
this._serverSupportsRangeFormatting = true;
|
|
28
|
+
console.log('[FormattingFeature] Server supports range formatting');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
getState() {
|
|
32
|
+
return { kind: 'static' };
|
|
33
|
+
}
|
|
34
|
+
clear() {
|
|
35
|
+
this._serverSupportsFormatting = false;
|
|
36
|
+
this._serverSupportsRangeFormatting = false;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if formatting is supported
|
|
40
|
+
*/
|
|
41
|
+
get isFormattingSupported() {
|
|
42
|
+
return this._serverSupportsFormatting;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if range formatting is supported
|
|
46
|
+
*/
|
|
47
|
+
get isRangeFormattingSupported() {
|
|
48
|
+
return this._serverSupportsRangeFormatting;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Format entire document
|
|
52
|
+
*/
|
|
53
|
+
async formatDocument(params) {
|
|
54
|
+
const connection = this.client.getConnection();
|
|
55
|
+
if (!connection || !this._serverSupportsFormatting) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, params);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Format document range
|
|
62
|
+
*/
|
|
63
|
+
async formatRange(params) {
|
|
64
|
+
const connection = this.client.getConnection();
|
|
65
|
+
if (!connection || !this._serverSupportsRangeFormatting) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, params);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.FormattingFeature = FormattingFeature;
|
|
72
|
+
//# sourceMappingURL=FormattingFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormattingFeature.js","sourceRoot":"","sources":["../../../src/common/features/FormattingFeature.ts"],"names":[],"mappings":";;;AAAA,mFASwC;AACxC,wCAKoB;AAGpB;;GAEG;AACH,MAAa,iBAAiB;IAI1B,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QAHlC,8BAAyB,GAAY,KAAK,CAAC;QAC3C,mCAA8B,GAAY,KAAK,CAAC;IAEX,CAAC;IAE9C,sBAAsB,CAAC,YAAgC;QACnD,MAAM,oBAAoB,GAAG,IAAA,gBAAM,EAAC,IAAA,gBAAM,EAAC,YAAY,EAAE,cAAc,CAAE,EAAE,YAAY,CAAE,CAAC;QAC1F,oBAAoB,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAEhD,MAAM,yBAAyB,GAAG,IAAA,gBAAM,EAAC,IAAA,gBAAM,EAAC,YAAY,EAAE,cAAc,CAAE,EAAE,iBAAiB,CAAE,CAAC;QACpG,yBAAyB,CAAC,mBAAmB,GAAG,IAAI,CAAC;IACzD,CAAC;IAED,UAAU,CAAC,YAAgC,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AU,CAAC,WAAW,CAAC,+DAA8B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;CACJ;AArED,8CAqEC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ClientCapabilities, ServerCapabilities, HoverParams, Hover, DocumentSelector } from 'vscode-languageserver-protocol';
|
|
2
|
+
import { Feature, StaticFeature, FeatureState } from '../Feature';
|
|
3
|
+
import { LanguageClient } from '../LanguageClient';
|
|
4
|
+
/**
|
|
5
|
+
* Hover feature - implements LSP hover capability
|
|
6
|
+
*/
|
|
7
|
+
export declare class HoverFeature implements Feature, StaticFeature {
|
|
8
|
+
private client;
|
|
9
|
+
private _serverSupportsHover;
|
|
10
|
+
constructor(client: LanguageClient);
|
|
11
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
12
|
+
initialize(capabilities: ServerCapabilities, documentSelector?: DocumentSelector): void;
|
|
13
|
+
getState(): FeatureState;
|
|
14
|
+
clear(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if hover is supported
|
|
17
|
+
*/
|
|
18
|
+
get isSupported(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Provide hover information
|
|
21
|
+
*/
|
|
22
|
+
provideHover(params: HoverParams): Promise<Hover | null>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HoverFeature = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const Feature_1 = require("../Feature");
|
|
6
|
+
/**
|
|
7
|
+
* Hover feature - implements LSP hover capability
|
|
8
|
+
*/
|
|
9
|
+
class HoverFeature {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this._serverSupportsHover = false;
|
|
13
|
+
}
|
|
14
|
+
fillClientCapabilities(capabilities) {
|
|
15
|
+
const hoverCapability = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'hover');
|
|
16
|
+
hoverCapability.dynamicRegistration = true;
|
|
17
|
+
hoverCapability.contentFormat = [vscode_languageserver_protocol_1.MarkupKind.Markdown, vscode_languageserver_protocol_1.MarkupKind.PlainText];
|
|
18
|
+
}
|
|
19
|
+
initialize(capabilities, documentSelector) {
|
|
20
|
+
if (capabilities.hoverProvider) {
|
|
21
|
+
this._serverSupportsHover = true;
|
|
22
|
+
console.log('[HoverFeature] Server supports hover');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
getState() {
|
|
26
|
+
return { kind: 'static' };
|
|
27
|
+
}
|
|
28
|
+
clear() {
|
|
29
|
+
this._serverSupportsHover = false;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if hover is supported
|
|
33
|
+
*/
|
|
34
|
+
get isSupported() {
|
|
35
|
+
return this._serverSupportsHover;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Provide hover information
|
|
39
|
+
*/
|
|
40
|
+
async provideHover(params) {
|
|
41
|
+
const connection = this.client.getConnection();
|
|
42
|
+
if (!connection || !this._serverSupportsHover) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.HoverRequest.type, params);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.HoverFeature = HoverFeature;
|
|
49
|
+
//# sourceMappingURL=HoverFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverFeature.js","sourceRoot":"","sources":["../../../src/common/features/HoverFeature.ts"],"names":[],"mappings":";;;AAAA,mFAUwC;AACxC,wCAKoB;AAGpB;;GAEG;AACH,MAAa,YAAY;IAGrB,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QAFlC,yBAAoB,GAAY,KAAK,CAAC;IAED,CAAC;IAE9C,sBAAsB,CAAC,YAAgC;QACnD,MAAM,eAAe,GAAG,IAAA,gBAAM,EAAC,IAAA,gBAAM,EAAC,YAAY,EAAE,cAAc,CAAE,EAAE,OAAO,CAAE,CAAC;QAChF,eAAe,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAC3C,eAAe,CAAC,aAAa,GAAG,CAAC,2CAAU,CAAC,QAAQ,EAAE,2CAAU,CAAC,SAAS,CAAC,CAAC;IAChF,CAAC;IAED,UAAU,CAAC,YAAgC,EAAE,gBAAmC;QAC5E,IAAI,YAAY,CAAC,aAAa,EAAE,CAAC;YAC7B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IAED,QAAQ;QACJ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK;QACD,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,MAAmB;QAClC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,UAAU,CAAC,WAAW,CAAC,6CAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;CACJ;AA3CD,oCA2CC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ClientCapabilities, ServerCapabilities, ReferenceParams, Location, DocumentSelector } from 'vscode-languageserver-protocol';
|
|
2
|
+
import { Feature, StaticFeature, FeatureState } from '../Feature';
|
|
3
|
+
import { LanguageClient } from '../LanguageClient';
|
|
4
|
+
/**
|
|
5
|
+
* References feature - implements LSP find references capability
|
|
6
|
+
*/
|
|
7
|
+
export declare class ReferencesFeature implements Feature, StaticFeature {
|
|
8
|
+
private client;
|
|
9
|
+
private _serverSupportsReferences;
|
|
10
|
+
constructor(client: LanguageClient);
|
|
11
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
12
|
+
initialize(capabilities: ServerCapabilities, documentSelector?: DocumentSelector): void;
|
|
13
|
+
getState(): FeatureState;
|
|
14
|
+
clear(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if references is supported
|
|
17
|
+
*/
|
|
18
|
+
get isSupported(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Find references
|
|
21
|
+
*/
|
|
22
|
+
findReferences(params: ReferenceParams): Promise<Location[] | null>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReferencesFeature = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const Feature_1 = require("../Feature");
|
|
6
|
+
/**
|
|
7
|
+
* References feature - implements LSP find references capability
|
|
8
|
+
*/
|
|
9
|
+
class ReferencesFeature {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this._serverSupportsReferences = false;
|
|
13
|
+
}
|
|
14
|
+
fillClientCapabilities(capabilities) {
|
|
15
|
+
const referencesSupport = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'references');
|
|
16
|
+
referencesSupport.dynamicRegistration = true;
|
|
17
|
+
}
|
|
18
|
+
initialize(capabilities, documentSelector) {
|
|
19
|
+
if (capabilities.referencesProvider) {
|
|
20
|
+
this._serverSupportsReferences = true;
|
|
21
|
+
console.log('[ReferencesFeature] Server supports references');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
getState() {
|
|
25
|
+
return { kind: 'static' };
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this._serverSupportsReferences = false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if references is supported
|
|
32
|
+
*/
|
|
33
|
+
get isSupported() {
|
|
34
|
+
return this._serverSupportsReferences;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Find references
|
|
38
|
+
*/
|
|
39
|
+
async findReferences(params) {
|
|
40
|
+
const connection = this.client.getConnection();
|
|
41
|
+
if (!connection || !this._serverSupportsReferences) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, params);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ReferencesFeature = ReferencesFeature;
|
|
48
|
+
//# sourceMappingURL=ReferencesFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferencesFeature.js","sourceRoot":"","sources":["../../../src/common/features/ReferencesFeature.ts"],"names":[],"mappings":";;;AAAA,mFAOwC;AACxC,wCAKoB;AAGpB;;GAEG;AACH,MAAa,iBAAiB;IAG1B,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QAFlC,8BAAyB,GAAY,KAAK,CAAC;IAEN,CAAC;IAE9C,sBAAsB,CAAC,YAAgC;QACnD,MAAM,iBAAiB,GAAG,IAAA,gBAAM,EAAC,IAAA,gBAAM,EAAC,YAAY,EAAE,cAAc,CAAE,EAAE,YAAY,CAAE,CAAC;QACvF,iBAAiB,CAAC,mBAAmB,GAAG,IAAI,CAAC;IACjD,CAAC;IAED,UAAU,CAAC,YAAgC,EAAE,gBAAmC;QAC5E,IAAI,YAAY,CAAC,kBAAkB,EAAE,CAAC;YAClC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;IAED,QAAQ;QACJ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK;QACD,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,yBAAyB,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,MAAuB;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,UAAU,CAAC,WAAW,CAAC,kDAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC;CACJ;AA1CD,8CA0CC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ClientCapabilities, ServerCapabilities, RenameParams, PrepareRenameParams, WorkspaceEdit, Range, DocumentSelector } from 'vscode-languageserver-protocol';
|
|
2
|
+
import { Feature, StaticFeature, FeatureState } from '../Feature';
|
|
3
|
+
import { LanguageClient } from '../LanguageClient';
|
|
4
|
+
/**
|
|
5
|
+
* Rename feature - implements LSP rename capability
|
|
6
|
+
*/
|
|
7
|
+
export declare class RenameFeature implements Feature, StaticFeature {
|
|
8
|
+
private client;
|
|
9
|
+
private _serverSupportsRename;
|
|
10
|
+
private _serverSupportsPrepareRename;
|
|
11
|
+
constructor(client: LanguageClient);
|
|
12
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
13
|
+
initialize(capabilities: ServerCapabilities, documentSelector?: DocumentSelector): void;
|
|
14
|
+
getState(): FeatureState;
|
|
15
|
+
clear(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Check if rename is supported
|
|
18
|
+
*/
|
|
19
|
+
get isSupported(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Check if prepare rename is supported
|
|
22
|
+
*/
|
|
23
|
+
get isPrepareSupported(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Prepare rename - check if rename is valid at position
|
|
26
|
+
*/
|
|
27
|
+
prepareRename(params: PrepareRenameParams): Promise<Range | {
|
|
28
|
+
range: Range;
|
|
29
|
+
placeholder: string;
|
|
30
|
+
} | {
|
|
31
|
+
defaultBehavior: boolean;
|
|
32
|
+
} | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Perform rename
|
|
35
|
+
*/
|
|
36
|
+
rename(params: RenameParams): Promise<WorkspaceEdit | null>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenameFeature = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const Feature_1 = require("../Feature");
|
|
6
|
+
/**
|
|
7
|
+
* Rename feature - implements LSP rename capability
|
|
8
|
+
*/
|
|
9
|
+
class RenameFeature {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this._serverSupportsRename = false;
|
|
13
|
+
this._serverSupportsPrepareRename = false;
|
|
14
|
+
}
|
|
15
|
+
fillClientCapabilities(capabilities) {
|
|
16
|
+
const renameCapability = (0, Feature_1.ensure)((0, Feature_1.ensure)(capabilities, 'textDocument'), 'rename');
|
|
17
|
+
renameCapability.dynamicRegistration = true;
|
|
18
|
+
renameCapability.prepareSupport = true;
|
|
19
|
+
renameCapability.prepareSupportDefaultBehavior = 1; // Identifier
|
|
20
|
+
renameCapability.honorsChangeAnnotations = true;
|
|
21
|
+
}
|
|
22
|
+
initialize(capabilities, documentSelector) {
|
|
23
|
+
if (capabilities.renameProvider) {
|
|
24
|
+
this._serverSupportsRename = true;
|
|
25
|
+
if (typeof capabilities.renameProvider === 'object' && capabilities.renameProvider.prepareProvider) {
|
|
26
|
+
this._serverSupportsPrepareRename = true;
|
|
27
|
+
}
|
|
28
|
+
console.log('[RenameFeature] Server supports rename');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
getState() {
|
|
32
|
+
return { kind: 'static' };
|
|
33
|
+
}
|
|
34
|
+
clear() {
|
|
35
|
+
this._serverSupportsRename = false;
|
|
36
|
+
this._serverSupportsPrepareRename = false;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if rename is supported
|
|
40
|
+
*/
|
|
41
|
+
get isSupported() {
|
|
42
|
+
return this._serverSupportsRename;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if prepare rename is supported
|
|
46
|
+
*/
|
|
47
|
+
get isPrepareSupported() {
|
|
48
|
+
return this._serverSupportsPrepareRename;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Prepare rename - check if rename is valid at position
|
|
52
|
+
*/
|
|
53
|
+
async prepareRename(params) {
|
|
54
|
+
const connection = this.client.getConnection();
|
|
55
|
+
if (!connection || !this._serverSupportsPrepareRename) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, params);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Perform rename
|
|
62
|
+
*/
|
|
63
|
+
async rename(params) {
|
|
64
|
+
const connection = this.client.getConnection();
|
|
65
|
+
if (!connection || !this._serverSupportsRename) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return connection.sendRequest(vscode_languageserver_protocol_1.RenameRequest.type, params);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.RenameFeature = RenameFeature;
|
|
72
|
+
//# sourceMappingURL=RenameFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenameFeature.js","sourceRoot":"","sources":["../../../src/common/features/RenameFeature.ts"],"names":[],"mappings":";;;AAAA,mFAUwC;AACxC,wCAKoB;AAGpB;;GAEG;AACH,MAA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CAAC,MAA2B;QAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACpD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,UAAU,CAAC,WAAW,CAAC,qDAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,MAAoB;QAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,UAAU,CAAC,WAAW,CAAC,8CAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;CACJ;AApED,sCAoEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CompletionFeature } from './CompletionFeature';
|
|
2
|
+
export { DiagnosticFeature } from './DiagnosticFeature';
|
|
3
|
+
export { HoverFeature } from './HoverFeature';
|
|
4
|
+
export { DefinitionFeature } from './DefinitionFeature';
|
|
5
|
+
export { ReferencesFeature } from './ReferencesFeature';
|
|
6
|
+
export { DocumentSymbolFeature } from './DocumentSymbolFeature';
|
|
7
|
+
export { FormattingFeature } from './FormattingFeature';
|
|
8
|
+
export { RenameFeature } from './RenameFeature';
|