@difizen/libro-language-client 0.1.18
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 +0 -0
- package/es/common/api.d.ts +38 -0
- package/es/common/api.d.ts.map +1 -0
- package/es/common/api.js +9 -0
- package/es/common/callHierarchy.d.ts +39 -0
- package/es/common/callHierarchy.d.ts.map +1 -0
- package/es/common/callHierarchy.js +139 -0
- package/es/common/client.d.ts +482 -0
- package/es/common/client.d.ts.map +1 -0
- package/es/common/client.js +2731 -0
- package/es/common/codeAction.d.ts +22 -0
- package/es/common/codeAction.d.ts.map +1 -0
- package/es/common/codeAction.js +149 -0
- package/es/common/codeConverter.d.ts +81 -0
- package/es/common/codeConverter.d.ts.map +1 -0
- package/es/common/codeConverter.js +1040 -0
- package/es/common/codeLens.d.ts +26 -0
- package/es/common/codeLens.d.ts.map +1 -0
- package/es/common/codeLens.js +125 -0
- package/es/common/colorProvider.d.ts +27 -0
- package/es/common/colorProvider.d.ts.map +1 -0
- package/es/common/colorProvider.js +104 -0
- package/es/common/completion.d.ts +22 -0
- package/es/common/completion.d.ts.map +1 -0
- package/es/common/completion.js +130 -0
- package/es/common/configuration.d.ts +71 -0
- package/es/common/configuration.d.ts.map +1 -0
- package/es/common/configuration.js +292 -0
- package/es/common/declaration.d.ts +18 -0
- package/es/common/declaration.d.ts.map +1 -0
- package/es/common/declaration.js +88 -0
- package/es/common/definition.d.ts +18 -0
- package/es/common/definition.d.ts.map +1 -0
- package/es/common/definition.js +80 -0
- package/es/common/diagnostic.d.ts +125 -0
- package/es/common/diagnostic.d.ts.map +1 -0
- package/es/common/diagnostic.js +1442 -0
- package/es/common/documentHighlight.d.ts +17 -0
- package/es/common/documentHighlight.d.ts.map +1 -0
- package/es/common/documentHighlight.js +73 -0
- package/es/common/documentLink.d.ts +21 -0
- package/es/common/documentLink.d.ts.map +1 -0
- package/es/common/documentLink.js +90 -0
- package/es/common/documentSymbol.d.ts +20 -0
- package/es/common/documentSymbol.d.ts.map +1 -0
- package/es/common/documentSymbol.js +134 -0
- package/es/common/executeCommand.d.ts +22 -0
- package/es/common/executeCommand.d.ts.map +1 -0
- package/es/common/executeCommand.js +117 -0
- package/es/common/features.d.ts +421 -0
- package/es/common/features.d.ts.map +1 -0
- package/es/common/features.js +576 -0
- package/es/common/fileOperations.d.ts +118 -0
- package/es/common/fileOperations.d.ts.map +1 -0
- package/es/common/fileOperations.js +705 -0
- package/es/common/fileSystemWatcher.d.ts +19 -0
- package/es/common/fileSystemWatcher.d.ts.map +1 -0
- package/es/common/fileSystemWatcher.js +173 -0
- package/es/common/foldingRange.d.ts +22 -0
- package/es/common/foldingRange.d.ts.map +1 -0
- package/es/common/foldingRange.js +127 -0
- package/es/common/formatting.d.ts +41 -0
- package/es/common/formatting.d.ts.map +1 -0
- package/es/common/formatting.js +233 -0
- package/es/common/hover.d.ts +18 -0
- package/es/common/hover.d.ts.map +1 -0
- package/es/common/hover.js +80 -0
- package/es/common/implementation.d.ts +18 -0
- package/es/common/implementation.d.ts.map +1 -0
- package/es/common/implementation.js +88 -0
- package/es/common/inlayHint.d.ts +23 -0
- package/es/common/inlayHint.d.ts.map +1 -0
- package/es/common/inlayHint.js +187 -0
- package/es/common/inlineCompletion.d.ts +20 -0
- package/es/common/inlineCompletion.d.ts.map +1 -0
- package/es/common/inlineCompletion.js +74 -0
- package/es/common/inlineValue.d.ts +21 -0
- package/es/common/inlineValue.d.ts.map +1 -0
- package/es/common/inlineValue.js +124 -0
- package/es/common/linkedEditingRange.d.ts +23 -0
- package/es/common/linkedEditingRange.d.ts.map +1 -0
- package/es/common/linkedEditingRange.js +94 -0
- package/es/common/notebook.d.ts +97 -0
- package/es/common/notebook.d.ts.map +1 -0
- package/es/common/notebook.js +1444 -0
- package/es/common/progress.d.ts +12 -0
- package/es/common/progress.d.ts.map +1 -0
- package/es/common/progress.js +75 -0
- package/es/common/progressPart.d.ts +25 -0
- package/es/common/progressPart.d.ts.map +1 -0
- package/es/common/progressPart.js +147 -0
- package/es/common/protocolCallHierarchyItem.d.ts +9 -0
- package/es/common/protocolCallHierarchyItem.d.ts.map +1 -0
- package/es/common/protocolCallHierarchyItem.js +34 -0
- package/es/common/protocolCodeAction.d.ts +7 -0
- package/es/common/protocolCodeAction.d.ts.map +1 -0
- package/es/common/protocolCodeAction.js +32 -0
- package/es/common/protocolCodeLens.d.ts +7 -0
- package/es/common/protocolCodeLens.d.ts.map +1 -0
- package/es/common/protocolCodeLens.js +29 -0
- package/es/common/protocolCompletionItem.d.ts +13 -0
- package/es/common/protocolCompletionItem.d.ts.map +1 -0
- package/es/common/protocolCompletionItem.js +29 -0
- package/es/common/protocolConverter.d.ts +174 -0
- package/es/common/protocolConverter.d.ts.map +1 -0
- package/es/common/protocolConverter.js +1982 -0
- package/es/common/protocolDiagnostic.d.ts +20 -0
- package/es/common/protocolDiagnostic.d.ts.map +1 -0
- package/es/common/protocolDiagnostic.js +46 -0
- package/es/common/protocolDocumentLink.d.ts +8 -0
- package/es/common/protocolDocumentLink.d.ts.map +1 -0
- package/es/common/protocolDocumentLink.js +29 -0
- package/es/common/protocolInlayHint.d.ts +8 -0
- package/es/common/protocolInlayHint.d.ts.map +1 -0
- package/es/common/protocolInlayHint.js +29 -0
- package/es/common/protocolTypeHierarchyItem.d.ts +9 -0
- package/es/common/protocolTypeHierarchyItem.d.ts.map +1 -0
- package/es/common/protocolTypeHierarchyItem.js +34 -0
- package/es/common/protocolWorkspaceSymbol.d.ts +9 -0
- package/es/common/protocolWorkspaceSymbol.d.ts.map +1 -0
- package/es/common/protocolWorkspaceSymbol.js +36 -0
- package/es/common/reference.d.ts +22 -0
- package/es/common/reference.d.ts.map +1 -0
- package/es/common/reference.js +78 -0
- package/es/common/rename.d.ts +29 -0
- package/es/common/rename.d.ts.map +1 -0
- package/es/common/rename.js +132 -0
- package/es/common/selectionRange.d.ts +18 -0
- package/es/common/selectionRange.d.ts.map +1 -0
- package/es/common/selectionRange.js +108 -0
- package/es/common/semanticTokens.d.ts +36 -0
- package/es/common/semanticTokens.d.ts.map +1 -0
- package/es/common/semanticTokens.js +226 -0
- package/es/common/signatureHelp.d.ts +18 -0
- package/es/common/signatureHelp.d.ts.map +1 -0
- package/es/common/signatureHelp.js +103 -0
- package/es/common/textSynchronization.d.ts +104 -0
- package/es/common/textSynchronization.d.ts.map +1 -0
- package/es/common/textSynchronization.js +771 -0
- package/es/common/typeDefinition.d.ts +18 -0
- package/es/common/typeDefinition.d.ts.map +1 -0
- package/es/common/typeDefinition.js +89 -0
- package/es/common/typeHierarchy.d.ts +33 -0
- package/es/common/typeHierarchy.d.ts.map +1 -0
- package/es/common/typeHierarchy.js +138 -0
- package/es/common/utils/async.d.ts +42 -0
- package/es/common/utils/async.d.ts.map +1 -0
- package/es/common/utils/async.js +441 -0
- package/es/common/utils/is.d.ts +13 -0
- package/es/common/utils/is.d.ts.map +1 -0
- package/es/common/utils/is.js +52 -0
- package/es/common/utils/uuid.d.ts +23 -0
- package/es/common/utils/uuid.d.ts.map +1 -0
- package/es/common/utils/uuid.js +85 -0
- package/es/common/vscodeAdaptor/convertor.d.ts +7 -0
- package/es/common/vscodeAdaptor/convertor.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/convertor.js +66 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.d.ts +33 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/diagnosticCollection.js +310 -0
- package/es/common/vscodeAdaptor/extHostTypes.d.ts +1496 -0
- package/es/common/vscodeAdaptor/extHostTypes.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/extHostTypes.js +3825 -0
- package/es/common/vscodeAdaptor/fileWatcher.d.ts +19 -0
- package/es/common/vscodeAdaptor/fileWatcher.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/fileWatcher.js +45 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.d.ts +192 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/hostTypeUtil.js +566 -0
- package/es/common/vscodeAdaptor/libro-fs.d.ts +21 -0
- package/es/common/vscodeAdaptor/libro-fs.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libro-fs.js +64 -0
- package/es/common/vscodeAdaptor/libroWindow.d.ts +21 -0
- package/es/common/vscodeAdaptor/libroWindow.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libroWindow.js +75 -0
- package/es/common/vscodeAdaptor/libroWorkspace.d.ts +33 -0
- package/es/common/vscodeAdaptor/libroWorkspace.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/libroWorkspace.js +250 -0
- package/es/common/vscodeAdaptor/lspEnv.d.ts +8 -0
- package/es/common/vscodeAdaptor/lspEnv.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/lspEnv.js +31 -0
- package/es/common/vscodeAdaptor/monaco-converter.d.ts +229 -0
- package/es/common/vscodeAdaptor/monaco-converter.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/monaco-converter.js +1613 -0
- package/es/common/vscodeAdaptor/monacoLanguages.d.ts +48 -0
- package/es/common/vscodeAdaptor/monacoLanguages.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/monacoLanguages.js +484 -0
- package/es/common/vscodeAdaptor/services.d.ts +85 -0
- package/es/common/vscodeAdaptor/services.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/services.js +3 -0
- package/es/common/vscodeAdaptor/typings.d.ts +10 -0
- package/es/common/vscodeAdaptor/util.d.ts +3 -0
- package/es/common/vscodeAdaptor/util.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/util.js +6 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts +77 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.d.ts.map +1 -0
- package/es/common/vscodeAdaptor/vscodeAdaptor.js +124 -0
- package/es/common/workspaceFolder.d.ts +32 -0
- package/es/common/workspaceFolder.d.ts.map +1 -0
- package/es/common/workspaceFolder.js +204 -0
- package/es/common/workspaceSymbol.d.ts +21 -0
- package/es/common/workspaceSymbol.d.ts.map +1 -0
- package/es/common/workspaceSymbol.js +101 -0
- package/es/constants.d.ts +2 -0
- package/es/constants.d.ts.map +1 -0
- package/es/constants.js +1 -0
- package/es/index.d.ts +6 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +5 -0
- package/es/libro-language-client-contribution.d.ts +10 -0
- package/es/libro-language-client-contribution.d.ts.map +1 -0
- package/es/libro-language-client-contribution.js +143 -0
- package/es/libro-language-client-manager.d.ts +34 -0
- package/es/libro-language-client-manager.d.ts.map +1 -0
- package/es/libro-language-client-manager.js +277 -0
- package/es/libro-language-client.d.ts +27 -0
- package/es/libro-language-client.d.ts.map +1 -0
- package/es/libro-language-client.js +141 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +13 -0
- package/package.json +69 -0
- package/src/common/api.ts +155 -0
- package/src/common/callHierarchy.ts +269 -0
- package/src/common/client.ts +3192 -0
- package/src/common/codeAction.ts +237 -0
- package/src/common/codeConverter.ts +1409 -0
- package/src/common/codeLens.ts +188 -0
- package/src/common/colorProvider.ts +192 -0
- package/src/common/completion.ts +281 -0
- package/src/common/configuration.ts +338 -0
- package/src/common/declaration.ts +140 -0
- package/src/common/definition.ts +138 -0
- package/src/common/diagnostic.ts +1408 -0
- package/src/common/documentHighlight.ts +140 -0
- package/src/common/documentLink.ts +180 -0
- package/src/common/documentSymbol.ts +186 -0
- package/src/common/executeCommand.ts +129 -0
- package/src/common/features.ts +1157 -0
- package/src/common/fileOperations.ts +635 -0
- package/src/common/fileSystemWatcher.ts +184 -0
- package/src/common/foldingRange.ts +160 -0
- package/src/common/formatting.ts +465 -0
- package/src/common/hover.ts +133 -0
- package/src/common/implementation.ts +142 -0
- package/src/common/inlayHint.ts +201 -0
- package/src/common/inlineCompletion.ts +160 -0
- package/src/common/inlineValue.ts +158 -0
- package/src/common/linkedEditingRange.ts +141 -0
- package/src/common/notebook.ts +1443 -0
- package/src/common/progress.ts +61 -0
- package/src/common/progressPart.ts +151 -0
- package/src/common/protocolCallHierarchyItem.ts +29 -0
- package/src/common/protocolCodeAction.ts +17 -0
- package/src/common/protocolCodeLens.ts +15 -0
- package/src/common/protocolCompletionItem.ts +22 -0
- package/src/common/protocolConverter.ts +2627 -0
- package/src/common/protocolDiagnostic.ts +47 -0
- package/src/common/protocolDocumentLink.ts +17 -0
- package/src/common/protocolInlayHint.ts +21 -0
- package/src/common/protocolTypeHierarchyItem.ts +29 -0
- package/src/common/protocolWorkspaceSymbol.ts +39 -0
- package/src/common/reference.ts +144 -0
- package/src/common/rename.ts +230 -0
- package/src/common/selectionRange.ts +136 -0
- package/src/common/semanticTokens.ts +383 -0
- package/src/common/signatureHelp.ts +170 -0
- package/src/common/textSynchronization.ts +819 -0
- package/src/common/typeDefinition.ts +146 -0
- package/src/common/typeHierarchy.ts +248 -0
- package/src/common/utils/async.ts +354 -0
- package/src/common/utils/is.ts +63 -0
- package/src/common/utils/uuid.ts +136 -0
- package/src/common/vscodeAdaptor/convertor.ts +73 -0
- package/src/common/vscodeAdaptor/diagnosticCollection.ts +238 -0
- package/src/common/vscodeAdaptor/extHostTypes.ts +4498 -0
- package/src/common/vscodeAdaptor/fileWatcher.ts +36 -0
- package/src/common/vscodeAdaptor/hostTypeUtil.ts +539 -0
- package/src/common/vscodeAdaptor/libro-fs.ts +51 -0
- package/src/common/vscodeAdaptor/libroWindow.ts +85 -0
- package/src/common/vscodeAdaptor/libroWorkspace.ts +261 -0
- package/src/common/vscodeAdaptor/lspEnv.ts +16 -0
- package/src/common/vscodeAdaptor/monaco-converter.ts +1800 -0
- package/src/common/vscodeAdaptor/monacoLanguages.ts +511 -0
- package/src/common/vscodeAdaptor/services.ts +278 -0
- package/src/common/vscodeAdaptor/typings.d.ts +10 -0
- package/src/common/vscodeAdaptor/util.ts +7 -0
- package/src/common/vscodeAdaptor/vscodeAdaptor.ts +122 -0
- package/src/common/workspaceFolder.ts +236 -0
- package/src/common/workspaceSymbol.ts +166 -0
- package/src/constants.ts +1 -0
- package/src/index.spec.ts +7 -0
- package/src/index.ts +5 -0
- package/src/libro-language-client-contribution.ts +49 -0
- package/src/libro-language-client-manager.ts +131 -0
- package/src/libro-language-client.ts +100 -0
- package/src/module.ts +19 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ClientCapabilities,
|
|
8
|
+
WorkDoneProgressCreateParams,
|
|
9
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
10
|
+
import { WorkDoneProgressCreateRequest } from '@difizen/vscode-languageserver-protocol';
|
|
11
|
+
|
|
12
|
+
import type { FeatureClient, FeatureState, StaticFeature } from './features.js';
|
|
13
|
+
import { ProgressPart } from './progressPart.js';
|
|
14
|
+
|
|
15
|
+
function ensure<T, K extends keyof T>(target: T, key: K): T[K] {
|
|
16
|
+
if (target[key] === void 0) {
|
|
17
|
+
target[key] = Object.create(null) as any;
|
|
18
|
+
}
|
|
19
|
+
return target[key];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class ProgressFeature implements StaticFeature {
|
|
23
|
+
private readonly activeParts: Set<ProgressPart>;
|
|
24
|
+
|
|
25
|
+
constructor(private _client: FeatureClient<object>) {
|
|
26
|
+
this.activeParts = new Set();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getState(): FeatureState {
|
|
30
|
+
return {
|
|
31
|
+
kind: 'window',
|
|
32
|
+
id: WorkDoneProgressCreateRequest.method,
|
|
33
|
+
registrations: this.activeParts.size > 0,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
|
38
|
+
ensure(capabilities, 'window')!.workDoneProgress = true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public initialize(): void {
|
|
42
|
+
const client = this._client;
|
|
43
|
+
|
|
44
|
+
const deleteHandler = (part: ProgressPart) => {
|
|
45
|
+
this.activeParts.delete(part);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const createHandler = (params: WorkDoneProgressCreateParams) => {
|
|
49
|
+
this.activeParts.add(new ProgressPart(this._client, params.token, deleteHandler));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
client.onRequest(WorkDoneProgressCreateRequest.type, createHandler);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public clear(): void {
|
|
56
|
+
for (const part of this.activeParts) {
|
|
57
|
+
part.done();
|
|
58
|
+
}
|
|
59
|
+
this.activeParts.clear();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ProgressToken,
|
|
8
|
+
ProgressType,
|
|
9
|
+
NotificationHandler,
|
|
10
|
+
ProtocolNotificationType,
|
|
11
|
+
WorkDoneProgressBegin,
|
|
12
|
+
WorkDoneProgressReport,
|
|
13
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
14
|
+
import {
|
|
15
|
+
WorkDoneProgress,
|
|
16
|
+
WorkDoneProgressCancelNotification,
|
|
17
|
+
} from '@difizen/vscode-languageserver-protocol';
|
|
18
|
+
import type { Progress, CancellationToken, Disposable } from 'vscode';
|
|
19
|
+
|
|
20
|
+
import * as Is from './utils/is.js';
|
|
21
|
+
import { window as Window, ProgressLocation } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
22
|
+
|
|
23
|
+
export interface ProgressContext {
|
|
24
|
+
onProgress<P>(
|
|
25
|
+
type: ProgressType<P>,
|
|
26
|
+
token: string | number,
|
|
27
|
+
handler: NotificationHandler<P>,
|
|
28
|
+
): Disposable;
|
|
29
|
+
sendNotification<P, RO>(type: ProtocolNotificationType<P, RO>, params?: P): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class ProgressPart {
|
|
33
|
+
private _infinite: boolean;
|
|
34
|
+
private _reported: number;
|
|
35
|
+
|
|
36
|
+
// listener for LSP progress messages. Set in constructor.
|
|
37
|
+
private _lspProgressDisposable: Disposable | undefined;
|
|
38
|
+
|
|
39
|
+
// VS Code progress state. Set in Window.withProgress callback.
|
|
40
|
+
private _progress: Progress<{ message?: string; increment?: number }> | undefined;
|
|
41
|
+
private _cancellationToken: CancellationToken | undefined;
|
|
42
|
+
private _tokenDisposable: Disposable | undefined;
|
|
43
|
+
private _resolve: (() => void) | undefined;
|
|
44
|
+
private _reject: ((reason?: any) => void) | undefined;
|
|
45
|
+
|
|
46
|
+
public constructor(
|
|
47
|
+
private _client: ProgressContext,
|
|
48
|
+
private _token: ProgressToken,
|
|
49
|
+
done?: (part: ProgressPart) => void,
|
|
50
|
+
) {
|
|
51
|
+
this._reported = 0;
|
|
52
|
+
this._infinite = false;
|
|
53
|
+
this._lspProgressDisposable = this._client.onProgress(
|
|
54
|
+
WorkDoneProgress.type,
|
|
55
|
+
this._token,
|
|
56
|
+
(value) => {
|
|
57
|
+
switch (value.kind) {
|
|
58
|
+
case 'begin':
|
|
59
|
+
this.begin(value);
|
|
60
|
+
break;
|
|
61
|
+
case 'report':
|
|
62
|
+
this.report(value);
|
|
63
|
+
break;
|
|
64
|
+
case 'end':
|
|
65
|
+
this.done();
|
|
66
|
+
done && done(this);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private begin(params: WorkDoneProgressBegin): void {
|
|
74
|
+
this._infinite = params.percentage === undefined;
|
|
75
|
+
|
|
76
|
+
// the progress as already been marked as done / canceled. Ignore begin call
|
|
77
|
+
if (this._lspProgressDisposable === undefined) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Since we don't use commands this will be a silent window progress with a hidden notification.
|
|
81
|
+
void Window.withProgress<void>(
|
|
82
|
+
{
|
|
83
|
+
location: ProgressLocation.Window,
|
|
84
|
+
cancellable: params.cancellable,
|
|
85
|
+
title: params.title,
|
|
86
|
+
},
|
|
87
|
+
async (progress, cancellationToken) => {
|
|
88
|
+
// the progress as already been marked as done / canceled. Ignore begin call
|
|
89
|
+
if (this._lspProgressDisposable === undefined) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this._progress = progress;
|
|
93
|
+
this._cancellationToken = cancellationToken;
|
|
94
|
+
this._tokenDisposable = this._cancellationToken.onCancellationRequested(() => {
|
|
95
|
+
this._client.sendNotification(WorkDoneProgressCancelNotification.type, {
|
|
96
|
+
token: this._token,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
this.report(params);
|
|
100
|
+
return new Promise<void>((resolve, reject) => {
|
|
101
|
+
this._resolve = resolve;
|
|
102
|
+
this._reject = reject;
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private report(params: WorkDoneProgressReport | WorkDoneProgressBegin): void {
|
|
109
|
+
if (this._infinite && Is.string(params.message)) {
|
|
110
|
+
this._progress !== undefined &&
|
|
111
|
+
this._progress.report({ message: params.message });
|
|
112
|
+
} else if (Is.number(params.percentage)) {
|
|
113
|
+
const percentage = Math.max(0, Math.min(params.percentage, 100));
|
|
114
|
+
const delta = Math.max(0, percentage - this._reported);
|
|
115
|
+
this._reported += delta;
|
|
116
|
+
this._progress !== undefined &&
|
|
117
|
+
this._progress.report({ message: params.message, increment: delta });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public cancel(): void {
|
|
122
|
+
this.cleanup();
|
|
123
|
+
if (this._reject !== undefined) {
|
|
124
|
+
this._reject();
|
|
125
|
+
this._resolve = undefined;
|
|
126
|
+
this._reject = undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
public done(): void {
|
|
131
|
+
this.cleanup();
|
|
132
|
+
if (this._resolve !== undefined) {
|
|
133
|
+
this._resolve();
|
|
134
|
+
this._resolve = undefined;
|
|
135
|
+
this._reject = undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private cleanup(): void {
|
|
140
|
+
if (this._lspProgressDisposable !== undefined) {
|
|
141
|
+
this._lspProgressDisposable.dispose();
|
|
142
|
+
this._lspProgressDisposable = undefined;
|
|
143
|
+
}
|
|
144
|
+
if (this._tokenDisposable !== undefined) {
|
|
145
|
+
this._tokenDisposable.dispose();
|
|
146
|
+
this._tokenDisposable = undefined;
|
|
147
|
+
}
|
|
148
|
+
this._progress = undefined;
|
|
149
|
+
this._cancellationToken = undefined;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type { LSPAny } from '@difizen/vscode-languageserver-protocol';
|
|
7
|
+
import type { SymbolKind, Uri } from 'vscode';
|
|
8
|
+
|
|
9
|
+
import type { Range } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
10
|
+
import { CallHierarchyItem } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
11
|
+
|
|
12
|
+
export default class ProtocolCallHierarchyItem extends CallHierarchyItem {
|
|
13
|
+
public data?: LSPAny;
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
kind: SymbolKind,
|
|
17
|
+
name: string,
|
|
18
|
+
detail: string,
|
|
19
|
+
uri: Uri,
|
|
20
|
+
range: Range,
|
|
21
|
+
selectionRange: Range,
|
|
22
|
+
data?: LSPAny,
|
|
23
|
+
) {
|
|
24
|
+
super(kind, name, detail, uri, range, selectionRange);
|
|
25
|
+
if (data !== undefined) {
|
|
26
|
+
this.data = data;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type { LSPAny } from '@difizen/vscode-languageserver-protocol';
|
|
7
|
+
|
|
8
|
+
import { CodeAction } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
9
|
+
|
|
10
|
+
export default class ProtocolCodeAction extends CodeAction {
|
|
11
|
+
public readonly data: LSPAny | undefined;
|
|
12
|
+
|
|
13
|
+
constructor(title: string, data: LSPAny | undefined) {
|
|
14
|
+
super(title);
|
|
15
|
+
this.data = data;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type { Range } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
7
|
+
import { CodeLens } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
8
|
+
|
|
9
|
+
export default class ProtocolCodeLens extends CodeLens {
|
|
10
|
+
public data: any;
|
|
11
|
+
|
|
12
|
+
constructor(range: Range) {
|
|
13
|
+
super(range);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
import type * as proto from '@difizen/vscode-languageserver-protocol';
|
|
7
|
+
|
|
8
|
+
import type { CompletionItemLabel } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
9
|
+
import { CompletionItem } from './vscodeAdaptor/vscodeAdaptor.js';
|
|
10
|
+
|
|
11
|
+
export default class ProtocolCompletionItem extends CompletionItem {
|
|
12
|
+
public data: any;
|
|
13
|
+
public fromEdit: boolean | undefined;
|
|
14
|
+
public documentationFormat: string | undefined;
|
|
15
|
+
public originalItemKind: proto.CompletionItemKind | undefined;
|
|
16
|
+
public deprecated: boolean | undefined;
|
|
17
|
+
public insertTextMode: proto.InsertTextMode | undefined;
|
|
18
|
+
|
|
19
|
+
constructor(label: string | CompletionItemLabel) {
|
|
20
|
+
super(label);
|
|
21
|
+
}
|
|
22
|
+
}
|