@codingame/monaco-languageclient-wrapper 5.0.0-next.1 → 5.0.0-update-monaco.1
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/dist/_virtual/_commonjsHelpers.js +1 -4
- package/dist/_virtual/_rollupPluginBabelHelpers.js +29 -29
- package/dist/_virtual/main3.js +4 -2
- package/dist/_virtual/protocol.inlineCompletion.js +2 -0
- package/dist/extensions/java/extension.js +1 -1
- package/dist/extensions/java/inlayHintsProvider.js +3 -4
- package/dist/extensions/java/protocol.js +15 -16
- package/dist/extensions/java/sourceAction.js +1 -1
- package/dist/index.d.ts +132 -9212
- package/dist/node_modules/delay/index.js +1 -2
- package/dist/node_modules/vscode-jsonrpc/browser.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/browser/main.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/api.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/cancellation.js +84 -86
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +19 -17
- package/dist/node_modules/vscode-jsonrpc/lib/common/disposable.js +11 -12
- package/dist/node_modules/vscode-jsonrpc/lib/common/events.js +112 -113
- package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +378 -380
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +1 -1
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageReader.js +186 -182
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +110 -111
- package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +231 -232
- package/dist/node_modules/vscode-languageserver-protocol/lib/browser/main.js +1 -1
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/api.js +5 -4
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/connection.js +1 -1
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/messages.js +41 -41
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +22 -20
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +16 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +41 -37
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +45 -39
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +16 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +22 -20
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js +13 -0
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +16 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +141 -69
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +24 -22
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +186 -181
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +26 -24
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +40 -36
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +10 -10
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +22 -20
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +16 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +1 -1
- package/dist/node_modules/vscode-languageserver-types/lib/esm/main.js +363 -338
- package/dist/src/createLanguageClient.js +41 -16
- package/dist/src/extensions/cobol.js +3 -3
- package/dist/src/extensions/tools.js +5 -1
- package/dist/src/extensions.js +6 -3
- package/dist/src/infrastructure.js +17 -2
- package/dist/src/languageClient.js +10 -12
- package/package.json +56 -52
- package/stats.html +32 -28
- package/dist/_virtual/_vscode.js +0 -4
- package/dist/_virtual/api3.js +0 -2
- package/dist/_virtual/async.js +0 -2
- package/dist/_virtual/callHierarchy.js +0 -2
- package/dist/_virtual/client.js +0 -2
- package/dist/_virtual/codeAction.js +0 -2
- package/dist/_virtual/codeConverter.js +0 -2
- package/dist/_virtual/codeLens.js +0 -2
- package/dist/_virtual/colorProvider.js +0 -2
- package/dist/_virtual/completion.js +0 -2
- package/dist/_virtual/configuration.js +0 -2
- package/dist/_virtual/declaration.js +0 -2
- package/dist/_virtual/definition.js +0 -2
- package/dist/_virtual/diagnostic.js +0 -2
- package/dist/_virtual/documentHighlight.js +0 -2
- package/dist/_virtual/documentLink.js +0 -2
- package/dist/_virtual/documentSymbol.js +0 -2
- package/dist/_virtual/executeCommand.js +0 -2
- package/dist/_virtual/features.js +0 -2
- package/dist/_virtual/fileOperations.js +0 -2
- package/dist/_virtual/fileSystemWatcher.js +0 -2
- package/dist/_virtual/foldingRange.js +0 -2
- package/dist/_virtual/formatting.js +0 -2
- package/dist/_virtual/hover.js +0 -2
- package/dist/_virtual/implementation.js +0 -2
- package/dist/_virtual/inlayHint.js +0 -2
- package/dist/_virtual/inlineValue.js +0 -2
- package/dist/_virtual/is3.js +0 -2
- package/dist/_virtual/linkedEditingRange.js +0 -2
- package/dist/_virtual/main4.js +0 -4
- package/dist/_virtual/notebook.js +0 -2
- package/dist/_virtual/path.js +0 -4
- package/dist/_virtual/progress.js +0 -2
- package/dist/_virtual/progressPart.js +0 -2
- package/dist/_virtual/protocolCallHierarchyItem.js +0 -2
- package/dist/_virtual/protocolCodeAction.js +0 -2
- package/dist/_virtual/protocolCodeLens.js +0 -2
- package/dist/_virtual/protocolCompletionItem.js +0 -2
- package/dist/_virtual/protocolConverter.js +0 -2
- package/dist/_virtual/protocolDiagnostic.js +0 -2
- package/dist/_virtual/protocolDocumentLink.js +0 -2
- package/dist/_virtual/protocolInlayHint.js +0 -2
- package/dist/_virtual/protocolTypeHierarchyItem.js +0 -2
- package/dist/_virtual/protocolWorkspaceSymbol.js +0 -2
- package/dist/_virtual/reference.js +0 -2
- package/dist/_virtual/rename.js +0 -2
- package/dist/_virtual/selectionRange.js +0 -2
- package/dist/_virtual/semanticTokens.js +0 -2
- package/dist/_virtual/signatureHelp.js +0 -2
- package/dist/_virtual/textSynchronization.js +0 -2
- package/dist/_virtual/typeDefinition.js +0 -2
- package/dist/_virtual/typeHierarchy.js +0 -2
- package/dist/_virtual/uuid.js +0 -2
- package/dist/_virtual/workspaceFolder.js +0 -2
- package/dist/_virtual/workspaceSymbol.js +0 -2
- package/dist/node_modules/balanced-match/index.js +0 -52
- package/dist/node_modules/monaco-languageclient/lib/monaco-language-client.js +0 -127
- package/dist/node_modules/vscode-languageclient/lib/browser/main.js +0 -49
- package/dist/node_modules/vscode-languageclient/lib/common/api.js +0 -51
- package/dist/node_modules/vscode-languageclient/lib/common/callHierarchy.js +0 -98
- package/dist/node_modules/vscode-languageclient/lib/common/client.js +0 -1527
- package/dist/node_modules/vscode-languageclient/lib/common/codeAction.js +0 -92
- package/dist/node_modules/vscode-languageclient/lib/common/codeConverter.js +0 -881
- package/dist/node_modules/vscode-languageclient/lib/common/codeLens.js +0 -84
- package/dist/node_modules/vscode-languageclient/lib/common/colorProvider.js +0 -77
- package/dist/node_modules/vscode-languageclient/lib/common/completion.js +0 -105
- package/dist/node_modules/vscode-languageclient/lib/common/configuration.js +0 -214
- package/dist/node_modules/vscode-languageclient/lib/common/declaration.js +0 -59
- package/dist/node_modules/vscode-languageclient/lib/common/definition.js +0 -62
- package/dist/node_modules/vscode-languageclient/lib/common/diagnostic.js +0 -839
- package/dist/node_modules/vscode-languageclient/lib/common/documentHighlight.js +0 -57
- package/dist/node_modules/vscode-languageclient/lib/common/documentLink.js +0 -74
- package/dist/node_modules/vscode-languageclient/lib/common/documentSymbol.js +0 -82
- package/dist/node_modules/vscode-languageclient/lib/common/executeCommand.js +0 -83
- package/dist/node_modules/vscode-languageclient/lib/common/features.js +0 -310
- package/dist/node_modules/vscode-languageclient/lib/common/fileOperations.js +0 -319
- package/dist/node_modules/vscode-languageclient/lib/common/fileSystemWatcher.js +0 -104
- package/dist/node_modules/vscode-languageclient/lib/common/foldingRange.js +0 -66
- package/dist/node_modules/vscode-languageclient/lib/common/formatting.js +0 -165
- package/dist/node_modules/vscode-languageclient/lib/common/hover.js +0 -62
- package/dist/node_modules/vscode-languageclient/lib/common/implementation.js +0 -59
- package/dist/node_modules/vscode-languageclient/lib/common/inlayHint.js +0 -94
- package/dist/node_modules/vscode-languageclient/lib/common/inlineValue.js +0 -73
- package/dist/node_modules/vscode-languageclient/lib/common/linkedEditingRange.js +0 -58
- package/dist/node_modules/vscode-languageclient/lib/common/notebook.js +0 -858
- package/dist/node_modules/vscode-languageclient/lib/common/progress.js +0 -51
- package/dist/node_modules/vscode-languageclient/lib/common/progressPart.js +0 -107
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCallHierarchyItem.js +0 -15
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeAction.js +0 -13
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCodeLens.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolCompletionItem.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolConverter.js +0 -1129
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDiagnostic.js +0 -27
- package/dist/node_modules/vscode-languageclient/lib/common/protocolDocumentLink.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolInlayHint.js +0 -12
- package/dist/node_modules/vscode-languageclient/lib/common/protocolTypeHierarchyItem.js +0 -15
- package/dist/node_modules/vscode-languageclient/lib/common/protocolWorkspaceSymbol.js +0 -17
- package/dist/node_modules/vscode-languageclient/lib/common/reference.js +0 -60
- package/dist/node_modules/vscode-languageclient/lib/common/rename.js +0 -112
- package/dist/node_modules/vscode-languageclient/lib/common/selectionRange.js +0 -62
- package/dist/node_modules/vscode-languageclient/lib/common/semanticTokens.js +0 -144
- package/dist/node_modules/vscode-languageclient/lib/common/signatureHelp.js +0 -78
- package/dist/node_modules/vscode-languageclient/lib/common/textSynchronization.js +0 -422
- package/dist/node_modules/vscode-languageclient/lib/common/typeDefinition.js +0 -60
- package/dist/node_modules/vscode-languageclient/lib/common/typeHierarchy.js +0 -97
- package/dist/node_modules/vscode-languageclient/lib/common/utils/async.js +0 -269
- package/dist/node_modules/vscode-languageclient/lib/common/utils/is.js +0 -54
- package/dist/node_modules/vscode-languageclient/lib/common/utils/uuid.js +0 -51
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceFolder.js +0 -154
- package/dist/node_modules/vscode-languageclient/lib/common/workspaceSymbol.js +0 -87
- package/dist/node_modules/vscode-languageclient/node_modules/brace-expansion/index.js +0 -160
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/lib/path.js +0 -2
- package/dist/node_modules/vscode-languageclient/node_modules/minimatch/minimatch.js +0 -567
- package/dist/node_modules/vscode-languageserver-protocol/browser.js +0 -4
|
@@ -1,881 +0,0 @@
|
|
|
1
|
-
import { __exports as codeConverter } from '../../../../_virtual/codeConverter.js';
|
|
2
|
-
import require$$0 from '../../../../_virtual/_vscode.js';
|
|
3
|
-
import { __exports as main } from '../../../../_virtual/main.js';
|
|
4
|
-
import '../../../vscode-languageserver-protocol/lib/browser/main.js';
|
|
5
|
-
import { __exports as is } from '../../../../_virtual/is.js';
|
|
6
|
-
import './utils/is.js';
|
|
7
|
-
import { __exports as async$1 } from '../../../../_virtual/async.js';
|
|
8
|
-
import './utils/async.js';
|
|
9
|
-
import { __exports as protocolCodeLens } from '../../../../_virtual/protocolCodeLens.js';
|
|
10
|
-
import './protocolCodeLens.js';
|
|
11
|
-
import { __exports as protocolCodeAction } from '../../../../_virtual/protocolCodeAction.js';
|
|
12
|
-
import './protocolCodeAction.js';
|
|
13
|
-
import { __exports as protocolDiagnostic } from '../../../../_virtual/protocolDiagnostic.js';
|
|
14
|
-
import './protocolDiagnostic.js';
|
|
15
|
-
import { __exports as protocolCallHierarchyItem } from '../../../../_virtual/protocolCallHierarchyItem.js';
|
|
16
|
-
import './protocolCallHierarchyItem.js';
|
|
17
|
-
import { __exports as protocolTypeHierarchyItem } from '../../../../_virtual/protocolTypeHierarchyItem.js';
|
|
18
|
-
import './protocolTypeHierarchyItem.js';
|
|
19
|
-
import { __exports as protocolWorkspaceSymbol } from '../../../../_virtual/protocolWorkspaceSymbol.js';
|
|
20
|
-
import './protocolWorkspaceSymbol.js';
|
|
21
|
-
import { __exports as protocolInlayHint } from '../../../../_virtual/protocolInlayHint.js';
|
|
22
|
-
import './protocolInlayHint.js';
|
|
23
|
-
import { __exports as protocolCompletionItem } from '../../../../_virtual/protocolCompletionItem.js';
|
|
24
|
-
import './protocolCompletionItem.js';
|
|
25
|
-
import { __exports as protocolDocumentLink } from '../../../../_virtual/protocolDocumentLink.js';
|
|
26
|
-
import './protocolDocumentLink.js';
|
|
27
|
-
Object.defineProperty(codeConverter, "__esModule", {
|
|
28
|
-
value: true
|
|
29
|
-
});
|
|
30
|
-
codeConverter.createConverter = void 0;
|
|
31
|
-
const code = require$$0;
|
|
32
|
-
const proto = main;
|
|
33
|
-
const Is = is;
|
|
34
|
-
const async = async$1;
|
|
35
|
-
const protocolCompletionItem_1 = protocolCompletionItem;
|
|
36
|
-
const protocolCodeLens_1 = protocolCodeLens;
|
|
37
|
-
const protocolDocumentLink_1 = protocolDocumentLink;
|
|
38
|
-
const protocolCodeAction_1 = protocolCodeAction;
|
|
39
|
-
const protocolDiagnostic_1 = protocolDiagnostic;
|
|
40
|
-
const protocolCallHierarchyItem_1 = protocolCallHierarchyItem;
|
|
41
|
-
const protocolTypeHierarchyItem_1 = protocolTypeHierarchyItem;
|
|
42
|
-
const protocolWorkspaceSymbol_1 = protocolWorkspaceSymbol;
|
|
43
|
-
const protocolInlayHint_1 = protocolInlayHint;
|
|
44
|
-
var InsertReplaceRange;
|
|
45
|
-
(function (InsertReplaceRange) {
|
|
46
|
-
function is(value) {
|
|
47
|
-
const candidate = value;
|
|
48
|
-
return candidate && !!candidate.inserting && !!candidate.replacing;
|
|
49
|
-
}
|
|
50
|
-
InsertReplaceRange.is = is;
|
|
51
|
-
})(InsertReplaceRange || (InsertReplaceRange = {}));
|
|
52
|
-
function createConverter(uriConverter) {
|
|
53
|
-
const nullConverter = value => value.toString();
|
|
54
|
-
const _uriConverter = uriConverter || nullConverter;
|
|
55
|
-
function asUri(value) {
|
|
56
|
-
return _uriConverter(value);
|
|
57
|
-
}
|
|
58
|
-
function asTextDocumentIdentifier(textDocument) {
|
|
59
|
-
return {
|
|
60
|
-
uri: _uriConverter(textDocument.uri)
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function asTextDocumentItem(textDocument) {
|
|
64
|
-
return {
|
|
65
|
-
uri: _uriConverter(textDocument.uri),
|
|
66
|
-
languageId: textDocument.languageId,
|
|
67
|
-
version: textDocument.version,
|
|
68
|
-
text: textDocument.getText()
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function asVersionedTextDocumentIdentifier(textDocument) {
|
|
72
|
-
return {
|
|
73
|
-
uri: _uriConverter(textDocument.uri),
|
|
74
|
-
version: textDocument.version
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function asOpenTextDocumentParams(textDocument) {
|
|
78
|
-
return {
|
|
79
|
-
textDocument: asTextDocumentItem(textDocument)
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function isTextDocumentChangeEvent(value) {
|
|
83
|
-
const candidate = value;
|
|
84
|
-
return !!candidate.document && !!candidate.contentChanges;
|
|
85
|
-
}
|
|
86
|
-
function isTextDocument(value) {
|
|
87
|
-
const candidate = value;
|
|
88
|
-
return !!candidate.uri && !!candidate.version;
|
|
89
|
-
}
|
|
90
|
-
function asChangeTextDocumentParams(arg0, arg1, arg2) {
|
|
91
|
-
if (isTextDocument(arg0)) {
|
|
92
|
-
const result = {
|
|
93
|
-
textDocument: {
|
|
94
|
-
uri: _uriConverter(arg0.uri),
|
|
95
|
-
version: arg0.version
|
|
96
|
-
},
|
|
97
|
-
contentChanges: [{
|
|
98
|
-
text: arg0.getText()
|
|
99
|
-
}]
|
|
100
|
-
};
|
|
101
|
-
return result;
|
|
102
|
-
} else if (isTextDocumentChangeEvent(arg0)) {
|
|
103
|
-
const uri = arg1;
|
|
104
|
-
const version = arg2;
|
|
105
|
-
const result = {
|
|
106
|
-
textDocument: {
|
|
107
|
-
uri: _uriConverter(uri),
|
|
108
|
-
version: version
|
|
109
|
-
},
|
|
110
|
-
contentChanges: arg0.contentChanges.map(change => {
|
|
111
|
-
const range = change.range;
|
|
112
|
-
return {
|
|
113
|
-
range: {
|
|
114
|
-
start: {
|
|
115
|
-
line: range.start.line,
|
|
116
|
-
character: range.start.character
|
|
117
|
-
},
|
|
118
|
-
end: {
|
|
119
|
-
line: range.end.line,
|
|
120
|
-
character: range.end.character
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
rangeLength: change.rangeLength,
|
|
124
|
-
text: change.text
|
|
125
|
-
};
|
|
126
|
-
})
|
|
127
|
-
};
|
|
128
|
-
return result;
|
|
129
|
-
} else {
|
|
130
|
-
throw Error('Unsupported text document change parameter');
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function asCloseTextDocumentParams(textDocument) {
|
|
134
|
-
return {
|
|
135
|
-
textDocument: asTextDocumentIdentifier(textDocument)
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function asSaveTextDocumentParams(textDocument) {
|
|
139
|
-
let includeContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
140
|
-
let result = {
|
|
141
|
-
textDocument: asTextDocumentIdentifier(textDocument)
|
|
142
|
-
};
|
|
143
|
-
if (includeContent) {
|
|
144
|
-
result.text = textDocument.getText();
|
|
145
|
-
}
|
|
146
|
-
return result;
|
|
147
|
-
}
|
|
148
|
-
function asTextDocumentSaveReason(reason) {
|
|
149
|
-
switch (reason) {
|
|
150
|
-
case code.TextDocumentSaveReason.Manual:
|
|
151
|
-
return proto.TextDocumentSaveReason.Manual;
|
|
152
|
-
case code.TextDocumentSaveReason.AfterDelay:
|
|
153
|
-
return proto.TextDocumentSaveReason.AfterDelay;
|
|
154
|
-
case code.TextDocumentSaveReason.FocusOut:
|
|
155
|
-
return proto.TextDocumentSaveReason.FocusOut;
|
|
156
|
-
}
|
|
157
|
-
return proto.TextDocumentSaveReason.Manual;
|
|
158
|
-
}
|
|
159
|
-
function asWillSaveTextDocumentParams(event) {
|
|
160
|
-
return {
|
|
161
|
-
textDocument: asTextDocumentIdentifier(event.document),
|
|
162
|
-
reason: asTextDocumentSaveReason(event.reason)
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function asDidCreateFilesParams(event) {
|
|
166
|
-
return {
|
|
167
|
-
files: event.files.map(fileUri => ({
|
|
168
|
-
uri: _uriConverter(fileUri)
|
|
169
|
-
}))
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function asDidRenameFilesParams(event) {
|
|
173
|
-
return {
|
|
174
|
-
files: event.files.map(file => ({
|
|
175
|
-
oldUri: _uriConverter(file.oldUri),
|
|
176
|
-
newUri: _uriConverter(file.newUri)
|
|
177
|
-
}))
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
function asDidDeleteFilesParams(event) {
|
|
181
|
-
return {
|
|
182
|
-
files: event.files.map(fileUri => ({
|
|
183
|
-
uri: _uriConverter(fileUri)
|
|
184
|
-
}))
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function asWillCreateFilesParams(event) {
|
|
188
|
-
return {
|
|
189
|
-
files: event.files.map(fileUri => ({
|
|
190
|
-
uri: _uriConverter(fileUri)
|
|
191
|
-
}))
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function asWillRenameFilesParams(event) {
|
|
195
|
-
return {
|
|
196
|
-
files: event.files.map(file => ({
|
|
197
|
-
oldUri: _uriConverter(file.oldUri),
|
|
198
|
-
newUri: _uriConverter(file.newUri)
|
|
199
|
-
}))
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
function asWillDeleteFilesParams(event) {
|
|
203
|
-
return {
|
|
204
|
-
files: event.files.map(fileUri => ({
|
|
205
|
-
uri: _uriConverter(fileUri)
|
|
206
|
-
}))
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
function asTextDocumentPositionParams(textDocument, position) {
|
|
210
|
-
return {
|
|
211
|
-
textDocument: asTextDocumentIdentifier(textDocument),
|
|
212
|
-
position: asWorkerPosition(position)
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
function asCompletionTriggerKind(triggerKind) {
|
|
216
|
-
switch (triggerKind) {
|
|
217
|
-
case code.CompletionTriggerKind.TriggerCharacter:
|
|
218
|
-
return proto.CompletionTriggerKind.TriggerCharacter;
|
|
219
|
-
case code.CompletionTriggerKind.TriggerForIncompleteCompletions:
|
|
220
|
-
return proto.CompletionTriggerKind.TriggerForIncompleteCompletions;
|
|
221
|
-
default:
|
|
222
|
-
return proto.CompletionTriggerKind.Invoked;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function asCompletionParams(textDocument, position, context) {
|
|
226
|
-
return {
|
|
227
|
-
textDocument: asTextDocumentIdentifier(textDocument),
|
|
228
|
-
position: asWorkerPosition(position),
|
|
229
|
-
context: {
|
|
230
|
-
triggerKind: asCompletionTriggerKind(context.triggerKind),
|
|
231
|
-
triggerCharacter: context.triggerCharacter
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function asSignatureHelpTriggerKind(triggerKind) {
|
|
236
|
-
switch (triggerKind) {
|
|
237
|
-
case code.SignatureHelpTriggerKind.Invoke:
|
|
238
|
-
return proto.SignatureHelpTriggerKind.Invoked;
|
|
239
|
-
case code.SignatureHelpTriggerKind.TriggerCharacter:
|
|
240
|
-
return proto.SignatureHelpTriggerKind.TriggerCharacter;
|
|
241
|
-
case code.SignatureHelpTriggerKind.ContentChange:
|
|
242
|
-
return proto.SignatureHelpTriggerKind.ContentChange;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
function asParameterInformation(value) {
|
|
246
|
-
return {
|
|
247
|
-
label: value.label
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function asParameterInformations(values) {
|
|
251
|
-
return values.map(asParameterInformation);
|
|
252
|
-
}
|
|
253
|
-
function asSignatureInformation(value) {
|
|
254
|
-
return {
|
|
255
|
-
label: value.label,
|
|
256
|
-
parameters: asParameterInformations(value.parameters)
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
function asSignatureInformations(values) {
|
|
260
|
-
return values.map(asSignatureInformation);
|
|
261
|
-
}
|
|
262
|
-
function asSignatureHelp(value) {
|
|
263
|
-
if (value === undefined) {
|
|
264
|
-
return value;
|
|
265
|
-
}
|
|
266
|
-
return {
|
|
267
|
-
signatures: asSignatureInformations(value.signatures),
|
|
268
|
-
activeSignature: value.activeSignature,
|
|
269
|
-
activeParameter: value.activeParameter
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function asSignatureHelpParams(textDocument, position, context) {
|
|
273
|
-
return {
|
|
274
|
-
textDocument: asTextDocumentIdentifier(textDocument),
|
|
275
|
-
position: asWorkerPosition(position),
|
|
276
|
-
context: {
|
|
277
|
-
isRetrigger: context.isRetrigger,
|
|
278
|
-
triggerCharacter: context.triggerCharacter,
|
|
279
|
-
triggerKind: asSignatureHelpTriggerKind(context.triggerKind),
|
|
280
|
-
activeSignatureHelp: asSignatureHelp(context.activeSignatureHelp)
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
function asWorkerPosition(position) {
|
|
285
|
-
return {
|
|
286
|
-
line: position.line,
|
|
287
|
-
character: position.character
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
function asPosition(value) {
|
|
291
|
-
if (value === undefined || value === null) {
|
|
292
|
-
return value;
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
line: value.line > proto.uinteger.MAX_VALUE ? proto.uinteger.MAX_VALUE : value.line,
|
|
296
|
-
character: value.character > proto.uinteger.MAX_VALUE ? proto.uinteger.MAX_VALUE : value.character
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
function asPositions(value, token) {
|
|
300
|
-
return async.map(value, asPosition, token);
|
|
301
|
-
}
|
|
302
|
-
function asRange(value) {
|
|
303
|
-
if (value === undefined || value === null) {
|
|
304
|
-
return value;
|
|
305
|
-
}
|
|
306
|
-
return {
|
|
307
|
-
start: asPosition(value.start),
|
|
308
|
-
end: asPosition(value.end)
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
function asLocation(value) {
|
|
312
|
-
if (value === undefined || value === null) {
|
|
313
|
-
return value;
|
|
314
|
-
}
|
|
315
|
-
return proto.Location.create(asUri(value.uri), asRange(value.range));
|
|
316
|
-
}
|
|
317
|
-
function asDiagnosticSeverity(value) {
|
|
318
|
-
switch (value) {
|
|
319
|
-
case code.DiagnosticSeverity.Error:
|
|
320
|
-
return proto.DiagnosticSeverity.Error;
|
|
321
|
-
case code.DiagnosticSeverity.Warning:
|
|
322
|
-
return proto.DiagnosticSeverity.Warning;
|
|
323
|
-
case code.DiagnosticSeverity.Information:
|
|
324
|
-
return proto.DiagnosticSeverity.Information;
|
|
325
|
-
case code.DiagnosticSeverity.Hint:
|
|
326
|
-
return proto.DiagnosticSeverity.Hint;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function asDiagnosticTags(tags) {
|
|
330
|
-
if (!tags) {
|
|
331
|
-
return undefined;
|
|
332
|
-
}
|
|
333
|
-
let result = [];
|
|
334
|
-
for (let tag of tags) {
|
|
335
|
-
let converted = asDiagnosticTag(tag);
|
|
336
|
-
if (converted !== undefined) {
|
|
337
|
-
result.push(converted);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return result.length > 0 ? result : undefined;
|
|
341
|
-
}
|
|
342
|
-
function asDiagnosticTag(tag) {
|
|
343
|
-
switch (tag) {
|
|
344
|
-
case code.DiagnosticTag.Unnecessary:
|
|
345
|
-
return proto.DiagnosticTag.Unnecessary;
|
|
346
|
-
case code.DiagnosticTag.Deprecated:
|
|
347
|
-
return proto.DiagnosticTag.Deprecated;
|
|
348
|
-
default:
|
|
349
|
-
return undefined;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
function asRelatedInformation(item) {
|
|
353
|
-
return {
|
|
354
|
-
message: item.message,
|
|
355
|
-
location: asLocation(item.location)
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
function asRelatedInformations(items) {
|
|
359
|
-
return items.map(asRelatedInformation);
|
|
360
|
-
}
|
|
361
|
-
function asDiagnosticCode(value) {
|
|
362
|
-
if (value === undefined || value === null) {
|
|
363
|
-
return undefined;
|
|
364
|
-
}
|
|
365
|
-
if (Is.number(value) || Is.string(value)) {
|
|
366
|
-
return value;
|
|
367
|
-
}
|
|
368
|
-
return {
|
|
369
|
-
value: value.value,
|
|
370
|
-
target: asUri(value.target)
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
function asDiagnostic(item) {
|
|
374
|
-
const result = proto.Diagnostic.create(asRange(item.range), item.message);
|
|
375
|
-
const protocolDiagnostic = item instanceof protocolDiagnostic_1.ProtocolDiagnostic ? item : undefined;
|
|
376
|
-
if (protocolDiagnostic !== undefined && protocolDiagnostic.data !== undefined) {
|
|
377
|
-
result.data = protocolDiagnostic.data;
|
|
378
|
-
}
|
|
379
|
-
const code = asDiagnosticCode(item.code);
|
|
380
|
-
if (protocolDiagnostic_1.DiagnosticCode.is(code)) {
|
|
381
|
-
if (protocolDiagnostic !== undefined && protocolDiagnostic.hasDiagnosticCode) {
|
|
382
|
-
result.code = code;
|
|
383
|
-
} else {
|
|
384
|
-
result.code = code.value;
|
|
385
|
-
result.codeDescription = {
|
|
386
|
-
href: code.target
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
} else {
|
|
390
|
-
result.code = code;
|
|
391
|
-
}
|
|
392
|
-
if (Is.number(item.severity)) {
|
|
393
|
-
result.severity = asDiagnosticSeverity(item.severity);
|
|
394
|
-
}
|
|
395
|
-
if (Array.isArray(item.tags)) {
|
|
396
|
-
result.tags = asDiagnosticTags(item.tags);
|
|
397
|
-
}
|
|
398
|
-
if (item.relatedInformation) {
|
|
399
|
-
result.relatedInformation = asRelatedInformations(item.relatedInformation);
|
|
400
|
-
}
|
|
401
|
-
if (item.source) {
|
|
402
|
-
result.source = item.source;
|
|
403
|
-
}
|
|
404
|
-
return result;
|
|
405
|
-
}
|
|
406
|
-
function asDiagnostics(items, token) {
|
|
407
|
-
if (items === undefined || items === null) {
|
|
408
|
-
return items;
|
|
409
|
-
}
|
|
410
|
-
return async.map(items, asDiagnostic, token);
|
|
411
|
-
}
|
|
412
|
-
function asDocumentation(format, documentation) {
|
|
413
|
-
switch (format) {
|
|
414
|
-
case '$string':
|
|
415
|
-
return documentation;
|
|
416
|
-
case proto.MarkupKind.PlainText:
|
|
417
|
-
return {
|
|
418
|
-
kind: format,
|
|
419
|
-
value: documentation
|
|
420
|
-
};
|
|
421
|
-
case proto.MarkupKind.Markdown:
|
|
422
|
-
return {
|
|
423
|
-
kind: format,
|
|
424
|
-
value: documentation.value
|
|
425
|
-
};
|
|
426
|
-
default:
|
|
427
|
-
return "Unsupported Markup content received. Kind is: ".concat(format);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
function asCompletionItemTag(tag) {
|
|
431
|
-
switch (tag) {
|
|
432
|
-
case code.CompletionItemTag.Deprecated:
|
|
433
|
-
return proto.CompletionItemTag.Deprecated;
|
|
434
|
-
}
|
|
435
|
-
return undefined;
|
|
436
|
-
}
|
|
437
|
-
function asCompletionItemTags(tags) {
|
|
438
|
-
if (tags === undefined) {
|
|
439
|
-
return tags;
|
|
440
|
-
}
|
|
441
|
-
const result = [];
|
|
442
|
-
for (let tag of tags) {
|
|
443
|
-
const converted = asCompletionItemTag(tag);
|
|
444
|
-
if (converted !== undefined) {
|
|
445
|
-
result.push(converted);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
return result;
|
|
449
|
-
}
|
|
450
|
-
function asCompletionItemKind(value, original) {
|
|
451
|
-
if (original !== undefined) {
|
|
452
|
-
return original;
|
|
453
|
-
}
|
|
454
|
-
return value + 1;
|
|
455
|
-
}
|
|
456
|
-
function asCompletionItem(item) {
|
|
457
|
-
let labelDetailsSupport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
458
|
-
let label;
|
|
459
|
-
let labelDetails;
|
|
460
|
-
if (Is.string(item.label)) {
|
|
461
|
-
label = item.label;
|
|
462
|
-
} else {
|
|
463
|
-
label = item.label.label;
|
|
464
|
-
if (labelDetailsSupport && (item.label.detail !== undefined || item.label.description !== undefined)) {
|
|
465
|
-
labelDetails = {
|
|
466
|
-
detail: item.label.detail,
|
|
467
|
-
description: item.label.description
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
let result = {
|
|
472
|
-
label: label
|
|
473
|
-
};
|
|
474
|
-
if (labelDetails !== undefined) {
|
|
475
|
-
result.labelDetails = labelDetails;
|
|
476
|
-
}
|
|
477
|
-
let protocolItem = item instanceof protocolCompletionItem_1.default ? item : undefined;
|
|
478
|
-
if (item.detail) {
|
|
479
|
-
result.detail = item.detail;
|
|
480
|
-
}
|
|
481
|
-
if (item.documentation) {
|
|
482
|
-
if (!protocolItem || protocolItem.documentationFormat === '$string') {
|
|
483
|
-
result.documentation = item.documentation;
|
|
484
|
-
} else {
|
|
485
|
-
result.documentation = asDocumentation(protocolItem.documentationFormat, item.documentation);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
if (item.filterText) {
|
|
489
|
-
result.filterText = item.filterText;
|
|
490
|
-
}
|
|
491
|
-
fillPrimaryInsertText(result, item);
|
|
492
|
-
if (Is.number(item.kind)) {
|
|
493
|
-
result.kind = asCompletionItemKind(item.kind, protocolItem && protocolItem.originalItemKind);
|
|
494
|
-
}
|
|
495
|
-
if (item.sortText) {
|
|
496
|
-
result.sortText = item.sortText;
|
|
497
|
-
}
|
|
498
|
-
if (item.additionalTextEdits) {
|
|
499
|
-
result.additionalTextEdits = asTextEdits(item.additionalTextEdits);
|
|
500
|
-
}
|
|
501
|
-
if (item.commitCharacters) {
|
|
502
|
-
result.commitCharacters = item.commitCharacters.slice();
|
|
503
|
-
}
|
|
504
|
-
if (item.command) {
|
|
505
|
-
result.command = asCommand(item.command);
|
|
506
|
-
}
|
|
507
|
-
if (item.preselect === true || item.preselect === false) {
|
|
508
|
-
result.preselect = item.preselect;
|
|
509
|
-
}
|
|
510
|
-
const tags = asCompletionItemTags(item.tags);
|
|
511
|
-
if (protocolItem) {
|
|
512
|
-
if (protocolItem.data !== undefined) {
|
|
513
|
-
result.data = protocolItem.data;
|
|
514
|
-
}
|
|
515
|
-
if (protocolItem.deprecated === true || protocolItem.deprecated === false) {
|
|
516
|
-
if (protocolItem.deprecated === true && tags !== undefined && tags.length > 0) {
|
|
517
|
-
const index = tags.indexOf(code.CompletionItemTag.Deprecated);
|
|
518
|
-
if (index !== -1) {
|
|
519
|
-
tags.splice(index, 1);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
result.deprecated = protocolItem.deprecated;
|
|
523
|
-
}
|
|
524
|
-
if (protocolItem.insertTextMode !== undefined) {
|
|
525
|
-
result.insertTextMode = protocolItem.insertTextMode;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
if (tags !== undefined && tags.length > 0) {
|
|
529
|
-
result.tags = tags;
|
|
530
|
-
}
|
|
531
|
-
if (result.insertTextMode === undefined && item.keepWhitespace === true) {
|
|
532
|
-
result.insertTextMode = proto.InsertTextMode.adjustIndentation;
|
|
533
|
-
}
|
|
534
|
-
return result;
|
|
535
|
-
}
|
|
536
|
-
function fillPrimaryInsertText(target, source) {
|
|
537
|
-
let format = proto.InsertTextFormat.PlainText;
|
|
538
|
-
let text = undefined;
|
|
539
|
-
let range = undefined;
|
|
540
|
-
if (source.textEdit) {
|
|
541
|
-
text = source.textEdit.newText;
|
|
542
|
-
range = source.textEdit.range;
|
|
543
|
-
} else if (source.insertText instanceof code.SnippetString) {
|
|
544
|
-
format = proto.InsertTextFormat.Snippet;
|
|
545
|
-
text = source.insertText.value;
|
|
546
|
-
} else {
|
|
547
|
-
text = source.insertText;
|
|
548
|
-
}
|
|
549
|
-
if (source.range) {
|
|
550
|
-
range = source.range;
|
|
551
|
-
}
|
|
552
|
-
target.insertTextFormat = format;
|
|
553
|
-
if (source.fromEdit && text !== undefined && range !== undefined) {
|
|
554
|
-
target.textEdit = asCompletionTextEdit(text, range);
|
|
555
|
-
} else {
|
|
556
|
-
target.insertText = text;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
function asCompletionTextEdit(newText, range) {
|
|
560
|
-
if (InsertReplaceRange.is(range)) {
|
|
561
|
-
return proto.InsertReplaceEdit.create(newText, asRange(range.inserting), asRange(range.replacing));
|
|
562
|
-
} else {
|
|
563
|
-
return {
|
|
564
|
-
newText,
|
|
565
|
-
range: asRange(range)
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
function asTextEdit(edit) {
|
|
570
|
-
return {
|
|
571
|
-
range: asRange(edit.range),
|
|
572
|
-
newText: edit.newText
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
function asTextEdits(edits) {
|
|
576
|
-
if (edits === undefined || edits === null) {
|
|
577
|
-
return edits;
|
|
578
|
-
}
|
|
579
|
-
return edits.map(asTextEdit);
|
|
580
|
-
}
|
|
581
|
-
function asSymbolKind(item) {
|
|
582
|
-
if (item <= code.SymbolKind.TypeParameter) {
|
|
583
|
-
return item + 1;
|
|
584
|
-
}
|
|
585
|
-
return proto.SymbolKind.Property;
|
|
586
|
-
}
|
|
587
|
-
function asSymbolTag(item) {
|
|
588
|
-
return item;
|
|
589
|
-
}
|
|
590
|
-
function asSymbolTags(items) {
|
|
591
|
-
return items.map(asSymbolTag);
|
|
592
|
-
}
|
|
593
|
-
function asReferenceParams(textDocument, position, options) {
|
|
594
|
-
return {
|
|
595
|
-
textDocument: asTextDocumentIdentifier(textDocument),
|
|
596
|
-
position: asWorkerPosition(position),
|
|
597
|
-
context: {
|
|
598
|
-
includeDeclaration: options.includeDeclaration
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
async function asCodeAction(item, token) {
|
|
603
|
-
let result = proto.CodeAction.create(item.title);
|
|
604
|
-
if (item instanceof protocolCodeAction_1.default && item.data !== undefined) {
|
|
605
|
-
result.data = item.data;
|
|
606
|
-
}
|
|
607
|
-
if (item.kind !== undefined) {
|
|
608
|
-
result.kind = asCodeActionKind(item.kind);
|
|
609
|
-
}
|
|
610
|
-
if (item.diagnostics !== undefined) {
|
|
611
|
-
result.diagnostics = await asDiagnostics(item.diagnostics, token);
|
|
612
|
-
}
|
|
613
|
-
if (item.edit !== undefined) {
|
|
614
|
-
throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");
|
|
615
|
-
}
|
|
616
|
-
if (item.command !== undefined) {
|
|
617
|
-
result.command = asCommand(item.command);
|
|
618
|
-
}
|
|
619
|
-
if (item.isPreferred !== undefined) {
|
|
620
|
-
result.isPreferred = item.isPreferred;
|
|
621
|
-
}
|
|
622
|
-
if (item.disabled !== undefined) {
|
|
623
|
-
result.disabled = {
|
|
624
|
-
reason: item.disabled.reason
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
return result;
|
|
628
|
-
}
|
|
629
|
-
async function asCodeActionContext(context, token) {
|
|
630
|
-
if (context === undefined || context === null) {
|
|
631
|
-
return context;
|
|
632
|
-
}
|
|
633
|
-
let only;
|
|
634
|
-
if (context.only && Is.string(context.only.value)) {
|
|
635
|
-
only = [context.only.value];
|
|
636
|
-
}
|
|
637
|
-
return proto.CodeActionContext.create(await asDiagnostics(context.diagnostics, token), only, asCodeActionTriggerKind(context.triggerKind));
|
|
638
|
-
}
|
|
639
|
-
function asCodeActionTriggerKind(kind) {
|
|
640
|
-
switch (kind) {
|
|
641
|
-
case code.CodeActionTriggerKind.Invoke:
|
|
642
|
-
return proto.CodeActionTriggerKind.Invoked;
|
|
643
|
-
case code.CodeActionTriggerKind.Automatic:
|
|
644
|
-
return proto.CodeActionTriggerKind.Automatic;
|
|
645
|
-
default:
|
|
646
|
-
return undefined;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
function asCodeActionKind(item) {
|
|
650
|
-
if (item === undefined || item === null) {
|
|
651
|
-
return undefined;
|
|
652
|
-
}
|
|
653
|
-
return item.value;
|
|
654
|
-
}
|
|
655
|
-
function asInlineValueContext(context) {
|
|
656
|
-
if (context === undefined || context === null) {
|
|
657
|
-
return context;
|
|
658
|
-
}
|
|
659
|
-
return proto.InlineValueContext.create(context.frameId, asRange(context.stoppedLocation));
|
|
660
|
-
}
|
|
661
|
-
function asCommand(item) {
|
|
662
|
-
let result = proto.Command.create(item.title, item.command);
|
|
663
|
-
if (item.arguments) {
|
|
664
|
-
result.arguments = item.arguments;
|
|
665
|
-
}
|
|
666
|
-
return result;
|
|
667
|
-
}
|
|
668
|
-
function asCodeLens(item) {
|
|
669
|
-
let result = proto.CodeLens.create(asRange(item.range));
|
|
670
|
-
if (item.command) {
|
|
671
|
-
result.command = asCommand(item.command);
|
|
672
|
-
}
|
|
673
|
-
if (item instanceof protocolCodeLens_1.default) {
|
|
674
|
-
if (item.data) {
|
|
675
|
-
result.data = item.data;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
return result;
|
|
679
|
-
}
|
|
680
|
-
function asFormattingOptions(options, fileOptions) {
|
|
681
|
-
const result = {
|
|
682
|
-
tabSize: options.tabSize,
|
|
683
|
-
insertSpaces: options.insertSpaces
|
|
684
|
-
};
|
|
685
|
-
if (fileOptions.trimTrailingWhitespace) {
|
|
686
|
-
result.trimTrailingWhitespace = true;
|
|
687
|
-
}
|
|
688
|
-
if (fileOptions.trimFinalNewlines) {
|
|
689
|
-
result.trimFinalNewlines = true;
|
|
690
|
-
}
|
|
691
|
-
if (fileOptions.insertFinalNewline) {
|
|
692
|
-
result.insertFinalNewline = true;
|
|
693
|
-
}
|
|
694
|
-
return result;
|
|
695
|
-
}
|
|
696
|
-
function asDocumentSymbolParams(textDocument) {
|
|
697
|
-
return {
|
|
698
|
-
textDocument: asTextDocumentIdentifier(textDocument)
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
function asCodeLensParams(textDocument) {
|
|
702
|
-
return {
|
|
703
|
-
textDocument: asTextDocumentIdentifier(textDocument)
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
function asDocumentLink(item) {
|
|
707
|
-
let result = proto.DocumentLink.create(asRange(item.range));
|
|
708
|
-
if (item.target) {
|
|
709
|
-
result.target = asUri(item.target);
|
|
710
|
-
}
|
|
711
|
-
if (item.tooltip !== undefined) {
|
|
712
|
-
result.tooltip = item.tooltip;
|
|
713
|
-
}
|
|
714
|
-
let protocolItem = item instanceof protocolDocumentLink_1.default ? item : undefined;
|
|
715
|
-
if (protocolItem && protocolItem.data) {
|
|
716
|
-
result.data = protocolItem.data;
|
|
717
|
-
}
|
|
718
|
-
return result;
|
|
719
|
-
}
|
|
720
|
-
function asDocumentLinkParams(textDocument) {
|
|
721
|
-
return {
|
|
722
|
-
textDocument: asTextDocumentIdentifier(textDocument)
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
function asCallHierarchyItem(value) {
|
|
726
|
-
const result = {
|
|
727
|
-
name: value.name,
|
|
728
|
-
kind: asSymbolKind(value.kind),
|
|
729
|
-
uri: asUri(value.uri),
|
|
730
|
-
range: asRange(value.range),
|
|
731
|
-
selectionRange: asRange(value.selectionRange)
|
|
732
|
-
};
|
|
733
|
-
if (value.detail !== undefined && value.detail.length > 0) {
|
|
734
|
-
result.detail = value.detail;
|
|
735
|
-
}
|
|
736
|
-
if (value.tags !== undefined) {
|
|
737
|
-
result.tags = asSymbolTags(value.tags);
|
|
738
|
-
}
|
|
739
|
-
if (value instanceof protocolCallHierarchyItem_1.default && value.data !== undefined) {
|
|
740
|
-
result.data = value.data;
|
|
741
|
-
}
|
|
742
|
-
return result;
|
|
743
|
-
}
|
|
744
|
-
function asTypeHierarchyItem(value) {
|
|
745
|
-
const result = {
|
|
746
|
-
name: value.name,
|
|
747
|
-
kind: asSymbolKind(value.kind),
|
|
748
|
-
uri: asUri(value.uri),
|
|
749
|
-
range: asRange(value.range),
|
|
750
|
-
selectionRange: asRange(value.selectionRange)
|
|
751
|
-
};
|
|
752
|
-
if (value.detail !== undefined && value.detail.length > 0) {
|
|
753
|
-
result.detail = value.detail;
|
|
754
|
-
}
|
|
755
|
-
if (value.tags !== undefined) {
|
|
756
|
-
result.tags = asSymbolTags(value.tags);
|
|
757
|
-
}
|
|
758
|
-
if (value instanceof protocolTypeHierarchyItem_1.default && value.data !== undefined) {
|
|
759
|
-
result.data = value.data;
|
|
760
|
-
}
|
|
761
|
-
return result;
|
|
762
|
-
}
|
|
763
|
-
function asWorkspaceSymbol(item) {
|
|
764
|
-
const result = item instanceof protocolWorkspaceSymbol_1.default ? {
|
|
765
|
-
name: item.name,
|
|
766
|
-
kind: asSymbolKind(item.kind),
|
|
767
|
-
location: item.hasRange ? asLocation(item.location) : {
|
|
768
|
-
uri: _uriConverter(item.location.uri)
|
|
769
|
-
},
|
|
770
|
-
data: item.data
|
|
771
|
-
} : {
|
|
772
|
-
name: item.name,
|
|
773
|
-
kind: asSymbolKind(item.kind),
|
|
774
|
-
location: asLocation(item.location)
|
|
775
|
-
};
|
|
776
|
-
if (item.tags !== undefined) {
|
|
777
|
-
result.tags = asSymbolTags(item.tags);
|
|
778
|
-
}
|
|
779
|
-
if (item.containerName !== '') {
|
|
780
|
-
result.containerName = item.containerName;
|
|
781
|
-
}
|
|
782
|
-
return result;
|
|
783
|
-
}
|
|
784
|
-
function asInlayHint(item) {
|
|
785
|
-
const label = typeof item.label === 'string' ? item.label : item.label.map(asInlayHintLabelPart);
|
|
786
|
-
const result = proto.InlayHint.create(asPosition(item.position), label);
|
|
787
|
-
if (item.kind !== undefined) {
|
|
788
|
-
result.kind = item.kind;
|
|
789
|
-
}
|
|
790
|
-
if (item.textEdits !== undefined) {
|
|
791
|
-
result.textEdits = asTextEdits(item.textEdits);
|
|
792
|
-
}
|
|
793
|
-
if (item.tooltip !== undefined) {
|
|
794
|
-
result.tooltip = asTooltip(item.tooltip);
|
|
795
|
-
}
|
|
796
|
-
if (item.paddingLeft !== undefined) {
|
|
797
|
-
result.paddingLeft = item.paddingLeft;
|
|
798
|
-
}
|
|
799
|
-
if (item.paddingRight !== undefined) {
|
|
800
|
-
result.paddingRight = item.paddingRight;
|
|
801
|
-
}
|
|
802
|
-
if (item instanceof protocolInlayHint_1.default && item.data !== undefined) {
|
|
803
|
-
result.data = item.data;
|
|
804
|
-
}
|
|
805
|
-
return result;
|
|
806
|
-
}
|
|
807
|
-
function asInlayHintLabelPart(item) {
|
|
808
|
-
const result = proto.InlayHintLabelPart.create(item.value);
|
|
809
|
-
if (item.location !== undefined) {
|
|
810
|
-
result.location = asLocation(item.location);
|
|
811
|
-
}
|
|
812
|
-
if (item.command !== undefined) {
|
|
813
|
-
result.command = asCommand(item.command);
|
|
814
|
-
}
|
|
815
|
-
if (item.tooltip !== undefined) {
|
|
816
|
-
result.tooltip = asTooltip(item.tooltip);
|
|
817
|
-
}
|
|
818
|
-
return result;
|
|
819
|
-
}
|
|
820
|
-
function asTooltip(value) {
|
|
821
|
-
if (typeof value === 'string') {
|
|
822
|
-
return value;
|
|
823
|
-
}
|
|
824
|
-
const result = {
|
|
825
|
-
kind: proto.MarkupKind.Markdown,
|
|
826
|
-
value: value.value
|
|
827
|
-
};
|
|
828
|
-
return result;
|
|
829
|
-
}
|
|
830
|
-
return {
|
|
831
|
-
asUri,
|
|
832
|
-
asTextDocumentIdentifier,
|
|
833
|
-
asTextDocumentItem,
|
|
834
|
-
asVersionedTextDocumentIdentifier,
|
|
835
|
-
asOpenTextDocumentParams,
|
|
836
|
-
asChangeTextDocumentParams,
|
|
837
|
-
asCloseTextDocumentParams,
|
|
838
|
-
asSaveTextDocumentParams,
|
|
839
|
-
asWillSaveTextDocumentParams,
|
|
840
|
-
asDidCreateFilesParams,
|
|
841
|
-
asDidRenameFilesParams,
|
|
842
|
-
asDidDeleteFilesParams,
|
|
843
|
-
asWillCreateFilesParams,
|
|
844
|
-
asWillRenameFilesParams,
|
|
845
|
-
asWillDeleteFilesParams,
|
|
846
|
-
asTextDocumentPositionParams,
|
|
847
|
-
asCompletionParams,
|
|
848
|
-
asSignatureHelpParams,
|
|
849
|
-
asWorkerPosition,
|
|
850
|
-
asRange,
|
|
851
|
-
asPosition,
|
|
852
|
-
asPositions,
|
|
853
|
-
asLocation,
|
|
854
|
-
asDiagnosticSeverity,
|
|
855
|
-
asDiagnosticTag,
|
|
856
|
-
asDiagnostic,
|
|
857
|
-
asDiagnostics,
|
|
858
|
-
asCompletionItem,
|
|
859
|
-
asTextEdit,
|
|
860
|
-
asSymbolKind,
|
|
861
|
-
asSymbolTag,
|
|
862
|
-
asSymbolTags,
|
|
863
|
-
asReferenceParams,
|
|
864
|
-
asCodeAction,
|
|
865
|
-
asCodeActionContext,
|
|
866
|
-
asInlineValueContext,
|
|
867
|
-
asCommand,
|
|
868
|
-
asCodeLens,
|
|
869
|
-
asFormattingOptions,
|
|
870
|
-
asDocumentSymbolParams,
|
|
871
|
-
asCodeLensParams,
|
|
872
|
-
asDocumentLink,
|
|
873
|
-
asDocumentLinkParams,
|
|
874
|
-
asCallHierarchyItem,
|
|
875
|
-
asTypeHierarchyItem,
|
|
876
|
-
asInlayHint,
|
|
877
|
-
asWorkspaceSymbol
|
|
878
|
-
};
|
|
879
|
-
}
|
|
880
|
-
codeConverter.createConverter = createConverter;
|
|
881
|
-
export { codeConverter as default };
|