@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,26 @@
|
|
|
1
|
+
import { Emitter as EventEmitter } from '@difizen/mana-common';
|
|
2
|
+
import type { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, CodeLensOptions, CodeLensRegistrationOptions } from '@difizen/vscode-languageserver-protocol';
|
|
3
|
+
import type { Disposable, TextDocument, ProviderResult, CodeLensProvider, CodeLens as VCodeLens } from 'vscode';
|
|
4
|
+
import type { FeatureClient } from './features.js';
|
|
5
|
+
import { TextDocumentLanguageFeature } from './features.js';
|
|
6
|
+
export interface ProvideCodeLensesSignature {
|
|
7
|
+
(this: void, document: TextDocument, token: CancellationToken): ProviderResult<VCodeLens[]>;
|
|
8
|
+
}
|
|
9
|
+
export interface ResolveCodeLensSignature {
|
|
10
|
+
(this: void, codeLens: VCodeLens, token: CancellationToken): ProviderResult<VCodeLens>;
|
|
11
|
+
}
|
|
12
|
+
export interface CodeLensMiddleware {
|
|
13
|
+
provideCodeLenses?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideCodeLensesSignature) => ProviderResult<VCodeLens[]>;
|
|
14
|
+
resolveCodeLens?: (this: void, codeLens: VCodeLens, token: CancellationToken, next: ResolveCodeLensSignature) => ProviderResult<VCodeLens>;
|
|
15
|
+
}
|
|
16
|
+
export type CodeLensProviderShape = {
|
|
17
|
+
provider?: CodeLensProvider;
|
|
18
|
+
onDidChangeCodeLensEmitter: EventEmitter<void>;
|
|
19
|
+
};
|
|
20
|
+
export declare class CodeLensFeature extends TextDocumentLanguageFeature<CodeLensOptions, CodeLensRegistrationOptions, CodeLensProviderShape, CodeLensMiddleware> {
|
|
21
|
+
constructor(client: FeatureClient<CodeLensMiddleware>);
|
|
22
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
23
|
+
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
|
24
|
+
protected registerLanguageProvider(options: CodeLensRegistrationOptions): [Disposable, CodeLensProviderShape];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=codeLens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeLens.d.ts","sourceRoot":"","sources":["../../src/common/codeLens.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,2BAA2B,EAC5B,MAAM,yCAAyC,CAAC;AAMjD,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,QAAQ,IAAI,SAAS,EACtB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAU,MAAM,eAAe,CAAC;AAIpE,MAAM,WAAW,0BAA0B;IACzC,CACE,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,iBAAiB,GACvB,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,wBAAwB;IACvC,CACE,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,iBAAiB,GACvB,cAAc,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,CAAC,EAAE,CAClB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,0BAA0B,KAC7B,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,CAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,wBAAwB,KAC3B,cAAc,CAAC,SAAS,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0BAA0B,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC;AAEF,qBAAa,eAAgB,SAAQ,2BAA2B,CAC9D,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,CACnB;gBACa,MAAM,EAAE,aAAa,CAAC,kBAAkB,CAAC;IAI9C,sBAAsB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAM9D,UAAU,CACf,YAAY,EAAE,kBAAkB,EAChC,gBAAgB,EAAE,gBAAgB,GACjC,IAAI;IAiBP,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,2BAA2B,GACnC,CAAC,UAAU,EAAE,qBAAqB,CAAC;CAiFvC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
7
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
/* --------------------------------------------------------------------------------------------
|
|
21
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
22
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
23
|
+
* ------------------------------------------------------------------------------------------ */
|
|
24
|
+
|
|
25
|
+
import { Emitter as EventEmitter } from '@difizen/mana-common';
|
|
26
|
+
import { CodeLensRequest, CodeLensRefreshRequest, CodeLensResolveRequest } from '@difizen/vscode-languageserver-protocol';
|
|
27
|
+
import { TextDocumentLanguageFeature, ensure } from "./features.js";
|
|
28
|
+
import * as UUID from "./utils/uuid.js";
|
|
29
|
+
import { languages as Languages } from "./vscodeAdaptor/vscodeAdaptor.js";
|
|
30
|
+
export var CodeLensFeature = /*#__PURE__*/function (_TextDocumentLanguage) {
|
|
31
|
+
_inherits(CodeLensFeature, _TextDocumentLanguage);
|
|
32
|
+
var _super = _createSuper(CodeLensFeature);
|
|
33
|
+
function CodeLensFeature(client) {
|
|
34
|
+
_classCallCheck(this, CodeLensFeature);
|
|
35
|
+
return _super.call(this, client, CodeLensRequest.type);
|
|
36
|
+
}
|
|
37
|
+
_createClass(CodeLensFeature, [{
|
|
38
|
+
key: "fillClientCapabilities",
|
|
39
|
+
value: function fillClientCapabilities(capabilities) {
|
|
40
|
+
ensure(ensure(capabilities, 'textDocument'), 'codeLens').dynamicRegistration = true;
|
|
41
|
+
ensure(ensure(capabilities, 'workspace'), 'codeLens').refreshSupport = true;
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "initialize",
|
|
45
|
+
value: function initialize(capabilities, documentSelector) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
var client = this._client;
|
|
48
|
+
client.onRequest(CodeLensRefreshRequest.type, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
49
|
+
var _iterator, _step, provider;
|
|
50
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
51
|
+
while (1) switch (_context.prev = _context.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
_iterator = _createForOfIteratorHelper(_this.getAllProviders());
|
|
54
|
+
try {
|
|
55
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
56
|
+
provider = _step.value;
|
|
57
|
+
provider.onDidChangeCodeLensEmitter.fire();
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
_iterator.e(err);
|
|
61
|
+
} finally {
|
|
62
|
+
_iterator.f();
|
|
63
|
+
}
|
|
64
|
+
case 2:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context.stop();
|
|
67
|
+
}
|
|
68
|
+
}, _callee);
|
|
69
|
+
})));
|
|
70
|
+
var options = this.getRegistrationOptions(documentSelector, capabilities.codeLensProvider);
|
|
71
|
+
if (!options) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.register({
|
|
75
|
+
id: UUID.generateUuid(),
|
|
76
|
+
registerOptions: options
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "registerLanguageProvider",
|
|
81
|
+
value: function registerLanguageProvider(options) {
|
|
82
|
+
var _this2 = this;
|
|
83
|
+
var selector = options.documentSelector;
|
|
84
|
+
var eventEmitter = new EventEmitter();
|
|
85
|
+
var provider = {
|
|
86
|
+
onDidChangeCodeLenses: eventEmitter.event,
|
|
87
|
+
provideCodeLenses: function provideCodeLenses(document, token) {
|
|
88
|
+
var client = _this2._client;
|
|
89
|
+
var provideCodeLenses = function provideCodeLenses(document, token) {
|
|
90
|
+
return client.sendRequest(CodeLensRequest.type, client.code2ProtocolConverter.asCodeLensParams(document), token).then(function (result) {
|
|
91
|
+
if (token.isCancellationRequested) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return client.protocol2CodeConverter.asCodeLenses(result, token);
|
|
95
|
+
}, function (error) {
|
|
96
|
+
return client.handleFailedRequest(CodeLensRequest.type, token, error, null);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
var middleware = client.middleware;
|
|
100
|
+
return middleware.provideCodeLenses ? middleware.provideCodeLenses(document, token, provideCodeLenses) : provideCodeLenses(document, token);
|
|
101
|
+
},
|
|
102
|
+
resolveCodeLens: options.resolveProvider ? function (codeLens, token) {
|
|
103
|
+
var client = _this2._client;
|
|
104
|
+
var resolveCodeLens = function resolveCodeLens(codeLens, token) {
|
|
105
|
+
return client.sendRequest(CodeLensResolveRequest.type, client.code2ProtocolConverter.asCodeLens(codeLens), token).then(function (result) {
|
|
106
|
+
if (token.isCancellationRequested) {
|
|
107
|
+
return codeLens;
|
|
108
|
+
}
|
|
109
|
+
return client.protocol2CodeConverter.asCodeLens(result);
|
|
110
|
+
}, function (error) {
|
|
111
|
+
return client.handleFailedRequest(CodeLensResolveRequest.type, token, error, codeLens);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
var middleware = client.middleware;
|
|
115
|
+
return middleware.resolveCodeLens ? middleware.resolveCodeLens(codeLens, token, resolveCodeLens) : resolveCodeLens(codeLens, token);
|
|
116
|
+
} : undefined
|
|
117
|
+
};
|
|
118
|
+
return [Languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(selector), provider), {
|
|
119
|
+
provider: provider,
|
|
120
|
+
onDidChangeCodeLensEmitter: eventEmitter
|
|
121
|
+
}];
|
|
122
|
+
}
|
|
123
|
+
}]);
|
|
124
|
+
return CodeLensFeature;
|
|
125
|
+
}(TextDocumentLanguageFeature);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, DocumentColorRegistrationOptions, DocumentColorOptions } from '@difizen/vscode-languageserver-protocol';
|
|
2
|
+
import type { Disposable, TextDocument, ProviderResult, Range as VRange, Color as VColor, ColorPresentation as VColorPresentation, ColorInformation as VColorInformation, DocumentColorProvider } from 'vscode';
|
|
3
|
+
import type { FeatureClient } from './features.js';
|
|
4
|
+
import { TextDocumentLanguageFeature } from './features.js';
|
|
5
|
+
export interface ProvideDocumentColorsSignature {
|
|
6
|
+
(document: TextDocument, token: CancellationToken): ProviderResult<VColorInformation[]>;
|
|
7
|
+
}
|
|
8
|
+
export interface ProvideColorPresentationSignature {
|
|
9
|
+
(color: VColor, context: {
|
|
10
|
+
document: TextDocument;
|
|
11
|
+
range: VRange;
|
|
12
|
+
}, token: CancellationToken): ProviderResult<VColorPresentation[]>;
|
|
13
|
+
}
|
|
14
|
+
export interface ColorProviderMiddleware {
|
|
15
|
+
provideDocumentColors?: (this: void, document: TextDocument, token: CancellationToken, next: ProvideDocumentColorsSignature) => ProviderResult<VColorInformation[]>;
|
|
16
|
+
provideColorPresentations?: (this: void, color: VColor, context: {
|
|
17
|
+
document: TextDocument;
|
|
18
|
+
range: VRange;
|
|
19
|
+
}, token: CancellationToken, next: ProvideColorPresentationSignature) => ProviderResult<VColorPresentation[]>;
|
|
20
|
+
}
|
|
21
|
+
export declare class ColorProviderFeature extends TextDocumentLanguageFeature<boolean | DocumentColorOptions, DocumentColorRegistrationOptions, DocumentColorProvider, ColorProviderMiddleware> {
|
|
22
|
+
constructor(client: FeatureClient<ColorProviderMiddleware>);
|
|
23
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
24
|
+
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
|
25
|
+
protected registerLanguageProvider(options: DocumentColorRegistrationOptions): [Disposable, DocumentColorProvider];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=colorProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorProvider.d.ts","sourceRoot":"","sources":["../../src/common/colorProvider.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gCAAgC,EAChC,oBAAoB,EACrB,MAAM,yCAAyC,CAAC;AAKjD,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,KAAK,IAAI,MAAM,EACf,KAAK,IAAI,MAAM,EACf,iBAAiB,IAAI,kBAAkB,EACvC,gBAAgB,IAAI,iBAAiB,EACrC,qBAAqB,EACtB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAU,MAAM,eAAe,CAAC;AAGpE,MAAM,WAAW,8BAA8B;IAC7C,CACE,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,iBAAiB,GACvB,cAAc,CAAC,iBAAiB,EAAE,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,iCAAiC;IAChD,CACE,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAClD,KAAK,EAAE,iBAAiB,GACvB,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,uBAAuB;IACtC,qBAAqB,CAAC,EAAE,CACtB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,8BAA8B,KACjC,cAAc,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACzC,yBAAyB,CAAC,EAAE,CAC1B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAClD,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,iCAAiC,KACpC,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC;CAC3C;AAED,qBAAa,oBAAqB,SAAQ,2BAA2B,CACnE,OAAO,GAAG,oBAAoB,EAC9B,gCAAgC,EAChC,qBAAqB,EACrB,uBAAuB,CACxB;gBACa,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC;IAInD,sBAAsB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAO9D,UAAU,CACf,YAAY,EAAE,kBAAkB,EAChC,gBAAgB,EAAE,gBAAgB,GACjC,IAAI;IAWP,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,gCAAgC,GACxC,CAAC,UAAU,EAAE,qBAAqB,CAAC;CA+FvC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
/* --------------------------------------------------------------------------------------------
|
|
21
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
22
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
23
|
+
* ------------------------------------------------------------------------------------------ */
|
|
24
|
+
|
|
25
|
+
import { DocumentColorRequest, ColorPresentationRequest } from '@difizen/vscode-languageserver-protocol';
|
|
26
|
+
import { TextDocumentLanguageFeature, ensure } from "./features.js";
|
|
27
|
+
import { languages as Languages } from "./vscodeAdaptor/vscodeAdaptor.js";
|
|
28
|
+
export var ColorProviderFeature = /*#__PURE__*/function (_TextDocumentLanguage) {
|
|
29
|
+
_inherits(ColorProviderFeature, _TextDocumentLanguage);
|
|
30
|
+
var _super = _createSuper(ColorProviderFeature);
|
|
31
|
+
function ColorProviderFeature(client) {
|
|
32
|
+
_classCallCheck(this, ColorProviderFeature);
|
|
33
|
+
return _super.call(this, client, DocumentColorRequest.type);
|
|
34
|
+
}
|
|
35
|
+
_createClass(ColorProviderFeature, [{
|
|
36
|
+
key: "fillClientCapabilities",
|
|
37
|
+
value: function fillClientCapabilities(capabilities) {
|
|
38
|
+
ensure(ensure(capabilities, 'textDocument'), 'colorProvider').dynamicRegistration = true;
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "initialize",
|
|
42
|
+
value: function initialize(capabilities, documentSelector) {
|
|
43
|
+
var _this$getRegistration = this.getRegistration(documentSelector, capabilities.colorProvider),
|
|
44
|
+
_this$getRegistration2 = _slicedToArray(_this$getRegistration, 2),
|
|
45
|
+
id = _this$getRegistration2[0],
|
|
46
|
+
options = _this$getRegistration2[1];
|
|
47
|
+
if (!id || !options) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.register({
|
|
51
|
+
id: id,
|
|
52
|
+
registerOptions: options
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
key: "registerLanguageProvider",
|
|
57
|
+
value: function registerLanguageProvider(options) {
|
|
58
|
+
var _this = this;
|
|
59
|
+
var selector = options.documentSelector;
|
|
60
|
+
var provider = {
|
|
61
|
+
provideColorPresentations: function provideColorPresentations(color, context, token) {
|
|
62
|
+
var client = _this._client;
|
|
63
|
+
var provideColorPresentations = function provideColorPresentations(color, context, token) {
|
|
64
|
+
var requestParams = {
|
|
65
|
+
color: color,
|
|
66
|
+
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(context.document),
|
|
67
|
+
range: client.code2ProtocolConverter.asRange(context.range)
|
|
68
|
+
};
|
|
69
|
+
return client.sendRequest(ColorPresentationRequest.type, requestParams, token).then(function (result) {
|
|
70
|
+
if (token.isCancellationRequested) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return _this._client.protocol2CodeConverter.asColorPresentations(result, token);
|
|
74
|
+
}, function (error) {
|
|
75
|
+
return client.handleFailedRequest(ColorPresentationRequest.type, token, error, null);
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
var middleware = client.middleware;
|
|
79
|
+
return middleware.provideColorPresentations ? middleware.provideColorPresentations(color, context, token, provideColorPresentations) : provideColorPresentations(color, context, token);
|
|
80
|
+
},
|
|
81
|
+
provideDocumentColors: function provideDocumentColors(document, token) {
|
|
82
|
+
var client = _this._client;
|
|
83
|
+
var provideDocumentColors = function provideDocumentColors(document, token) {
|
|
84
|
+
var requestParams = {
|
|
85
|
+
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document)
|
|
86
|
+
};
|
|
87
|
+
return client.sendRequest(DocumentColorRequest.type, requestParams, token).then(function (result) {
|
|
88
|
+
if (token.isCancellationRequested) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return _this._client.protocol2CodeConverter.asColorInformations(result, token);
|
|
92
|
+
}, function (error) {
|
|
93
|
+
return client.handleFailedRequest(DocumentColorRequest.type, token, error, null);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
var middleware = client.middleware;
|
|
97
|
+
return middleware.provideDocumentColors ? middleware.provideDocumentColors(document, token, provideDocumentColors) : provideDocumentColors(document, token);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return [Languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(selector), provider), provider];
|
|
101
|
+
}
|
|
102
|
+
}]);
|
|
103
|
+
return ColorProviderFeature;
|
|
104
|
+
}(TextDocumentLanguageFeature);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ClientCapabilities, CompletionOptions, CompletionRegistrationOptions, DocumentSelector, ServerCapabilities } from '@difizen/vscode-languageserver-protocol';
|
|
2
|
+
import type { TextDocument, Disposable, Position as VPosition, CompletionContext as VCompletionContext, CancellationToken, ProviderResult, CompletionItem as VCompletionItem, CompletionList as VCompletionList, CompletionItemProvider } from 'vscode';
|
|
3
|
+
import type { FeatureClient } from './features.js';
|
|
4
|
+
import { TextDocumentLanguageFeature } from './features.js';
|
|
5
|
+
export interface ProvideCompletionItemsSignature {
|
|
6
|
+
(this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken): ProviderResult<VCompletionItem[] | VCompletionList>;
|
|
7
|
+
}
|
|
8
|
+
export interface ResolveCompletionItemSignature {
|
|
9
|
+
(this: void, item: VCompletionItem, token: CancellationToken): ProviderResult<VCompletionItem>;
|
|
10
|
+
}
|
|
11
|
+
export interface CompletionMiddleware {
|
|
12
|
+
provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
|
|
13
|
+
resolveCompletionItem?: (this: void, item: VCompletionItem, token: CancellationToken, next: ResolveCompletionItemSignature) => ProviderResult<VCompletionItem>;
|
|
14
|
+
}
|
|
15
|
+
export declare class CompletionItemFeature extends TextDocumentLanguageFeature<CompletionOptions, CompletionRegistrationOptions, CompletionItemProvider, CompletionMiddleware> {
|
|
16
|
+
private labelDetailsSupport;
|
|
17
|
+
constructor(client: FeatureClient<CompletionMiddleware>);
|
|
18
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
19
|
+
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void;
|
|
20
|
+
protected registerLanguageProvider(options: CompletionRegistrationOptions, id: string): [Disposable, CompletionItemProvider];
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/common/completion.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,6BAA6B,EAC7B,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AASjD,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,QAAQ,IAAI,SAAS,EACrB,iBAAiB,IAAI,kBAAkB,EACvC,iBAAiB,EACjB,cAAc,EACd,cAAc,IAAI,eAAe,EACjC,cAAc,IAAI,eAAe,EACjC,sBAAsB,EACvB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAU,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAgCpE,MAAM,WAAW,+BAA+B;IAC9C,CACE,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,kBAAkB,EAC3B,KAAK,EAAE,iBAAiB,GACvB,cAAc,CAAC,eAAe,EAAE,GAAG,eAAe,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,8BAA8B;IAC7C,CACE,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,iBAAiB,GACvB,cAAc,CAAC,eAAe,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,qBAAqB,CAAC,EAAE,CACtB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,kBAAkB,EAC3B,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,+BAA+B,KAClC,cAAc,CAAC,eAAe,EAAE,GAAG,eAAe,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,CACtB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,8BAA8B,KACjC,cAAc,CAAC,eAAe,CAAC,CAAC;CACtC;AAED,qBAAa,qBAAsB,SAAQ,2BAA2B,CACpE,iBAAiB,EACjB,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,CACrB;IACC,OAAO,CAAC,mBAAmB,CAAuB;gBAEtC,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC;IAKhD,sBAAsB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAiC9D,UAAU,CACf,YAAY,EAAE,kBAAkB,EAChC,gBAAgB,EAAE,gBAAgB,GACjC,IAAI;IAeP,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,6BAA6B,EACtC,EAAE,EAAE,MAAM,GACT,CAAC,UAAU,EAAE,sBAAsB,CAAC;CAiHxC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
/* --------------------------------------------------------------------------------------------
|
|
21
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
22
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
23
|
+
* ------------------------------------------------------------------------------------------ */
|
|
24
|
+
|
|
25
|
+
import { CompletionItemKind, CompletionItemTag, CompletionRequest, CompletionResolveRequest, InsertTextMode, MarkupKind } from '@difizen/vscode-languageserver-protocol';
|
|
26
|
+
import { ensure, TextDocumentLanguageFeature } from "./features.js";
|
|
27
|
+
import * as UUID from "./utils/uuid.js";
|
|
28
|
+
import { languages as Languages } from "./vscodeAdaptor/vscodeAdaptor.js";
|
|
29
|
+
var SupportedCompletionItemKinds = [CompletionItemKind.Text, CompletionItemKind.Method, CompletionItemKind.Function, CompletionItemKind.Constructor, CompletionItemKind.Field, CompletionItemKind.Variable, CompletionItemKind.Class, CompletionItemKind.Interface, CompletionItemKind.Module, CompletionItemKind.Property, CompletionItemKind.Unit, CompletionItemKind.Value, CompletionItemKind.Enum, CompletionItemKind.Keyword, CompletionItemKind.Snippet, CompletionItemKind.Color, CompletionItemKind.File, CompletionItemKind.Reference, CompletionItemKind.Folder, CompletionItemKind.EnumMember, CompletionItemKind.Constant, CompletionItemKind.Struct, CompletionItemKind.Event, CompletionItemKind.Operator, CompletionItemKind.TypeParameter];
|
|
30
|
+
export var CompletionItemFeature = /*#__PURE__*/function (_TextDocumentLanguage) {
|
|
31
|
+
_inherits(CompletionItemFeature, _TextDocumentLanguage);
|
|
32
|
+
var _super = _createSuper(CompletionItemFeature);
|
|
33
|
+
function CompletionItemFeature(client) {
|
|
34
|
+
var _this;
|
|
35
|
+
_classCallCheck(this, CompletionItemFeature);
|
|
36
|
+
_this = _super.call(this, client, CompletionRequest.type);
|
|
37
|
+
_this.labelDetailsSupport = new Map();
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
_createClass(CompletionItemFeature, [{
|
|
41
|
+
key: "fillClientCapabilities",
|
|
42
|
+
value: function fillClientCapabilities(capabilities) {
|
|
43
|
+
var completion = ensure(ensure(capabilities, 'textDocument'), 'completion');
|
|
44
|
+
completion.dynamicRegistration = true;
|
|
45
|
+
completion.contextSupport = true;
|
|
46
|
+
completion.completionItem = {
|
|
47
|
+
snippetSupport: true,
|
|
48
|
+
commitCharactersSupport: true,
|
|
49
|
+
documentationFormat: [MarkupKind.Markdown, MarkupKind.PlainText],
|
|
50
|
+
deprecatedSupport: true,
|
|
51
|
+
preselectSupport: true,
|
|
52
|
+
tagSupport: {
|
|
53
|
+
valueSet: [CompletionItemTag.Deprecated]
|
|
54
|
+
},
|
|
55
|
+
insertReplaceSupport: true,
|
|
56
|
+
resolveSupport: {
|
|
57
|
+
properties: ['documentation', 'detail', 'additionalTextEdits']
|
|
58
|
+
},
|
|
59
|
+
insertTextModeSupport: {
|
|
60
|
+
valueSet: [InsertTextMode.asIs, InsertTextMode.adjustIndentation]
|
|
61
|
+
},
|
|
62
|
+
labelDetailsSupport: true
|
|
63
|
+
};
|
|
64
|
+
completion.insertTextMode = InsertTextMode.adjustIndentation;
|
|
65
|
+
completion.completionItemKind = {
|
|
66
|
+
valueSet: SupportedCompletionItemKinds
|
|
67
|
+
};
|
|
68
|
+
completion.completionList = {
|
|
69
|
+
itemDefaults: ['commitCharacters', 'editRange', 'insertTextFormat', 'insertTextMode', 'data']
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "initialize",
|
|
74
|
+
value: function initialize(capabilities, documentSelector) {
|
|
75
|
+
var options = this.getRegistrationOptions(documentSelector, capabilities.completionProvider);
|
|
76
|
+
if (!options) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.register({
|
|
80
|
+
id: UUID.generateUuid(),
|
|
81
|
+
registerOptions: options
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "registerLanguageProvider",
|
|
86
|
+
value: function registerLanguageProvider(options, id) {
|
|
87
|
+
var _options$completionIt,
|
|
88
|
+
_options$triggerChara,
|
|
89
|
+
_this2 = this;
|
|
90
|
+
this.labelDetailsSupport.set(id, !!((_options$completionIt = options.completionItem) !== null && _options$completionIt !== void 0 && _options$completionIt.labelDetailsSupport));
|
|
91
|
+
var triggerCharacters = (_options$triggerChara = options.triggerCharacters) !== null && _options$triggerChara !== void 0 ? _options$triggerChara : [];
|
|
92
|
+
var defaultCommitCharacters = options.allCommitCharacters;
|
|
93
|
+
var selector = options.documentSelector;
|
|
94
|
+
var provider = {
|
|
95
|
+
provideCompletionItems: function provideCompletionItems(document, position, token, context) {
|
|
96
|
+
var client = _this2._client;
|
|
97
|
+
var middleware = _this2._client.middleware;
|
|
98
|
+
var provideCompletionItems = function provideCompletionItems(document, position, context, token) {
|
|
99
|
+
return client.sendRequest(CompletionRequest.type, client.code2ProtocolConverter.asCompletionParams(document, position, context), token).then(function (result) {
|
|
100
|
+
if (token.isCancellationRequested) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return client.protocol2CodeConverter.asCompletionResult(result, defaultCommitCharacters, token);
|
|
104
|
+
}, function (error) {
|
|
105
|
+
return client.handleFailedRequest(CompletionRequest.type, token, error, null);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return middleware.provideCompletionItem ? middleware.provideCompletionItem(document, position, context, token, provideCompletionItems) : provideCompletionItems(document, position, context, token);
|
|
109
|
+
},
|
|
110
|
+
resolveCompletionItem: options.resolveProvider ? function (item, token) {
|
|
111
|
+
var client = _this2._client;
|
|
112
|
+
var middleware = _this2._client.middleware;
|
|
113
|
+
var resolveCompletionItem = function resolveCompletionItem(item, token) {
|
|
114
|
+
return client.sendRequest(CompletionResolveRequest.type, client.code2ProtocolConverter.asCompletionItem(item, !!_this2.labelDetailsSupport.get(id)), token).then(function (result) {
|
|
115
|
+
if (token.isCancellationRequested) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return client.protocol2CodeConverter.asCompletionItem(result);
|
|
119
|
+
}, function (error) {
|
|
120
|
+
return client.handleFailedRequest(CompletionResolveRequest.type, token, error, item);
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
return middleware.resolveCompletionItem ? middleware.resolveCompletionItem(item, token, resolveCompletionItem) : resolveCompletionItem(item, token);
|
|
124
|
+
} : undefined
|
|
125
|
+
};
|
|
126
|
+
return [Languages.registerCompletionItemProvider.apply(Languages, [this._client.protocol2CodeConverter.asDocumentSelector(selector), provider].concat(_toConsumableArray(triggerCharacters))), provider];
|
|
127
|
+
}
|
|
128
|
+
}]);
|
|
129
|
+
return CompletionItemFeature;
|
|
130
|
+
}(TextDocumentLanguageFeature);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ClientCapabilities, DidChangeConfigurationRegistrationOptions, RegistrationType } from '@difizen/vscode-languageserver-protocol';
|
|
2
|
+
import { ConfigurationRequest } from '@difizen/vscode-languageserver-protocol';
|
|
3
|
+
import type { FileSystemWatcher as VFileSystemWatcher, WorkspaceFolder as VWorkspaceFolder } from 'vscode';
|
|
4
|
+
import type { StaticFeature, FeatureClient, FeatureState, DynamicFeature, RegistrationData } from './features.js';
|
|
5
|
+
export interface ConfigurationMiddleware {
|
|
6
|
+
configuration?: ConfigurationRequest.MiddlewareSignature;
|
|
7
|
+
}
|
|
8
|
+
interface ConfigurationWorkspaceMiddleware {
|
|
9
|
+
workspace?: ConfigurationMiddleware;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Configuration pull model. From server to client.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ConfigurationFeature implements StaticFeature {
|
|
15
|
+
private readonly _client;
|
|
16
|
+
constructor(client: FeatureClient<ConfigurationWorkspaceMiddleware>);
|
|
17
|
+
getState(): FeatureState;
|
|
18
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
19
|
+
initialize(): void;
|
|
20
|
+
private getConfiguration;
|
|
21
|
+
clear(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function toJSONObject(obj: any): any;
|
|
24
|
+
export interface DidChangeConfigurationSignature {
|
|
25
|
+
(this: void, sections: string[] | undefined): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export interface DidChangeConfigurationMiddleware {
|
|
28
|
+
didChangeConfiguration?: (this: void, sections: string[] | undefined, next: DidChangeConfigurationSignature) => Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
interface DidChangeConfigurationWorkspaceMiddleware {
|
|
31
|
+
workspace?: DidChangeConfigurationMiddleware;
|
|
32
|
+
}
|
|
33
|
+
export type SynchronizeOptions = {
|
|
34
|
+
/**
|
|
35
|
+
* The configuration sections to synchronize. Pushing settings from the
|
|
36
|
+
* client to the server is deprecated in favour of the new pull model
|
|
37
|
+
* that allows servers to query settings scoped on resources. In this
|
|
38
|
+
* model the client can only deliver an empty change event since the
|
|
39
|
+
* actually setting value can vary on the provided resource scope.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated Use the new pull model (`workspace/configuration` request)
|
|
42
|
+
*/
|
|
43
|
+
configurationSection?: string | string[];
|
|
44
|
+
/**
|
|
45
|
+
* Asks the client to send file change events to the server. Watchers
|
|
46
|
+
* operate on workspace folders. The LSP client doesn't support watching
|
|
47
|
+
* files outside a workspace folder.
|
|
48
|
+
*/
|
|
49
|
+
fileEvents?: VFileSystemWatcher | VFileSystemWatcher[];
|
|
50
|
+
};
|
|
51
|
+
export type $ConfigurationOptions = {
|
|
52
|
+
synchronize?: SynchronizeOptions;
|
|
53
|
+
workspaceFolder?: VWorkspaceFolder;
|
|
54
|
+
};
|
|
55
|
+
export declare class SyncConfigurationFeature implements DynamicFeature<DidChangeConfigurationRegistrationOptions> {
|
|
56
|
+
private _client;
|
|
57
|
+
private isCleared;
|
|
58
|
+
private readonly _listeners;
|
|
59
|
+
constructor(_client: FeatureClient<DidChangeConfigurationWorkspaceMiddleware, $ConfigurationOptions>);
|
|
60
|
+
getState(): FeatureState;
|
|
61
|
+
get registrationType(): RegistrationType<DidChangeConfigurationRegistrationOptions>;
|
|
62
|
+
fillClientCapabilities(capabilities: ClientCapabilities): void;
|
|
63
|
+
initialize(): void;
|
|
64
|
+
register(data: RegistrationData<DidChangeConfigurationRegistrationOptions>): void;
|
|
65
|
+
unregister(id: string): void;
|
|
66
|
+
clear(): void;
|
|
67
|
+
private onDidChangeConfiguration;
|
|
68
|
+
private extractSettingsInformation;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/common/configuration.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,yCAAyC,EACzC,gBAAgB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,oBAAoB,EAErB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAIV,iBAAiB,IAAI,kBAAkB,EACvC,eAAe,IAAI,gBAAgB,EACpC,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAMvB,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,oBAAoB,CAAC,mBAAmB,CAAC;CAC1D;AAED,UAAU,gCAAgC;IACxC,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkD;gBAE9D,MAAM,EAAE,aAAa,CAAC,gCAAgC,CAAC;IAInE,QAAQ,IAAI,YAAY;IAIjB,sBAAsB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAK9D,UAAU,IAAI,IAAI;IA0BzB,OAAO,CAAC,gBAAgB;IAgCjB,KAAK,IAAI,IAAI;CAGrB;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAe1C;AAED,MAAM,WAAW,+BAA+B;IAC9C,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,gCAAgC;IAC/C,sBAAsB,CAAC,EAAE,CACvB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,EAC9B,IAAI,EAAE,+BAA+B,KAClC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,UAAU,yCAAyC;IACjD,SAAS,CAAC,EAAE,gCAAgC,CAAC;CAC9C;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAEF,qBAAa,wBACX,YAAW,cAAc,CAAC,yCAAyC,CAAC;IAMlE,OAAO,CAAC,OAAO;IAJjB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0B;gBAG3C,OAAO,EAAE,aAAa,CAC5B,yCAAyC,EACzC,qBAAqB,CACtB;IAMI,QAAQ,IAAI,YAAY;IAQ/B,IAAW,gBAAgB,IAAI,gBAAgB,CAAC,yCAAyC,CAAC,CAEzF;IAEM,sBAAsB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAO9D,UAAU,IAAI,IAAI;IAalB,QAAQ,CACb,IAAI,EAAE,gBAAgB,CAAC,yCAAyC,CAAC,GAChE,IAAI;IAUA,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQ5B,KAAK,IAAI,IAAI;IAQpB,OAAO,CAAC,wBAAwB;IA4ChC,OAAO,CAAC,0BAA0B;CAmCnC"}
|