ace-linters 1.3.0 → 1.3.2

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.
@@ -20431,6 +20431,15 @@ class MarkerGroup {
20431
20431
  return marker.range.contains(pos.row, pos.column);
20432
20432
  });
20433
20433
  }
20434
+ /**
20435
+ * Finds all markers that contain the given position.
20436
+ * @param {Position} pos - The position to search for.
20437
+ * @returns {Ace.MarkerGroupItem[]} - An array of all markers that contain the given position.
20438
+ */ getMarkersAtPosition(pos) {
20439
+ return this.markers.filter(function(marker) {
20440
+ return marker.range.contains(pos.row, pos.column);
20441
+ });
20442
+ }
20434
20443
  /**
20435
20444
  * Comparator for Array.sort function, which sorts marker definitions by their positions
20436
20445
  *
@@ -21941,37 +21950,39 @@ class LanguageProvider {
21941
21950
  });
21942
21951
  }
21943
21952
  $initHoverTooltip(editor) {
21953
+ const Range = editor.getSelectionRange().constructor;
21944
21954
  this.$hoverTooltip.setDataProvider((e, editor)=>{
21945
- let session = editor.session;
21946
- let docPos = e.getDocumentPosition();
21955
+ const session = editor.session;
21956
+ const docPos = e.getDocumentPosition();
21947
21957
  this.doHover(session, docPos, (hover)=>{
21948
- var _this_$getSessionLanguageProvider_state_diagnosticMarkers, _this_$getSessionLanguageProvider_state, _hover, _hover1, _errorMarker;
21949
- if (!hover) return;
21950
- var errorMarker = (_this_$getSessionLanguageProvider_state = this.$getSessionLanguageProvider(session).state) === null || _this_$getSessionLanguageProvider_state === void 0 ? void 0 : (_this_$getSessionLanguageProvider_state_diagnosticMarkers = _this_$getSessionLanguageProvider_state.diagnosticMarkers) === null || _this_$getSessionLanguageProvider_state_diagnosticMarkers === void 0 ? void 0 : _this_$getSessionLanguageProvider_state_diagnosticMarkers.getMarkerAtPosition(docPos);
21951
- if (!errorMarker && !((_hover = hover) === null || _hover === void 0 ? void 0 : _hover.content)) return;
21952
- var range = ((_hover1 = hover) === null || _hover1 === void 0 ? void 0 : _hover1.range) || ((_errorMarker = errorMarker) === null || _errorMarker === void 0 ? void 0 : _errorMarker.range);
21953
- const Range = editor.getSelectionRange().constructor;
21958
+ var _this_$getSessionLanguageProvider_state_diagnosticMarkers, _this_$getSessionLanguageProvider_state, _hover, _hover1, _errorMarkers_;
21959
+ var _this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition;
21960
+ const errorMarkers = (_this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition = (_this_$getSessionLanguageProvider_state = this.$getSessionLanguageProvider(session).state) === null || _this_$getSessionLanguageProvider_state === void 0 ? void 0 : (_this_$getSessionLanguageProvider_state_diagnosticMarkers = _this_$getSessionLanguageProvider_state.diagnosticMarkers) === null || _this_$getSessionLanguageProvider_state_diagnosticMarkers === void 0 ? void 0 : _this_$getSessionLanguageProvider_state_diagnosticMarkers.getMarkersAtPosition(docPos)) !== null && _this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition !== void 0 ? _this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition : [];
21961
+ const hasHoverContent = (_hover = hover) === null || _hover === void 0 ? void 0 : _hover.content;
21962
+ if (errorMarkers.length === 0 && !hasHoverContent) return;
21963
+ var _hover_range;
21964
+ var range = (_hover_range = (_hover1 = hover) === null || _hover1 === void 0 ? void 0 : _hover1.range) !== null && _hover_range !== void 0 ? _hover_range : (_errorMarkers_ = errorMarkers[0]) === null || _errorMarkers_ === void 0 ? void 0 : _errorMarkers_.range;
21954
21965
  range = range ? Range.fromPoints(range.start, range.end) : session.getWordRange(docPos.row, docPos.column);
21955
- var hoverNode = hover && document.createElement("div");
21956
- if (hoverNode) {
21957
- // todo render markdown using ace markdown mode
21958
- hoverNode.innerHTML = this.getTooltipText(hover);
21959
- }
21960
- var domNode = document.createElement('div');
21961
- if (errorMarker) {
21962
- var errorDiv = document.createElement('div');
21963
- var errorText = document.createTextNode(errorMarker.tooltipText.trim());
21964
- errorDiv.appendChild(errorText);
21965
- domNode.appendChild(errorDiv);
21966
- }
21967
- if (hoverNode) {
21968
- domNode.appendChild(hoverNode);
21969
- }
21966
+ const hoverNode = hasHoverContent ? this.createHoverNode(hover) : null;
21967
+ const errorNode = errorMarkers.length > 0 ? this.createErrorNode(errorMarkers) : null;
21968
+ const domNode = document.createElement('div');
21969
+ if (errorNode) domNode.appendChild(errorNode);
21970
+ if (hoverNode) domNode.appendChild(hoverNode);
21970
21971
  this.$hoverTooltip.showForRange(editor, range, domNode, e);
21971
21972
  });
21972
21973
  });
21973
21974
  this.$hoverTooltip.addToEditor(editor);
21974
21975
  }
21976
+ createHoverNode(hover) {
21977
+ const hoverNode = document.createElement("div");
21978
+ hoverNode.innerHTML = this.getTooltipText(hover);
21979
+ return hoverNode;
21980
+ }
21981
+ createErrorNode(errorMarkers) {
21982
+ const errorDiv = document.createElement('div');
21983
+ errorDiv.textContent = errorMarkers.map((el)=>el.tooltipText.trim()).join("\n");
21984
+ return errorDiv;
21985
+ }
21975
21986
  setStyles(editor) {
21976
21987
  if (!this.stylesEmbedded) {
21977
21988
  setStyles(editor);
@@ -19456,6 +19456,15 @@ class MarkerGroup {
19456
19456
  return marker.range.contains(pos.row, pos.column);
19457
19457
  });
19458
19458
  }
19459
+ /**
19460
+ * Finds all markers that contain the given position.
19461
+ * @param {Position} pos - The position to search for.
19462
+ * @returns {Ace.MarkerGroupItem[]} - An array of all markers that contain the given position.
19463
+ */ getMarkersAtPosition(pos) {
19464
+ return this.markers.filter(function(marker) {
19465
+ return marker.range.contains(pos.row, pos.column);
19466
+ });
19467
+ }
19459
19468
  /**
19460
19469
  * Comparator for Array.sort function, which sorts marker definitions by their positions
19461
19470
  *
@@ -20966,37 +20975,39 @@ class LanguageProvider {
20966
20975
  });
20967
20976
  }
20968
20977
  $initHoverTooltip(editor) {
20978
+ const Range = editor.getSelectionRange().constructor;
20969
20979
  this.$hoverTooltip.setDataProvider((e, editor)=>{
20970
- let session = editor.session;
20971
- let docPos = e.getDocumentPosition();
20980
+ const session = editor.session;
20981
+ const docPos = e.getDocumentPosition();
20972
20982
  this.doHover(session, docPos, (hover)=>{
20973
- var _this_$getSessionLanguageProvider_state_diagnosticMarkers, _this_$getSessionLanguageProvider_state, _hover, _hover1, _errorMarker;
20974
- if (!hover) return;
20975
- var errorMarker = (_this_$getSessionLanguageProvider_state = this.$getSessionLanguageProvider(session).state) === null || _this_$getSessionLanguageProvider_state === void 0 ? void 0 : (_this_$getSessionLanguageProvider_state_diagnosticMarkers = _this_$getSessionLanguageProvider_state.diagnosticMarkers) === null || _this_$getSessionLanguageProvider_state_diagnosticMarkers === void 0 ? void 0 : _this_$getSessionLanguageProvider_state_diagnosticMarkers.getMarkerAtPosition(docPos);
20976
- if (!errorMarker && !((_hover = hover) === null || _hover === void 0 ? void 0 : _hover.content)) return;
20977
- var range = ((_hover1 = hover) === null || _hover1 === void 0 ? void 0 : _hover1.range) || ((_errorMarker = errorMarker) === null || _errorMarker === void 0 ? void 0 : _errorMarker.range);
20978
- const Range = editor.getSelectionRange().constructor;
20983
+ var _this_$getSessionLanguageProvider_state_diagnosticMarkers, _this_$getSessionLanguageProvider_state, _hover, _hover1, _errorMarkers_;
20984
+ var _this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition;
20985
+ const errorMarkers = (_this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition = (_this_$getSessionLanguageProvider_state = this.$getSessionLanguageProvider(session).state) === null || _this_$getSessionLanguageProvider_state === void 0 ? void 0 : (_this_$getSessionLanguageProvider_state_diagnosticMarkers = _this_$getSessionLanguageProvider_state.diagnosticMarkers) === null || _this_$getSessionLanguageProvider_state_diagnosticMarkers === void 0 ? void 0 : _this_$getSessionLanguageProvider_state_diagnosticMarkers.getMarkersAtPosition(docPos)) !== null && _this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition !== void 0 ? _this_$getSessionLanguageProvider_state_diagnosticMarkers_getMarkersAtPosition : [];
20986
+ const hasHoverContent = (_hover = hover) === null || _hover === void 0 ? void 0 : _hover.content;
20987
+ if (errorMarkers.length === 0 && !hasHoverContent) return;
20988
+ var _hover_range;
20989
+ var range = (_hover_range = (_hover1 = hover) === null || _hover1 === void 0 ? void 0 : _hover1.range) !== null && _hover_range !== void 0 ? _hover_range : (_errorMarkers_ = errorMarkers[0]) === null || _errorMarkers_ === void 0 ? void 0 : _errorMarkers_.range;
20979
20990
  range = range ? Range.fromPoints(range.start, range.end) : session.getWordRange(docPos.row, docPos.column);
20980
- var hoverNode = hover && document.createElement("div");
20981
- if (hoverNode) {
20982
- // todo render markdown using ace markdown mode
20983
- hoverNode.innerHTML = this.getTooltipText(hover);
20984
- }
20985
- var domNode = document.createElement('div');
20986
- if (errorMarker) {
20987
- var errorDiv = document.createElement('div');
20988
- var errorText = document.createTextNode(errorMarker.tooltipText.trim());
20989
- errorDiv.appendChild(errorText);
20990
- domNode.appendChild(errorDiv);
20991
- }
20992
- if (hoverNode) {
20993
- domNode.appendChild(hoverNode);
20994
- }
20991
+ const hoverNode = hasHoverContent ? this.createHoverNode(hover) : null;
20992
+ const errorNode = errorMarkers.length > 0 ? this.createErrorNode(errorMarkers) : null;
20993
+ const domNode = document.createElement('div');
20994
+ if (errorNode) domNode.appendChild(errorNode);
20995
+ if (hoverNode) domNode.appendChild(hoverNode);
20995
20996
  this.$hoverTooltip.showForRange(editor, range, domNode, e);
20996
20997
  });
20997
20998
  });
20998
20999
  this.$hoverTooltip.addToEditor(editor);
20999
21000
  }
21001
+ createHoverNode(hover) {
21002
+ const hoverNode = document.createElement("div");
21003
+ hoverNode.innerHTML = this.getTooltipText(hover);
21004
+ return hoverNode;
21005
+ }
21006
+ createErrorNode(errorMarkers) {
21007
+ const errorDiv = document.createElement('div');
21008
+ errorDiv.textContent = errorMarkers.map((el)=>el.tooltipText.trim()).join("\n");
21009
+ return errorDiv;
21010
+ }
21000
21011
  setStyles(editor) {
21001
21012
  if (!this.stylesEmbedded) {
21002
21013
  setStyles(editor);
@@ -188223,18 +188223,22 @@ class TypescriptService extends base_service.BaseService {
188223
188223
  };
188224
188224
  }
188225
188225
  $getDocument(fileName) {
188226
- let text;
188227
- let document = this.getDocument(fileName);
188226
+ const fileNameWithoutUri = fileName.replace("file:///", "");
188227
+ var _this_getDocument;
188228
+ let document = (_this_getDocument = this.getDocument(fileName)) !== null && _this_getDocument !== void 0 ? _this_getDocument : this.getDocument(fileNameWithoutUri);
188228
188229
  if (document) {
188229
- text = document.getText();
188230
- } else if (fileName in libFileMap) {
188231
- text = libFileMap[fileName];
188232
- } else if (fileName in this.$extraLibs) {
188233
- text = this.$extraLibs[fileName].content;
188234
- } else {
188235
- return;
188230
+ return document.getText();
188236
188231
  }
188237
- return text;
188232
+ if (fileName in libFileMap) {
188233
+ return libFileMap[fileName];
188234
+ }
188235
+ if (fileName in this.$extraLibs) {
188236
+ return this.$extraLibs[fileName].content;
188237
+ }
188238
+ if (fileNameWithoutUri in this.$extraLibs) {
188239
+ return this.$extraLibs[fileNameWithoutUri].content;
188240
+ }
188241
+ return;
188238
188242
  }
188239
188243
  getScriptKind(fileName) {
188240
188244
  const ext = fileName.substring(fileName.lastIndexOf('.') + 1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ace-linters",
3
3
  "author": "Azat Alimov <mkslanc@gmail.com>",
4
- "version": "1.3.0",
4
+ "version": "1.3.2",
5
5
  "scripts": {
6
6
  "clean": "rimraf build",
7
7
  "prebuild": "node prebuild.js",
@@ -1,26 +1,32 @@
1
- export declare class MarkerGroup {
2
- private markers;
3
- private session;
4
- MAX_MARKERS: number;
5
- constructor(session: any);
6
- /**
7
- * Finds the first marker containing pos
8
- * @param {Position} pos
9
- * @returns Ace.MarkerGroupItem
10
- */
11
- getMarkerAtPosition(pos: any): any;
12
- /**
13
- * Comparator for Array.sort function, which sorts marker definitions by their positions
14
- *
15
- * @param {Ace.MarkerGroupItem} a first marker.
16
- * @param {Ace.MarkerGroupItem} b second marker.
17
- * @returns {number} negative number if a should be before b, positive number if b should be before a, 0 otherwise.
18
- */
19
- markersComparator(a: any, b: any): number;
20
- /**
21
- * Sets marker definitions to be rendered. Limits the number of markers at MAX_MARKERS.
22
- * @param {Ace.MarkerGroupItem[]} markers an array of marker definitions.
23
- */
24
- setMarkers(markers: any): void;
25
- update(html: any, markerLayer: any, session: any, config: any): void;
26
- }
1
+ export declare class MarkerGroup {
2
+ private markers;
3
+ private session;
4
+ MAX_MARKERS: number;
5
+ constructor(session: any);
6
+ /**
7
+ * Finds the first marker containing pos
8
+ * @param {Position} pos
9
+ * @returns Ace.MarkerGroupItem
10
+ */
11
+ getMarkerAtPosition(pos: any): any;
12
+ /**
13
+ * Finds all markers that contain the given position.
14
+ * @param {Position} pos - The position to search for.
15
+ * @returns {Ace.MarkerGroupItem[]} - An array of all markers that contain the given position.
16
+ */
17
+ getMarkersAtPosition(pos: any): any[];
18
+ /**
19
+ * Comparator for Array.sort function, which sorts marker definitions by their positions
20
+ *
21
+ * @param {Ace.MarkerGroupItem} a first marker.
22
+ * @param {Ace.MarkerGroupItem} b second marker.
23
+ * @returns {number} negative number if a should be before b, positive number if b should be before a, 0 otherwise.
24
+ */
25
+ markersComparator(a: any, b: any): number;
26
+ /**
27
+ * Sets marker definitions to be rendered. Limits the number of markers at MAX_MARKERS.
28
+ * @param {Ace.MarkerGroupItem[]} markers an array of marker definitions.
29
+ */
30
+ setMarkers(markers: any): void;
31
+ update(html: any, markerLayer: any, session: any, config: any): void;
32
+ }
@@ -1,156 +1,158 @@
1
- import { Ace } from "ace-code";
2
- import { ComboDocumentIdentifier, IMessageController } from "./types/message-controller-interface";
3
- import * as lsp from "vscode-languageserver-protocol";
4
- import { CodeActionsByService, ProviderOptions, ServiceFeatures, ServiceOptions, ServiceOptionsMap, ServiceStruct, SupportedServices, Tooltip } from "./types/language-service";
5
- import { MarkerGroup } from "./ace/marker_group";
6
- export declare class LanguageProvider {
7
- activeEditor: Ace.Editor;
8
- private readonly $messageController;
9
- private $signatureTooltip;
10
- $sessionLanguageProviders: {
11
- [sessionID: string]: SessionLanguageProvider;
12
- };
13
- editors: Ace.Editor[];
14
- options: ProviderOptions;
15
- private $hoverTooltip;
16
- $urisToSessionsIds: {
17
- [uri: string]: string;
18
- };
19
- workspaceUri: string;
20
- requireFilePath: boolean;
21
- private $lightBulbWidgets;
22
- private stylesEmbedded;
23
- private constructor();
24
- /**
25
- * Creates LanguageProvider using our transport protocol with ability to register different services on same
26
- * webworker
27
- * @param {Worker} worker
28
- * @param {ProviderOptions} options
29
- */
30
- static create(worker: Worker, options?: ProviderOptions): LanguageProvider;
31
- /**
32
- * method to create LanguageProvider from CDN
33
- * @param customServices
34
- * @param options
35
- * @param includeDefaultLinters by default would include all linters
36
- */
37
- static fromCdn(customServices: {
38
- services: ServiceStruct[];
39
- serviceManagerCdn: string;
40
- includeDefaultLinters?: {
41
- [name in SupportedServices]?: boolean;
42
- } | boolean;
43
- }, options?: ProviderOptions, includeDefaultLinters?: {
44
- [name in SupportedServices]?: boolean;
45
- } | boolean): LanguageProvider;
46
- static fromCdn(cdnUrl: string, options?: ProviderOptions, includeDefaultLinters?: {
47
- [name in SupportedServices]?: boolean;
48
- } | boolean): LanguageProvider;
49
- setProviderOptions(options?: ProviderOptions): void;
50
- /**
51
- * @param session
52
- * @param filePath - The full file path associated with the editor.
53
- */
54
- setSessionFilePath(session: Ace.EditSession, filePath: string): void;
55
- private $registerSession;
56
- private $getSessionLanguageProvider;
57
- private $getFileName;
58
- /**
59
- * Registers an Ace editor instance with the language provider.
60
- * @param editor - The Ace editor instance to register.
61
- */
62
- registerEditor(editor: Ace.Editor): void;
63
- codeActionCallback: (codeActions: CodeActionsByService[]) => void;
64
- setCodeActionCallback(callback: (codeActions: CodeActionsByService[]) => void): void;
65
- executeCommand(command: string, serviceName: string, args?: any[], callback?: (something: any) => void): void;
66
- applyEdit(workspaceEdit: lsp.WorkspaceEdit, serviceName: string, callback?: (result: lsp.ApplyWorkspaceEditResult, serviceName: string) => void): void;
67
- $registerEditor(editor: Ace.Editor): void;
68
- private $provideCodeActions;
69
- private $initHoverTooltip;
70
- private setStyles;
71
- setGlobalOptions<T extends keyof ServiceOptionsMap>(serviceName: T & string, options: ServiceOptionsMap[T], merge?: boolean): void;
72
- /**
73
- * Sets the workspace URI for the language provider.
74
- *
75
- * If the provided URI is the same as the current workspace URI, no action is taken.
76
- * Otherwise, the workspace URI is updated and the message controller is notified.
77
- *
78
- * Not all servers support changing of workspace URI.
79
- *
80
- * @param workspaceUri - The new workspace URI. Could be simple path, not URI itself.
81
- */
82
- changeWorkspaceFolder(workspaceUri: string): void;
83
- setSessionOptions<OptionsType extends ServiceOptions>(session: Ace.EditSession, options: OptionsType): void;
84
- configureServiceFeatures(serviceName: SupportedServices, features: ServiceFeatures): void;
85
- doHover(session: Ace.EditSession, position: Ace.Point, callback?: (hover: Tooltip | undefined) => void): void;
86
- provideSignatureHelp(session: Ace.EditSession, position: Ace.Point, callback?: (signatureHelp: Tooltip | undefined) => void): void;
87
- getTooltipText(hover: Tooltip): string;
88
- format: () => void;
89
- getSemanticTokens(): void;
90
- doComplete(editor: Ace.Editor, session: Ace.EditSession, callback: (CompletionList: Ace.Completion[] | null) => void): void;
91
- doResolve(item: Ace.Completion, callback: (completionItem: lsp.CompletionItem | null) => void): void;
92
- $registerCompleters(editor: Ace.Editor): void;
93
- closeConnection(): void;
94
- /**
95
- * Removes document from all linked services by session id
96
- * @param session
97
- * @param [callback]
98
- */
99
- closeDocument(session: Ace.EditSession, callback?: any): void;
100
- }
101
- declare class SessionLanguageProvider {
102
- session: Ace.EditSession;
103
- documentUri: string;
104
- private $messageController;
105
- private $deltaQueue;
106
- private $isConnected;
107
- private $modeIsChanged;
108
- private $options?;
109
- private $filePath;
110
- private $isFilePathRequired;
111
- private $servicesCapabilities?;
112
- state: {
113
- occurrenceMarkers: MarkerGroup | null;
114
- diagnosticMarkers: MarkerGroup | null;
115
- };
116
- private extensions;
117
- editor: Ace.Editor;
118
- private semanticTokensLegend?;
119
- private $provider;
120
- /**
121
- * Constructs a new instance of the `SessionLanguageProvider` class.
122
- *
123
- * @param provider - The `LanguageProvider` instance.
124
- * @param session - The Ace editor session.
125
- * @param editor - The Ace editor instance.
126
- * @param messageController - The `IMessageController` instance for handling messages.
127
- */
128
- constructor(provider: LanguageProvider, session: Ace.EditSession, editor: Ace.Editor, messageController: IMessageController);
129
- get comboDocumentIdentifier(): ComboDocumentIdentifier;
130
- /**
131
- * @param filePath
132
- */
133
- setFilePath(filePath: string): void;
134
- private $init;
135
- addSemanticTokenSupport(session: Ace.EditSession): void;
136
- private $connected;
137
- private $changeMode;
138
- setServerCapabilities: (capabilities: {
139
- [serviceName: string]: lsp.ServerCapabilities<any>;
140
- }) => void;
141
- private initDocumentUri;
142
- private get $extension();
143
- private get $mode();
144
- private get $format();
145
- private $changeListener;
146
- $sendDeltaQueue: (callback?: any) => any;
147
- $showAnnotations: (diagnostics: lsp.Diagnostic[]) => void;
148
- setOptions<OptionsType extends ServiceOptions>(options: OptionsType): void;
149
- validate: () => void;
150
- format: () => void;
151
- applyEdits: (edits: lsp.TextEdit[]) => void;
152
- getSemanticTokens(): void;
153
- $applyDocumentHighlight: (documentHighlights: lsp.DocumentHighlight[]) => void;
154
- closeDocument(callback?: any): void;
155
- }
156
- export {};
1
+ import { Ace } from "ace-code";
2
+ import { ComboDocumentIdentifier, IMessageController } from "./types/message-controller-interface";
3
+ import * as lsp from "vscode-languageserver-protocol";
4
+ import { CodeActionsByService, ProviderOptions, ServiceFeatures, ServiceOptions, ServiceOptionsMap, ServiceStruct, SupportedServices, Tooltip } from "./types/language-service";
5
+ import { MarkerGroup } from "./ace/marker_group";
6
+ export declare class LanguageProvider {
7
+ activeEditor: Ace.Editor;
8
+ private readonly $messageController;
9
+ private $signatureTooltip;
10
+ $sessionLanguageProviders: {
11
+ [sessionID: string]: SessionLanguageProvider;
12
+ };
13
+ editors: Ace.Editor[];
14
+ options: ProviderOptions;
15
+ private $hoverTooltip;
16
+ $urisToSessionsIds: {
17
+ [uri: string]: string;
18
+ };
19
+ workspaceUri: string;
20
+ requireFilePath: boolean;
21
+ private $lightBulbWidgets;
22
+ private stylesEmbedded;
23
+ private constructor();
24
+ /**
25
+ * Creates LanguageProvider using our transport protocol with ability to register different services on same
26
+ * webworker
27
+ * @param {Worker} worker
28
+ * @param {ProviderOptions} options
29
+ */
30
+ static create(worker: Worker, options?: ProviderOptions): LanguageProvider;
31
+ /**
32
+ * method to create LanguageProvider from CDN
33
+ * @param customServices
34
+ * @param options
35
+ * @param includeDefaultLinters by default would include all linters
36
+ */
37
+ static fromCdn(customServices: {
38
+ services: ServiceStruct[];
39
+ serviceManagerCdn: string;
40
+ includeDefaultLinters?: {
41
+ [name in SupportedServices]?: boolean;
42
+ } | boolean;
43
+ }, options?: ProviderOptions, includeDefaultLinters?: {
44
+ [name in SupportedServices]?: boolean;
45
+ } | boolean): LanguageProvider;
46
+ static fromCdn(cdnUrl: string, options?: ProviderOptions, includeDefaultLinters?: {
47
+ [name in SupportedServices]?: boolean;
48
+ } | boolean): LanguageProvider;
49
+ setProviderOptions(options?: ProviderOptions): void;
50
+ /**
51
+ * @param session
52
+ * @param filePath - The full file path associated with the editor.
53
+ */
54
+ setSessionFilePath(session: Ace.EditSession, filePath: string): void;
55
+ private $registerSession;
56
+ private $getSessionLanguageProvider;
57
+ private $getFileName;
58
+ /**
59
+ * Registers an Ace editor instance with the language provider.
60
+ * @param editor - The Ace editor instance to register.
61
+ */
62
+ registerEditor(editor: Ace.Editor): void;
63
+ codeActionCallback: (codeActions: CodeActionsByService[]) => void;
64
+ setCodeActionCallback(callback: (codeActions: CodeActionsByService[]) => void): void;
65
+ executeCommand(command: string, serviceName: string, args?: any[], callback?: (something: any) => void): void;
66
+ applyEdit(workspaceEdit: lsp.WorkspaceEdit, serviceName: string, callback?: (result: lsp.ApplyWorkspaceEditResult, serviceName: string) => void): void;
67
+ $registerEditor(editor: Ace.Editor): void;
68
+ private $provideCodeActions;
69
+ private $initHoverTooltip;
70
+ private createHoverNode;
71
+ private createErrorNode;
72
+ private setStyles;
73
+ setGlobalOptions<T extends keyof ServiceOptionsMap>(serviceName: T & string, options: ServiceOptionsMap[T], merge?: boolean): void;
74
+ /**
75
+ * Sets the workspace URI for the language provider.
76
+ *
77
+ * If the provided URI is the same as the current workspace URI, no action is taken.
78
+ * Otherwise, the workspace URI is updated and the message controller is notified.
79
+ *
80
+ * Not all servers support changing of workspace URI.
81
+ *
82
+ * @param workspaceUri - The new workspace URI. Could be simple path, not URI itself.
83
+ */
84
+ changeWorkspaceFolder(workspaceUri: string): void;
85
+ setSessionOptions<OptionsType extends ServiceOptions>(session: Ace.EditSession, options: OptionsType): void;
86
+ configureServiceFeatures(serviceName: SupportedServices, features: ServiceFeatures): void;
87
+ doHover(session: Ace.EditSession, position: Ace.Point, callback?: (hover: Tooltip | undefined) => void): void;
88
+ provideSignatureHelp(session: Ace.EditSession, position: Ace.Point, callback?: (signatureHelp: Tooltip | undefined) => void): void;
89
+ getTooltipText(hover: Tooltip): string;
90
+ format: () => void;
91
+ getSemanticTokens(): void;
92
+ doComplete(editor: Ace.Editor, session: Ace.EditSession, callback: (CompletionList: Ace.Completion[] | null) => void): void;
93
+ doResolve(item: Ace.Completion, callback: (completionItem: lsp.CompletionItem | null) => void): void;
94
+ $registerCompleters(editor: Ace.Editor): void;
95
+ closeConnection(): void;
96
+ /**
97
+ * Removes document from all linked services by session id
98
+ * @param session
99
+ * @param [callback]
100
+ */
101
+ closeDocument(session: Ace.EditSession, callback?: any): void;
102
+ }
103
+ declare class SessionLanguageProvider {
104
+ session: Ace.EditSession;
105
+ documentUri: string;
106
+ private $messageController;
107
+ private $deltaQueue;
108
+ private $isConnected;
109
+ private $modeIsChanged;
110
+ private $options?;
111
+ private $filePath;
112
+ private $isFilePathRequired;
113
+ private $servicesCapabilities?;
114
+ state: {
115
+ occurrenceMarkers: MarkerGroup | null;
116
+ diagnosticMarkers: MarkerGroup | null;
117
+ };
118
+ private extensions;
119
+ editor: Ace.Editor;
120
+ private semanticTokensLegend?;
121
+ private $provider;
122
+ /**
123
+ * Constructs a new instance of the `SessionLanguageProvider` class.
124
+ *
125
+ * @param provider - The `LanguageProvider` instance.
126
+ * @param session - The Ace editor session.
127
+ * @param editor - The Ace editor instance.
128
+ * @param messageController - The `IMessageController` instance for handling messages.
129
+ */
130
+ constructor(provider: LanguageProvider, session: Ace.EditSession, editor: Ace.Editor, messageController: IMessageController);
131
+ get comboDocumentIdentifier(): ComboDocumentIdentifier;
132
+ /**
133
+ * @param filePath
134
+ */
135
+ setFilePath(filePath: string): void;
136
+ private $init;
137
+ addSemanticTokenSupport(session: Ace.EditSession): void;
138
+ private $connected;
139
+ private $changeMode;
140
+ setServerCapabilities: (capabilities: {
141
+ [serviceName: string]: lsp.ServerCapabilities<any>;
142
+ }) => void;
143
+ private initDocumentUri;
144
+ private get $extension();
145
+ private get $mode();
146
+ private get $format();
147
+ private $changeListener;
148
+ $sendDeltaQueue: (callback?: any) => any;
149
+ $showAnnotations: (diagnostics: lsp.Diagnostic[]) => void;
150
+ setOptions<OptionsType extends ServiceOptions>(options: OptionsType): void;
151
+ validate: () => void;
152
+ format: () => void;
153
+ applyEdits: (edits: lsp.TextEdit[]) => void;
154
+ getSemanticTokens(): void;
155
+ $applyDocumentHighlight: (documentHighlights: lsp.DocumentHighlight[]) => void;
156
+ closeDocument(callback?: any): void;
157
+ }
158
+ export {};