ace-linters 1.8.5 → 1.8.6
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/build/ace-language-client.d.ts +27 -4
- package/build/ace-language-client.js +184 -25
- package/build/ace-linters.d.ts +27 -4
- package/build/ace-linters.js +184 -25
- package/build/language-client.js +25 -5
- package/package.json +1 -1
|
@@ -757,6 +757,7 @@ declare class SessionLanguageProvider {
|
|
|
757
757
|
editor: Ace.Editor;
|
|
758
758
|
private semanticTokensLegend?;
|
|
759
759
|
private $provider;
|
|
760
|
+
private $changeScrollTopHandler?;
|
|
760
761
|
/**
|
|
761
762
|
* Constructs a new instance of the `SessionLanguageProvider` class.
|
|
762
763
|
*
|
|
@@ -799,10 +800,18 @@ declare class SessionLanguageProvider {
|
|
|
799
800
|
applyEdits: (edits: lsp.TextEdit[]) => void;
|
|
800
801
|
getSemanticTokens(): void;
|
|
801
802
|
$applyDocumentHighlight: (documentHighlights: lsp.DocumentHighlight[]) => void;
|
|
803
|
+
/**
|
|
804
|
+
* Disposes of the SessionLanguageProvider, cleaning up all event listeners,
|
|
805
|
+
* marker groups, and notifying the server to close the document.
|
|
806
|
+
* This method should be called when the session is no longer needed.
|
|
807
|
+
*
|
|
808
|
+
* @param callback - Optional callback to execute after the document is closed
|
|
809
|
+
*/
|
|
810
|
+
dispose(callback?: any): void;
|
|
802
811
|
closeDocument(callback?: any): void;
|
|
803
812
|
}
|
|
804
813
|
declare class LanguageProvider {
|
|
805
|
-
activeEditor: Ace.Editor;
|
|
814
|
+
activeEditor: Ace.Editor | null;
|
|
806
815
|
private readonly $messageController;
|
|
807
816
|
private $signatureTooltip;
|
|
808
817
|
$sessionLanguageProviders: {
|
|
@@ -820,6 +829,8 @@ declare class LanguageProvider {
|
|
|
820
829
|
private inlineCompleter?;
|
|
821
830
|
private doLiveAutocomplete;
|
|
822
831
|
private completerAdapter?;
|
|
832
|
+
private $editorEventHandlers;
|
|
833
|
+
private $editorOriginalState;
|
|
823
834
|
private constructor();
|
|
824
835
|
/**
|
|
825
836
|
* Creates LanguageProvider using our transport protocol with the ability to register different services on the same
|
|
@@ -883,6 +894,16 @@ declare class LanguageProvider {
|
|
|
883
894
|
* @param [config] - Configuration options for the session.
|
|
884
895
|
*/
|
|
885
896
|
registerEditor(editor: Ace.Editor, config?: SessionLspConfig): void;
|
|
897
|
+
/**
|
|
898
|
+
* Unregisters an Ace editor instance, removing all event listeners, completers, tooltips,
|
|
899
|
+
* and cleaning up associated resources. This is the counterpart to registerEditor.
|
|
900
|
+
*
|
|
901
|
+
* @param editor - The Ace editor instance to be unregistered.
|
|
902
|
+
* @param cleanupSession - Optional flag to also dispose the current session. When true,
|
|
903
|
+
* calls closeDocument on the editor's session, cleaning up all
|
|
904
|
+
* session-related resources. Default: false.
|
|
905
|
+
*/
|
|
906
|
+
unregisterEditor(editor: Ace.Editor, cleanupSession?: boolean): void;
|
|
886
907
|
codeActionCallback: (codeActions: CodeActionsByService[]) => void;
|
|
887
908
|
/**
|
|
888
909
|
* Sets a callback function that will be triggered with an array of code actions grouped by service.
|
|
@@ -893,6 +914,7 @@ declare class LanguageProvider {
|
|
|
893
914
|
executeCommand(command: string, serviceName: string, args?: any[], callback?: (something: any) => void): void;
|
|
894
915
|
applyEdit(workspaceEdit: lsp.WorkspaceEdit, serviceName: string, callback?: (result: lsp.ApplyWorkspaceEditResult, serviceName: string) => void): void;
|
|
895
916
|
$registerEditor(editor: Ace.Editor): void;
|
|
917
|
+
$unregisterEditor(editor: Ace.Editor, cleanupSession?: boolean): void;
|
|
896
918
|
private $provideCodeActions;
|
|
897
919
|
private $initHoverTooltip;
|
|
898
920
|
private createHoverNode;
|
|
@@ -960,9 +982,10 @@ declare class LanguageProvider {
|
|
|
960
982
|
$registerCompleters(editor: Ace.Editor): void;
|
|
961
983
|
closeConnection(): void;
|
|
962
984
|
/**
|
|
963
|
-
* Removes document from all linked services by session id
|
|
964
|
-
*
|
|
965
|
-
* @param
|
|
985
|
+
* Removes document from all linked services by session id and cleans up all associated resources.
|
|
986
|
+
* This includes removing event listeners, clearing marker groups, annotations, and notifying the server.
|
|
987
|
+
* @param session - The Ace EditSession to close
|
|
988
|
+
* @param [callback] - Optional callback to execute after the document is closed
|
|
966
989
|
*/
|
|
967
990
|
closeDocument(session: Ace.EditSession, callback?: any): void;
|
|
968
991
|
/**
|
|
@@ -20990,7 +20990,20 @@ function signature_tooltip_define_property(obj, key, value) {
|
|
|
20990
20990
|
|
|
20991
20991
|
class SignatureTooltip extends BaseTooltip {
|
|
20992
20992
|
registerEditor(editor) {
|
|
20993
|
-
|
|
20993
|
+
const handler = ()=>this.onChangeSelection(editor);
|
|
20994
|
+
this.editorHandlers.set(editor, handler);
|
|
20995
|
+
editor.on("changeSelection", handler);
|
|
20996
|
+
}
|
|
20997
|
+
unregisterEditor(editor) {
|
|
20998
|
+
const handler = this.editorHandlers.get(editor);
|
|
20999
|
+
if (handler) {
|
|
21000
|
+
editor.off("changeSelection", handler);
|
|
21001
|
+
this.editorHandlers.delete(editor);
|
|
21002
|
+
}
|
|
21003
|
+
// Clean up if this was the active editor
|
|
21004
|
+
if (this.$activeEditor === editor) {
|
|
21005
|
+
this.$inactivateEditor();
|
|
21006
|
+
}
|
|
20994
21007
|
}
|
|
20995
21008
|
$registerEditorEvents() {
|
|
20996
21009
|
this.$activeEditor.on("mousewheel", this.$onMouseWheel);
|
|
@@ -21000,6 +21013,7 @@ class SignatureTooltip extends BaseTooltip {
|
|
|
21000
21013
|
}
|
|
21001
21014
|
constructor(...args){
|
|
21002
21015
|
super(...args);
|
|
21016
|
+
signature_tooltip_define_property(this, "editorHandlers", new Map());
|
|
21003
21017
|
signature_tooltip_define_property(this, "onChangeSelection", (editor)=>{
|
|
21004
21018
|
if (!this.provider.options.functionality.signatureHelp) return;
|
|
21005
21019
|
this.$activateEditor(editor);
|
|
@@ -21718,6 +21732,7 @@ class LightbulbWidget {
|
|
|
21718
21732
|
removeListeners() {
|
|
21719
21733
|
this.editor.off("changeSelection", this.hideAll);
|
|
21720
21734
|
this.editor.off("focus", this.hideAll);
|
|
21735
|
+
this.editor.renderer.off("afterRender", this.setPosition);
|
|
21721
21736
|
this.editor.session.off("changeScrollTop", this.setPosition);
|
|
21722
21737
|
this.editor.session.off("changeScrollLeft", this.setPosition);
|
|
21723
21738
|
}
|
|
@@ -21806,7 +21821,10 @@ class LightbulbWidget {
|
|
|
21806
21821
|
}
|
|
21807
21822
|
dispose() {
|
|
21808
21823
|
this.removeListeners();
|
|
21809
|
-
|
|
21824
|
+
if (this.lightbulb && this.lightbulb.parentNode) {
|
|
21825
|
+
this.lightbulb.parentNode.removeChild(this.lightbulb);
|
|
21826
|
+
}
|
|
21827
|
+
this.popup.destroy();
|
|
21810
21828
|
}
|
|
21811
21829
|
constructor(editor, executeActionCallback){
|
|
21812
21830
|
lightbulb_define_property(this, "codeActions", void 0);
|
|
@@ -22910,6 +22928,39 @@ class SessionLanguageProvider {
|
|
|
22910
22928
|
}, 20);
|
|
22911
22929
|
});
|
|
22912
22930
|
}
|
|
22931
|
+
/**
|
|
22932
|
+
* Disposes of the SessionLanguageProvider, cleaning up all event listeners,
|
|
22933
|
+
* marker groups, and notifying the server to close the document.
|
|
22934
|
+
* This method should be called when the session is no longer needed.
|
|
22935
|
+
*
|
|
22936
|
+
* @param callback - Optional callback to execute after the document is closed
|
|
22937
|
+
*/ dispose(callback) {
|
|
22938
|
+
this.session.doc.off("change", this.$changeListener);
|
|
22939
|
+
this.session.off("changeMode", this.$changeMode);
|
|
22940
|
+
if (this.$changeScrollTopHandler) {
|
|
22941
|
+
this.session.off("changeScrollTop", this.$changeScrollTopHandler);
|
|
22942
|
+
this.$changeScrollTopHandler = undefined;
|
|
22943
|
+
}
|
|
22944
|
+
if (this.state.occurrenceMarkers) {
|
|
22945
|
+
this.state.occurrenceMarkers.setMarkers([]);
|
|
22946
|
+
this.state.occurrenceMarkers = null;
|
|
22947
|
+
}
|
|
22948
|
+
if (this.state.diagnosticMarkers) {
|
|
22949
|
+
this.state.diagnosticMarkers.setMarkers([]);
|
|
22950
|
+
this.state.diagnosticMarkers = null;
|
|
22951
|
+
}
|
|
22952
|
+
this.session.clearAnnotations();
|
|
22953
|
+
if (this.session.setSemanticTokens) {
|
|
22954
|
+
this.session.setSemanticTokens(undefined);
|
|
22955
|
+
}
|
|
22956
|
+
this.$deltaQueue = null;
|
|
22957
|
+
this.$requestsQueue = [];
|
|
22958
|
+
if (this.documentUri) {
|
|
22959
|
+
delete this.$provider.$urisToSessionsIds[this.documentUri];
|
|
22960
|
+
}
|
|
22961
|
+
this.$isConnected = false;
|
|
22962
|
+
this.closeDocument(callback);
|
|
22963
|
+
}
|
|
22913
22964
|
closeDocument(callback) {
|
|
22914
22965
|
this.$messageController.closeDocument(this.comboDocumentIdentifier, callback);
|
|
22915
22966
|
}
|
|
@@ -22942,6 +22993,7 @@ class SessionLanguageProvider {
|
|
|
22942
22993
|
session_language_provider_define_property(this, "editor", void 0);
|
|
22943
22994
|
session_language_provider_define_property(this, "semanticTokensLegend", void 0);
|
|
22944
22995
|
session_language_provider_define_property(this, "$provider", void 0);
|
|
22996
|
+
session_language_provider_define_property(this, "$changeScrollTopHandler", void 0);
|
|
22945
22997
|
session_language_provider_define_property(this, "$connected", (capabilities)=>{
|
|
22946
22998
|
this.$isConnected = true;
|
|
22947
22999
|
this.setServerCapabilities(capabilities);
|
|
@@ -23095,7 +23147,8 @@ class SessionLanguageProvider {
|
|
|
23095
23147
|
this.addSemanticTokenSupport(session); //TODO: ?
|
|
23096
23148
|
session.on("changeMode", this.$changeMode);
|
|
23097
23149
|
if (this.$provider.options.functionality.semanticTokens) {
|
|
23098
|
-
|
|
23150
|
+
this.$changeScrollTopHandler = ()=>this.getSemanticTokens();
|
|
23151
|
+
session.on("changeScrollTop", this.$changeScrollTopHandler);
|
|
23099
23152
|
}
|
|
23100
23153
|
this.$init(config);
|
|
23101
23154
|
}
|
|
@@ -23251,6 +23304,17 @@ class LanguageProvider {
|
|
|
23251
23304
|
config = config !== null && config !== void 0 ? config : editor.session.lspConfig;
|
|
23252
23305
|
this.registerSession(editor.session, editor, config);
|
|
23253
23306
|
}
|
|
23307
|
+
/**
|
|
23308
|
+
* Unregisters an Ace editor instance, removing all event listeners, completers, tooltips,
|
|
23309
|
+
* and cleaning up associated resources. This is the counterpart to registerEditor.
|
|
23310
|
+
*
|
|
23311
|
+
* @param editor - The Ace editor instance to be unregistered.
|
|
23312
|
+
* @param cleanupSession - Optional flag to also dispose the current session. When true,
|
|
23313
|
+
* calls closeDocument on the editor's session, cleaning up all
|
|
23314
|
+
* session-related resources. Default: false.
|
|
23315
|
+
*/ unregisterEditor(editor, cleanupSession = false) {
|
|
23316
|
+
if (this.editors.includes(editor)) this.$unregisterEditor(editor, cleanupSession);
|
|
23317
|
+
}
|
|
23254
23318
|
/**
|
|
23255
23319
|
* Sets a callback function that will be triggered with an array of code actions grouped by service.
|
|
23256
23320
|
*
|
|
@@ -23318,20 +23382,25 @@ class LanguageProvider {
|
|
|
23318
23382
|
AceVirtualRenderer.getConstructor(editor);
|
|
23319
23383
|
AceEditor.getConstructor(editor);
|
|
23320
23384
|
editor.setOption("useWorker", false);
|
|
23385
|
+
this.$editorEventHandlers[editor.id] = {};
|
|
23321
23386
|
if (!this.options.manualSessionControl) {
|
|
23322
|
-
|
|
23387
|
+
const changeSessionHandler = ({ session })=>this.registerSession(session, editor, session.lspConfig);
|
|
23388
|
+
this.$editorEventHandlers[editor.id].changeSession = changeSessionHandler;
|
|
23389
|
+
editor.on("changeSession", changeSessionHandler);
|
|
23323
23390
|
}
|
|
23324
23391
|
if (this.options.functionality.completion || this.options.functionality.inlineCompletion) {
|
|
23325
23392
|
this.$registerCompleters(editor);
|
|
23326
23393
|
}
|
|
23327
23394
|
var _this_activeEditor;
|
|
23328
23395
|
(_this_activeEditor = this.activeEditor) !== null && _this_activeEditor !== void 0 ? _this_activeEditor : this.activeEditor = editor;
|
|
23329
|
-
|
|
23396
|
+
const focusHandler = ()=>{
|
|
23330
23397
|
this.activeEditor = editor;
|
|
23331
|
-
}
|
|
23398
|
+
};
|
|
23399
|
+
this.$editorEventHandlers[editor.id].focus = focusHandler;
|
|
23400
|
+
editor.on("focus", focusHandler);
|
|
23332
23401
|
if (this.options.functionality.documentHighlights) {
|
|
23333
23402
|
var $timer;
|
|
23334
|
-
|
|
23403
|
+
const changeSelectionForHighlights = ()=>{
|
|
23335
23404
|
if (!$timer) $timer = setTimeout(()=>{
|
|
23336
23405
|
let sessionLanguageProvider = this.$getSessionLanguageProvider(editor.session);
|
|
23337
23406
|
if (!sessionLanguageProvider) {
|
|
@@ -23342,7 +23411,9 @@ class LanguageProvider {
|
|
|
23342
23411
|
this.$messageController.findDocumentHighlights(this.$getFileName(editor.session), fromPoint(cursor), sessionLanguageProvider.$applyDocumentHighlight);
|
|
23343
23412
|
$timer = undefined;
|
|
23344
23413
|
}, 50);
|
|
23345
|
-
}
|
|
23414
|
+
};
|
|
23415
|
+
this.$editorEventHandlers[editor.id].changeSelectionForHighlights = changeSelectionForHighlights;
|
|
23416
|
+
editor.on("changeSelection", changeSelectionForHighlights);
|
|
23346
23417
|
}
|
|
23347
23418
|
if (this.options.functionality.codeActions) {
|
|
23348
23419
|
this.$provideCodeActions(editor);
|
|
@@ -23358,6 +23429,71 @@ class LanguageProvider {
|
|
|
23358
23429
|
}
|
|
23359
23430
|
this.setStyles(editor);
|
|
23360
23431
|
}
|
|
23432
|
+
$unregisterEditor(editor, cleanupSession = false) {
|
|
23433
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2;
|
|
23434
|
+
const editorIndex = this.editors.indexOf(editor);
|
|
23435
|
+
if (editorIndex > -1) {
|
|
23436
|
+
this.editors.splice(editorIndex, 1);
|
|
23437
|
+
}
|
|
23438
|
+
const handlers = this.$editorEventHandlers[editor.id];
|
|
23439
|
+
if (handlers) {
|
|
23440
|
+
if (handlers.changeSession) {
|
|
23441
|
+
editor.off("changeSession", handlers.changeSession);
|
|
23442
|
+
}
|
|
23443
|
+
if (handlers.focus) {
|
|
23444
|
+
editor.off("focus", handlers.focus);
|
|
23445
|
+
}
|
|
23446
|
+
if (handlers.changeSelectionForHighlights) {
|
|
23447
|
+
editor.off("changeSelection", handlers.changeSelectionForHighlights);
|
|
23448
|
+
}
|
|
23449
|
+
if (handlers.changeSelectionForCodeActions) {
|
|
23450
|
+
editor.off("changeSelection", handlers.changeSelectionForCodeActions);
|
|
23451
|
+
}
|
|
23452
|
+
if (handlers.afterExec) {
|
|
23453
|
+
editor.commands.off('afterExec', handlers.afterExec);
|
|
23454
|
+
}
|
|
23455
|
+
delete this.$editorEventHandlers[editor.id];
|
|
23456
|
+
}
|
|
23457
|
+
const originalState = this.$editorOriginalState[editor.id];
|
|
23458
|
+
if (originalState) {
|
|
23459
|
+
var _this_options_functionality3, _this_options_functionality4, _this_options_functionality5;
|
|
23460
|
+
if (((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.completion) && originalState.completers !== undefined) {
|
|
23461
|
+
editor.completers = originalState.completers;
|
|
23462
|
+
}
|
|
23463
|
+
if (((_this_options_functionality4 = this.options.functionality) === null || _this_options_functionality4 === void 0 ? void 0 : _this_options_functionality4.inlineCompletion) && originalState.inlineCompleters !== undefined) {
|
|
23464
|
+
editor.inlineCompleters = originalState.inlineCompleters;
|
|
23465
|
+
}
|
|
23466
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
23467
|
+
if (originalState.inlineAutocompleteCommand) {
|
|
23468
|
+
editor.commands.addCommand(originalState.inlineAutocompleteCommand);
|
|
23469
|
+
} else {
|
|
23470
|
+
try {
|
|
23471
|
+
editor.commands.removeCommand("startInlineAutocomplete");
|
|
23472
|
+
} catch (e) {}
|
|
23473
|
+
}
|
|
23474
|
+
}
|
|
23475
|
+
delete this.$editorOriginalState[editor.id];
|
|
23476
|
+
}
|
|
23477
|
+
if ((_this_options_functionality = this.options.functionality) === null || _this_options_functionality === void 0 ? void 0 : _this_options_functionality.signatureHelp) {
|
|
23478
|
+
this.$signatureTooltip.unregisterEditor(editor);
|
|
23479
|
+
}
|
|
23480
|
+
if (((_this_options_functionality1 = this.options.functionality) === null || _this_options_functionality1 === void 0 ? void 0 : _this_options_functionality1.hover) && this.$hoverTooltip) {
|
|
23481
|
+
this.$hoverTooltip.removeFromEditor(editor);
|
|
23482
|
+
}
|
|
23483
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.codeActions) {
|
|
23484
|
+
const lightBulb = this.$lightBulbWidgets[editor.id];
|
|
23485
|
+
if (lightBulb) {
|
|
23486
|
+
lightBulb.dispose();
|
|
23487
|
+
delete this.$lightBulbWidgets[editor.id];
|
|
23488
|
+
}
|
|
23489
|
+
}
|
|
23490
|
+
if (this.activeEditor === editor) {
|
|
23491
|
+
this.activeEditor = this.editors.length > 0 ? this.editors[0] : null;
|
|
23492
|
+
}
|
|
23493
|
+
if (cleanupSession && editor.session) {
|
|
23494
|
+
this.closeDocument(editor.session);
|
|
23495
|
+
}
|
|
23496
|
+
}
|
|
23361
23497
|
$provideCodeActions(editor) {
|
|
23362
23498
|
const lightBulb = new LightbulbWidget(editor);
|
|
23363
23499
|
this.$lightBulbWidgets[editor.id] = lightBulb;
|
|
@@ -23376,7 +23512,7 @@ class LanguageProvider {
|
|
|
23376
23512
|
}
|
|
23377
23513
|
});
|
|
23378
23514
|
var actionTimer;
|
|
23379
|
-
|
|
23515
|
+
const changeSelectionForCodeActions = ()=>{
|
|
23380
23516
|
if (!actionTimer) actionTimer = setTimeout(()=>{
|
|
23381
23517
|
if (!this.$getSessionLanguageProvider(editor.session)) {
|
|
23382
23518
|
actionTimer = undefined;
|
|
@@ -23394,7 +23530,9 @@ class LanguageProvider {
|
|
|
23394
23530
|
});
|
|
23395
23531
|
actionTimer = undefined;
|
|
23396
23532
|
}, 500);
|
|
23397
|
-
}
|
|
23533
|
+
};
|
|
23534
|
+
this.$editorEventHandlers[editor.id].changeSelectionForCodeActions = changeSelectionForCodeActions;
|
|
23535
|
+
editor.on("changeSelection", changeSelectionForCodeActions);
|
|
23398
23536
|
}
|
|
23399
23537
|
$initHoverTooltip(editor) {
|
|
23400
23538
|
const Range = editor.getSelectionRange().constructor;
|
|
@@ -23508,8 +23646,10 @@ class LanguageProvider {
|
|
|
23508
23646
|
}
|
|
23509
23647
|
getSemanticTokens() {
|
|
23510
23648
|
if (!this.options.functionality.semanticTokens) return;
|
|
23511
|
-
|
|
23512
|
-
|
|
23649
|
+
if (this.activeEditor) {
|
|
23650
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
23651
|
+
sessionLanguageProvider.getSemanticTokens();
|
|
23652
|
+
}
|
|
23513
23653
|
}
|
|
23514
23654
|
doComplete(editor, session, callback) {
|
|
23515
23655
|
let cursor = editor.getCursorPosition();
|
|
@@ -23523,16 +23663,27 @@ class LanguageProvider {
|
|
|
23523
23663
|
this.$messageController.doResolve(item["fileName"], toCompletionItem(item), callback);
|
|
23524
23664
|
}
|
|
23525
23665
|
$registerCompleters(editor) {
|
|
23526
|
-
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4,
|
|
23666
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4, _this_options, _this_options_functionality5;
|
|
23527
23667
|
let completer, inlineCompleter;
|
|
23528
23668
|
if (!((_this_options_functionality = this.options.functionality) === null || _this_options_functionality === void 0 ? void 0 : _this_options_functionality.completion) && !((_this_options_functionality1 = this.options.functionality) === null || _this_options_functionality1 === void 0 ? void 0 : _this_options_functionality1.inlineCompletion)) {
|
|
23529
23669
|
return;
|
|
23530
23670
|
}
|
|
23531
|
-
|
|
23532
|
-
|
|
23671
|
+
this.$editorOriginalState[editor.id] = {};
|
|
23672
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.completion) {
|
|
23673
|
+
this.$editorOriginalState[editor.id].completers = editor.completers ? [
|
|
23674
|
+
...editor.completers
|
|
23675
|
+
] : [];
|
|
23676
|
+
if (this.options.functionality.completion.overwriteCompleters) {
|
|
23677
|
+
editor.completers = [];
|
|
23678
|
+
}
|
|
23533
23679
|
}
|
|
23534
|
-
if ((
|
|
23535
|
-
editor.inlineCompleters = [
|
|
23680
|
+
if ((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.inlineCompletion) {
|
|
23681
|
+
this.$editorOriginalState[editor.id].inlineCompleters = editor.inlineCompleters ? [
|
|
23682
|
+
...editor.inlineCompleters
|
|
23683
|
+
] : [];
|
|
23684
|
+
if (this.options.functionality.inlineCompletion.overwriteCompleters) {
|
|
23685
|
+
editor.inlineCompleters = [];
|
|
23686
|
+
}
|
|
23536
23687
|
}
|
|
23537
23688
|
if (this.options.functionality.completion) {
|
|
23538
23689
|
completer = {
|
|
@@ -23578,7 +23729,7 @@ class LanguageProvider {
|
|
|
23578
23729
|
};
|
|
23579
23730
|
editor.completers.push(completer);
|
|
23580
23731
|
}
|
|
23581
|
-
if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : (
|
|
23732
|
+
if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : (_this_options_functionality4 = _this_options.functionality) === null || _this_options_functionality4 === void 0 ? void 0 : _this_options_functionality4.inlineCompletion) {
|
|
23582
23733
|
this.checkInlineCompletionAdapter(()=>{
|
|
23583
23734
|
if (this.completerAdapter) {
|
|
23584
23735
|
var _editor;
|
|
@@ -23590,7 +23741,9 @@ class LanguageProvider {
|
|
|
23590
23741
|
}
|
|
23591
23742
|
});
|
|
23592
23743
|
}
|
|
23593
|
-
if ((
|
|
23744
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
23745
|
+
const existingCommand = editor.commands.commands["startInlineAutocomplete"];
|
|
23746
|
+
this.$editorOriginalState[editor.id].inlineAutocompleteCommand = existingCommand || null;
|
|
23594
23747
|
editor.commands.addCommand({
|
|
23595
23748
|
name: "startInlineAutocomplete",
|
|
23596
23749
|
exec: (editor, options)=>{
|
|
@@ -23603,6 +23756,7 @@ class LanguageProvider {
|
|
|
23603
23756
|
mac: "Option-C"
|
|
23604
23757
|
}
|
|
23605
23758
|
});
|
|
23759
|
+
this.$editorEventHandlers[editor.id].afterExec = this.doLiveAutocomplete;
|
|
23606
23760
|
editor.commands.on('afterExec', this.doLiveAutocomplete);
|
|
23607
23761
|
inlineCompleter = {
|
|
23608
23762
|
getCompletions: async (editor, session, pos, prefix, callback)=>{
|
|
@@ -23630,13 +23784,14 @@ class LanguageProvider {
|
|
|
23630
23784
|
});
|
|
23631
23785
|
}
|
|
23632
23786
|
/**
|
|
23633
|
-
* Removes document from all linked services by session id
|
|
23634
|
-
*
|
|
23635
|
-
* @param
|
|
23787
|
+
* Removes document from all linked services by session id and cleans up all associated resources.
|
|
23788
|
+
* This includes removing event listeners, clearing marker groups, annotations, and notifying the server.
|
|
23789
|
+
* @param session - The Ace EditSession to close
|
|
23790
|
+
* @param [callback] - Optional callback to execute after the document is closed
|
|
23636
23791
|
*/ closeDocument(session, callback) {
|
|
23637
23792
|
let sessionProvider = this.$getSessionLanguageProvider(session);
|
|
23638
23793
|
if (sessionProvider) {
|
|
23639
|
-
sessionProvider.
|
|
23794
|
+
sessionProvider.dispose(callback);
|
|
23640
23795
|
delete this.$sessionLanguageProviders[session["id"]];
|
|
23641
23796
|
}
|
|
23642
23797
|
}
|
|
@@ -23678,6 +23833,8 @@ class LanguageProvider {
|
|
|
23678
23833
|
language_provider_define_property(this, "inlineCompleter", void 0);
|
|
23679
23834
|
language_provider_define_property(this, "doLiveAutocomplete", void 0);
|
|
23680
23835
|
language_provider_define_property(this, "completerAdapter", void 0);
|
|
23836
|
+
language_provider_define_property(this, "$editorEventHandlers", {});
|
|
23837
|
+
language_provider_define_property(this, "$editorOriginalState", {});
|
|
23681
23838
|
/**
|
|
23682
23839
|
* Registers a new editing session with the editor and associates it with a language provider.
|
|
23683
23840
|
* If a language provider for the specified editing session does not already exist, it initializes
|
|
@@ -23697,8 +23854,10 @@ class LanguageProvider {
|
|
|
23697
23854
|
language_provider_define_property(this, "codeActionCallback", void 0);
|
|
23698
23855
|
language_provider_define_property(this, "format", ()=>{
|
|
23699
23856
|
if (!this.options.functionality.format) return;
|
|
23700
|
-
|
|
23701
|
-
|
|
23857
|
+
if (this.activeEditor) {
|
|
23858
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
23859
|
+
sessionLanguageProvider.$sendDeltaQueue(sessionLanguageProvider.format);
|
|
23860
|
+
}
|
|
23702
23861
|
});
|
|
23703
23862
|
this.$messageController = new MessageController(worker, this);
|
|
23704
23863
|
this.setProviderOptions(options);
|
package/build/ace-linters.d.ts
CHANGED
|
@@ -686,6 +686,7 @@ declare class SessionLanguageProvider {
|
|
|
686
686
|
editor: Ace.Editor;
|
|
687
687
|
private semanticTokensLegend?;
|
|
688
688
|
private $provider;
|
|
689
|
+
private $changeScrollTopHandler?;
|
|
689
690
|
/**
|
|
690
691
|
* Constructs a new instance of the `SessionLanguageProvider` class.
|
|
691
692
|
*
|
|
@@ -728,10 +729,18 @@ declare class SessionLanguageProvider {
|
|
|
728
729
|
applyEdits: (edits: lsp.TextEdit[]) => void;
|
|
729
730
|
getSemanticTokens(): void;
|
|
730
731
|
$applyDocumentHighlight: (documentHighlights: lsp.DocumentHighlight[]) => void;
|
|
732
|
+
/**
|
|
733
|
+
* Disposes of the SessionLanguageProvider, cleaning up all event listeners,
|
|
734
|
+
* marker groups, and notifying the server to close the document.
|
|
735
|
+
* This method should be called when the session is no longer needed.
|
|
736
|
+
*
|
|
737
|
+
* @param callback - Optional callback to execute after the document is closed
|
|
738
|
+
*/
|
|
739
|
+
dispose(callback?: any): void;
|
|
731
740
|
closeDocument(callback?: any): void;
|
|
732
741
|
}
|
|
733
742
|
export declare class LanguageProvider {
|
|
734
|
-
activeEditor: Ace.Editor;
|
|
743
|
+
activeEditor: Ace.Editor | null;
|
|
735
744
|
private readonly $messageController;
|
|
736
745
|
private $signatureTooltip;
|
|
737
746
|
$sessionLanguageProviders: {
|
|
@@ -749,6 +758,8 @@ export declare class LanguageProvider {
|
|
|
749
758
|
private inlineCompleter?;
|
|
750
759
|
private doLiveAutocomplete;
|
|
751
760
|
private completerAdapter?;
|
|
761
|
+
private $editorEventHandlers;
|
|
762
|
+
private $editorOriginalState;
|
|
752
763
|
private constructor();
|
|
753
764
|
/**
|
|
754
765
|
* Creates LanguageProvider using our transport protocol with the ability to register different services on the same
|
|
@@ -812,6 +823,16 @@ export declare class LanguageProvider {
|
|
|
812
823
|
* @param [config] - Configuration options for the session.
|
|
813
824
|
*/
|
|
814
825
|
registerEditor(editor: Ace.Editor, config?: SessionLspConfig): void;
|
|
826
|
+
/**
|
|
827
|
+
* Unregisters an Ace editor instance, removing all event listeners, completers, tooltips,
|
|
828
|
+
* and cleaning up associated resources. This is the counterpart to registerEditor.
|
|
829
|
+
*
|
|
830
|
+
* @param editor - The Ace editor instance to be unregistered.
|
|
831
|
+
* @param cleanupSession - Optional flag to also dispose the current session. When true,
|
|
832
|
+
* calls closeDocument on the editor's session, cleaning up all
|
|
833
|
+
* session-related resources. Default: false.
|
|
834
|
+
*/
|
|
835
|
+
unregisterEditor(editor: Ace.Editor, cleanupSession?: boolean): void;
|
|
815
836
|
codeActionCallback: (codeActions: CodeActionsByService[]) => void;
|
|
816
837
|
/**
|
|
817
838
|
* Sets a callback function that will be triggered with an array of code actions grouped by service.
|
|
@@ -822,6 +843,7 @@ export declare class LanguageProvider {
|
|
|
822
843
|
executeCommand(command: string, serviceName: string, args?: any[], callback?: (something: any) => void): void;
|
|
823
844
|
applyEdit(workspaceEdit: lsp.WorkspaceEdit, serviceName: string, callback?: (result: lsp.ApplyWorkspaceEditResult, serviceName: string) => void): void;
|
|
824
845
|
$registerEditor(editor: Ace.Editor): void;
|
|
846
|
+
$unregisterEditor(editor: Ace.Editor, cleanupSession?: boolean): void;
|
|
825
847
|
private $provideCodeActions;
|
|
826
848
|
private $initHoverTooltip;
|
|
827
849
|
private createHoverNode;
|
|
@@ -889,9 +911,10 @@ export declare class LanguageProvider {
|
|
|
889
911
|
$registerCompleters(editor: Ace.Editor): void;
|
|
890
912
|
closeConnection(): void;
|
|
891
913
|
/**
|
|
892
|
-
* Removes document from all linked services by session id
|
|
893
|
-
*
|
|
894
|
-
* @param
|
|
914
|
+
* Removes document from all linked services by session id and cleans up all associated resources.
|
|
915
|
+
* This includes removing event listeners, clearing marker groups, annotations, and notifying the server.
|
|
916
|
+
* @param session - The Ace EditSession to close
|
|
917
|
+
* @param [callback] - Optional callback to execute after the document is closed
|
|
895
918
|
*/
|
|
896
919
|
closeDocument(session: Ace.EditSession, callback?: any): void;
|
|
897
920
|
/**
|
package/build/ace-linters.js
CHANGED
|
@@ -19981,7 +19981,20 @@ function signature_tooltip_define_property(obj, key, value) {
|
|
|
19981
19981
|
|
|
19982
19982
|
class SignatureTooltip extends BaseTooltip {
|
|
19983
19983
|
registerEditor(editor) {
|
|
19984
|
-
|
|
19984
|
+
const handler = ()=>this.onChangeSelection(editor);
|
|
19985
|
+
this.editorHandlers.set(editor, handler);
|
|
19986
|
+
editor.on("changeSelection", handler);
|
|
19987
|
+
}
|
|
19988
|
+
unregisterEditor(editor) {
|
|
19989
|
+
const handler = this.editorHandlers.get(editor);
|
|
19990
|
+
if (handler) {
|
|
19991
|
+
editor.off("changeSelection", handler);
|
|
19992
|
+
this.editorHandlers.delete(editor);
|
|
19993
|
+
}
|
|
19994
|
+
// Clean up if this was the active editor
|
|
19995
|
+
if (this.$activeEditor === editor) {
|
|
19996
|
+
this.$inactivateEditor();
|
|
19997
|
+
}
|
|
19985
19998
|
}
|
|
19986
19999
|
$registerEditorEvents() {
|
|
19987
20000
|
this.$activeEditor.on("mousewheel", this.$onMouseWheel);
|
|
@@ -19991,6 +20004,7 @@ class SignatureTooltip extends BaseTooltip {
|
|
|
19991
20004
|
}
|
|
19992
20005
|
constructor(...args){
|
|
19993
20006
|
super(...args);
|
|
20007
|
+
signature_tooltip_define_property(this, "editorHandlers", new Map());
|
|
19994
20008
|
signature_tooltip_define_property(this, "onChangeSelection", (editor)=>{
|
|
19995
20009
|
if (!this.provider.options.functionality.signatureHelp) return;
|
|
19996
20010
|
this.$activateEditor(editor);
|
|
@@ -20709,6 +20723,7 @@ class LightbulbWidget {
|
|
|
20709
20723
|
removeListeners() {
|
|
20710
20724
|
this.editor.off("changeSelection", this.hideAll);
|
|
20711
20725
|
this.editor.off("focus", this.hideAll);
|
|
20726
|
+
this.editor.renderer.off("afterRender", this.setPosition);
|
|
20712
20727
|
this.editor.session.off("changeScrollTop", this.setPosition);
|
|
20713
20728
|
this.editor.session.off("changeScrollLeft", this.setPosition);
|
|
20714
20729
|
}
|
|
@@ -20797,7 +20812,10 @@ class LightbulbWidget {
|
|
|
20797
20812
|
}
|
|
20798
20813
|
dispose() {
|
|
20799
20814
|
this.removeListeners();
|
|
20800
|
-
|
|
20815
|
+
if (this.lightbulb && this.lightbulb.parentNode) {
|
|
20816
|
+
this.lightbulb.parentNode.removeChild(this.lightbulb);
|
|
20817
|
+
}
|
|
20818
|
+
this.popup.destroy();
|
|
20801
20819
|
}
|
|
20802
20820
|
constructor(editor, executeActionCallback){
|
|
20803
20821
|
lightbulb_define_property(this, "codeActions", void 0);
|
|
@@ -21901,6 +21919,39 @@ class SessionLanguageProvider {
|
|
|
21901
21919
|
}, 20);
|
|
21902
21920
|
});
|
|
21903
21921
|
}
|
|
21922
|
+
/**
|
|
21923
|
+
* Disposes of the SessionLanguageProvider, cleaning up all event listeners,
|
|
21924
|
+
* marker groups, and notifying the server to close the document.
|
|
21925
|
+
* This method should be called when the session is no longer needed.
|
|
21926
|
+
*
|
|
21927
|
+
* @param callback - Optional callback to execute after the document is closed
|
|
21928
|
+
*/ dispose(callback) {
|
|
21929
|
+
this.session.doc.off("change", this.$changeListener);
|
|
21930
|
+
this.session.off("changeMode", this.$changeMode);
|
|
21931
|
+
if (this.$changeScrollTopHandler) {
|
|
21932
|
+
this.session.off("changeScrollTop", this.$changeScrollTopHandler);
|
|
21933
|
+
this.$changeScrollTopHandler = undefined;
|
|
21934
|
+
}
|
|
21935
|
+
if (this.state.occurrenceMarkers) {
|
|
21936
|
+
this.state.occurrenceMarkers.setMarkers([]);
|
|
21937
|
+
this.state.occurrenceMarkers = null;
|
|
21938
|
+
}
|
|
21939
|
+
if (this.state.diagnosticMarkers) {
|
|
21940
|
+
this.state.diagnosticMarkers.setMarkers([]);
|
|
21941
|
+
this.state.diagnosticMarkers = null;
|
|
21942
|
+
}
|
|
21943
|
+
this.session.clearAnnotations();
|
|
21944
|
+
if (this.session.setSemanticTokens) {
|
|
21945
|
+
this.session.setSemanticTokens(undefined);
|
|
21946
|
+
}
|
|
21947
|
+
this.$deltaQueue = null;
|
|
21948
|
+
this.$requestsQueue = [];
|
|
21949
|
+
if (this.documentUri) {
|
|
21950
|
+
delete this.$provider.$urisToSessionsIds[this.documentUri];
|
|
21951
|
+
}
|
|
21952
|
+
this.$isConnected = false;
|
|
21953
|
+
this.closeDocument(callback);
|
|
21954
|
+
}
|
|
21904
21955
|
closeDocument(callback) {
|
|
21905
21956
|
this.$messageController.closeDocument(this.comboDocumentIdentifier, callback);
|
|
21906
21957
|
}
|
|
@@ -21933,6 +21984,7 @@ class SessionLanguageProvider {
|
|
|
21933
21984
|
session_language_provider_define_property(this, "editor", void 0);
|
|
21934
21985
|
session_language_provider_define_property(this, "semanticTokensLegend", void 0);
|
|
21935
21986
|
session_language_provider_define_property(this, "$provider", void 0);
|
|
21987
|
+
session_language_provider_define_property(this, "$changeScrollTopHandler", void 0);
|
|
21936
21988
|
session_language_provider_define_property(this, "$connected", (capabilities)=>{
|
|
21937
21989
|
this.$isConnected = true;
|
|
21938
21990
|
this.setServerCapabilities(capabilities);
|
|
@@ -22086,7 +22138,8 @@ class SessionLanguageProvider {
|
|
|
22086
22138
|
this.addSemanticTokenSupport(session); //TODO: ?
|
|
22087
22139
|
session.on("changeMode", this.$changeMode);
|
|
22088
22140
|
if (this.$provider.options.functionality.semanticTokens) {
|
|
22089
|
-
|
|
22141
|
+
this.$changeScrollTopHandler = ()=>this.getSemanticTokens();
|
|
22142
|
+
session.on("changeScrollTop", this.$changeScrollTopHandler);
|
|
22090
22143
|
}
|
|
22091
22144
|
this.$init(config);
|
|
22092
22145
|
}
|
|
@@ -22242,6 +22295,17 @@ class LanguageProvider {
|
|
|
22242
22295
|
config = config !== null && config !== void 0 ? config : editor.session.lspConfig;
|
|
22243
22296
|
this.registerSession(editor.session, editor, config);
|
|
22244
22297
|
}
|
|
22298
|
+
/**
|
|
22299
|
+
* Unregisters an Ace editor instance, removing all event listeners, completers, tooltips,
|
|
22300
|
+
* and cleaning up associated resources. This is the counterpart to registerEditor.
|
|
22301
|
+
*
|
|
22302
|
+
* @param editor - The Ace editor instance to be unregistered.
|
|
22303
|
+
* @param cleanupSession - Optional flag to also dispose the current session. When true,
|
|
22304
|
+
* calls closeDocument on the editor's session, cleaning up all
|
|
22305
|
+
* session-related resources. Default: false.
|
|
22306
|
+
*/ unregisterEditor(editor, cleanupSession = false) {
|
|
22307
|
+
if (this.editors.includes(editor)) this.$unregisterEditor(editor, cleanupSession);
|
|
22308
|
+
}
|
|
22245
22309
|
/**
|
|
22246
22310
|
* Sets a callback function that will be triggered with an array of code actions grouped by service.
|
|
22247
22311
|
*
|
|
@@ -22309,20 +22373,25 @@ class LanguageProvider {
|
|
|
22309
22373
|
AceVirtualRenderer.getConstructor(editor);
|
|
22310
22374
|
AceEditor.getConstructor(editor);
|
|
22311
22375
|
editor.setOption("useWorker", false);
|
|
22376
|
+
this.$editorEventHandlers[editor.id] = {};
|
|
22312
22377
|
if (!this.options.manualSessionControl) {
|
|
22313
|
-
|
|
22378
|
+
const changeSessionHandler = ({ session })=>this.registerSession(session, editor, session.lspConfig);
|
|
22379
|
+
this.$editorEventHandlers[editor.id].changeSession = changeSessionHandler;
|
|
22380
|
+
editor.on("changeSession", changeSessionHandler);
|
|
22314
22381
|
}
|
|
22315
22382
|
if (this.options.functionality.completion || this.options.functionality.inlineCompletion) {
|
|
22316
22383
|
this.$registerCompleters(editor);
|
|
22317
22384
|
}
|
|
22318
22385
|
var _this_activeEditor;
|
|
22319
22386
|
(_this_activeEditor = this.activeEditor) !== null && _this_activeEditor !== void 0 ? _this_activeEditor : this.activeEditor = editor;
|
|
22320
|
-
|
|
22387
|
+
const focusHandler = ()=>{
|
|
22321
22388
|
this.activeEditor = editor;
|
|
22322
|
-
}
|
|
22389
|
+
};
|
|
22390
|
+
this.$editorEventHandlers[editor.id].focus = focusHandler;
|
|
22391
|
+
editor.on("focus", focusHandler);
|
|
22323
22392
|
if (this.options.functionality.documentHighlights) {
|
|
22324
22393
|
var $timer;
|
|
22325
|
-
|
|
22394
|
+
const changeSelectionForHighlights = ()=>{
|
|
22326
22395
|
if (!$timer) $timer = setTimeout(()=>{
|
|
22327
22396
|
let sessionLanguageProvider = this.$getSessionLanguageProvider(editor.session);
|
|
22328
22397
|
if (!sessionLanguageProvider) {
|
|
@@ -22333,7 +22402,9 @@ class LanguageProvider {
|
|
|
22333
22402
|
this.$messageController.findDocumentHighlights(this.$getFileName(editor.session), fromPoint(cursor), sessionLanguageProvider.$applyDocumentHighlight);
|
|
22334
22403
|
$timer = undefined;
|
|
22335
22404
|
}, 50);
|
|
22336
|
-
}
|
|
22405
|
+
};
|
|
22406
|
+
this.$editorEventHandlers[editor.id].changeSelectionForHighlights = changeSelectionForHighlights;
|
|
22407
|
+
editor.on("changeSelection", changeSelectionForHighlights);
|
|
22337
22408
|
}
|
|
22338
22409
|
if (this.options.functionality.codeActions) {
|
|
22339
22410
|
this.$provideCodeActions(editor);
|
|
@@ -22349,6 +22420,71 @@ class LanguageProvider {
|
|
|
22349
22420
|
}
|
|
22350
22421
|
this.setStyles(editor);
|
|
22351
22422
|
}
|
|
22423
|
+
$unregisterEditor(editor, cleanupSession = false) {
|
|
22424
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2;
|
|
22425
|
+
const editorIndex = this.editors.indexOf(editor);
|
|
22426
|
+
if (editorIndex > -1) {
|
|
22427
|
+
this.editors.splice(editorIndex, 1);
|
|
22428
|
+
}
|
|
22429
|
+
const handlers = this.$editorEventHandlers[editor.id];
|
|
22430
|
+
if (handlers) {
|
|
22431
|
+
if (handlers.changeSession) {
|
|
22432
|
+
editor.off("changeSession", handlers.changeSession);
|
|
22433
|
+
}
|
|
22434
|
+
if (handlers.focus) {
|
|
22435
|
+
editor.off("focus", handlers.focus);
|
|
22436
|
+
}
|
|
22437
|
+
if (handlers.changeSelectionForHighlights) {
|
|
22438
|
+
editor.off("changeSelection", handlers.changeSelectionForHighlights);
|
|
22439
|
+
}
|
|
22440
|
+
if (handlers.changeSelectionForCodeActions) {
|
|
22441
|
+
editor.off("changeSelection", handlers.changeSelectionForCodeActions);
|
|
22442
|
+
}
|
|
22443
|
+
if (handlers.afterExec) {
|
|
22444
|
+
editor.commands.off('afterExec', handlers.afterExec);
|
|
22445
|
+
}
|
|
22446
|
+
delete this.$editorEventHandlers[editor.id];
|
|
22447
|
+
}
|
|
22448
|
+
const originalState = this.$editorOriginalState[editor.id];
|
|
22449
|
+
if (originalState) {
|
|
22450
|
+
var _this_options_functionality3, _this_options_functionality4, _this_options_functionality5;
|
|
22451
|
+
if (((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.completion) && originalState.completers !== undefined) {
|
|
22452
|
+
editor.completers = originalState.completers;
|
|
22453
|
+
}
|
|
22454
|
+
if (((_this_options_functionality4 = this.options.functionality) === null || _this_options_functionality4 === void 0 ? void 0 : _this_options_functionality4.inlineCompletion) && originalState.inlineCompleters !== undefined) {
|
|
22455
|
+
editor.inlineCompleters = originalState.inlineCompleters;
|
|
22456
|
+
}
|
|
22457
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
22458
|
+
if (originalState.inlineAutocompleteCommand) {
|
|
22459
|
+
editor.commands.addCommand(originalState.inlineAutocompleteCommand);
|
|
22460
|
+
} else {
|
|
22461
|
+
try {
|
|
22462
|
+
editor.commands.removeCommand("startInlineAutocomplete");
|
|
22463
|
+
} catch (e) {}
|
|
22464
|
+
}
|
|
22465
|
+
}
|
|
22466
|
+
delete this.$editorOriginalState[editor.id];
|
|
22467
|
+
}
|
|
22468
|
+
if ((_this_options_functionality = this.options.functionality) === null || _this_options_functionality === void 0 ? void 0 : _this_options_functionality.signatureHelp) {
|
|
22469
|
+
this.$signatureTooltip.unregisterEditor(editor);
|
|
22470
|
+
}
|
|
22471
|
+
if (((_this_options_functionality1 = this.options.functionality) === null || _this_options_functionality1 === void 0 ? void 0 : _this_options_functionality1.hover) && this.$hoverTooltip) {
|
|
22472
|
+
this.$hoverTooltip.removeFromEditor(editor);
|
|
22473
|
+
}
|
|
22474
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.codeActions) {
|
|
22475
|
+
const lightBulb = this.$lightBulbWidgets[editor.id];
|
|
22476
|
+
if (lightBulb) {
|
|
22477
|
+
lightBulb.dispose();
|
|
22478
|
+
delete this.$lightBulbWidgets[editor.id];
|
|
22479
|
+
}
|
|
22480
|
+
}
|
|
22481
|
+
if (this.activeEditor === editor) {
|
|
22482
|
+
this.activeEditor = this.editors.length > 0 ? this.editors[0] : null;
|
|
22483
|
+
}
|
|
22484
|
+
if (cleanupSession && editor.session) {
|
|
22485
|
+
this.closeDocument(editor.session);
|
|
22486
|
+
}
|
|
22487
|
+
}
|
|
22352
22488
|
$provideCodeActions(editor) {
|
|
22353
22489
|
const lightBulb = new LightbulbWidget(editor);
|
|
22354
22490
|
this.$lightBulbWidgets[editor.id] = lightBulb;
|
|
@@ -22367,7 +22503,7 @@ class LanguageProvider {
|
|
|
22367
22503
|
}
|
|
22368
22504
|
});
|
|
22369
22505
|
var actionTimer;
|
|
22370
|
-
|
|
22506
|
+
const changeSelectionForCodeActions = ()=>{
|
|
22371
22507
|
if (!actionTimer) actionTimer = setTimeout(()=>{
|
|
22372
22508
|
if (!this.$getSessionLanguageProvider(editor.session)) {
|
|
22373
22509
|
actionTimer = undefined;
|
|
@@ -22385,7 +22521,9 @@ class LanguageProvider {
|
|
|
22385
22521
|
});
|
|
22386
22522
|
actionTimer = undefined;
|
|
22387
22523
|
}, 500);
|
|
22388
|
-
}
|
|
22524
|
+
};
|
|
22525
|
+
this.$editorEventHandlers[editor.id].changeSelectionForCodeActions = changeSelectionForCodeActions;
|
|
22526
|
+
editor.on("changeSelection", changeSelectionForCodeActions);
|
|
22389
22527
|
}
|
|
22390
22528
|
$initHoverTooltip(editor) {
|
|
22391
22529
|
const Range = editor.getSelectionRange().constructor;
|
|
@@ -22499,8 +22637,10 @@ class LanguageProvider {
|
|
|
22499
22637
|
}
|
|
22500
22638
|
getSemanticTokens() {
|
|
22501
22639
|
if (!this.options.functionality.semanticTokens) return;
|
|
22502
|
-
|
|
22503
|
-
|
|
22640
|
+
if (this.activeEditor) {
|
|
22641
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
22642
|
+
sessionLanguageProvider.getSemanticTokens();
|
|
22643
|
+
}
|
|
22504
22644
|
}
|
|
22505
22645
|
doComplete(editor, session, callback) {
|
|
22506
22646
|
let cursor = editor.getCursorPosition();
|
|
@@ -22514,16 +22654,27 @@ class LanguageProvider {
|
|
|
22514
22654
|
this.$messageController.doResolve(item["fileName"], toCompletionItem(item), callback);
|
|
22515
22655
|
}
|
|
22516
22656
|
$registerCompleters(editor) {
|
|
22517
|
-
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4,
|
|
22657
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4, _this_options, _this_options_functionality5;
|
|
22518
22658
|
let completer, inlineCompleter;
|
|
22519
22659
|
if (!((_this_options_functionality = this.options.functionality) === null || _this_options_functionality === void 0 ? void 0 : _this_options_functionality.completion) && !((_this_options_functionality1 = this.options.functionality) === null || _this_options_functionality1 === void 0 ? void 0 : _this_options_functionality1.inlineCompletion)) {
|
|
22520
22660
|
return;
|
|
22521
22661
|
}
|
|
22522
|
-
|
|
22523
|
-
|
|
22662
|
+
this.$editorOriginalState[editor.id] = {};
|
|
22663
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.completion) {
|
|
22664
|
+
this.$editorOriginalState[editor.id].completers = editor.completers ? [
|
|
22665
|
+
...editor.completers
|
|
22666
|
+
] : [];
|
|
22667
|
+
if (this.options.functionality.completion.overwriteCompleters) {
|
|
22668
|
+
editor.completers = [];
|
|
22669
|
+
}
|
|
22524
22670
|
}
|
|
22525
|
-
if ((
|
|
22526
|
-
editor.inlineCompleters = [
|
|
22671
|
+
if ((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.inlineCompletion) {
|
|
22672
|
+
this.$editorOriginalState[editor.id].inlineCompleters = editor.inlineCompleters ? [
|
|
22673
|
+
...editor.inlineCompleters
|
|
22674
|
+
] : [];
|
|
22675
|
+
if (this.options.functionality.inlineCompletion.overwriteCompleters) {
|
|
22676
|
+
editor.inlineCompleters = [];
|
|
22677
|
+
}
|
|
22527
22678
|
}
|
|
22528
22679
|
if (this.options.functionality.completion) {
|
|
22529
22680
|
completer = {
|
|
@@ -22569,7 +22720,7 @@ class LanguageProvider {
|
|
|
22569
22720
|
};
|
|
22570
22721
|
editor.completers.push(completer);
|
|
22571
22722
|
}
|
|
22572
|
-
if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : (
|
|
22723
|
+
if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : (_this_options_functionality4 = _this_options.functionality) === null || _this_options_functionality4 === void 0 ? void 0 : _this_options_functionality4.inlineCompletion) {
|
|
22573
22724
|
this.checkInlineCompletionAdapter(()=>{
|
|
22574
22725
|
if (this.completerAdapter) {
|
|
22575
22726
|
var _editor;
|
|
@@ -22581,7 +22732,9 @@ class LanguageProvider {
|
|
|
22581
22732
|
}
|
|
22582
22733
|
});
|
|
22583
22734
|
}
|
|
22584
|
-
if ((
|
|
22735
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
22736
|
+
const existingCommand = editor.commands.commands["startInlineAutocomplete"];
|
|
22737
|
+
this.$editorOriginalState[editor.id].inlineAutocompleteCommand = existingCommand || null;
|
|
22585
22738
|
editor.commands.addCommand({
|
|
22586
22739
|
name: "startInlineAutocomplete",
|
|
22587
22740
|
exec: (editor, options)=>{
|
|
@@ -22594,6 +22747,7 @@ class LanguageProvider {
|
|
|
22594
22747
|
mac: "Option-C"
|
|
22595
22748
|
}
|
|
22596
22749
|
});
|
|
22750
|
+
this.$editorEventHandlers[editor.id].afterExec = this.doLiveAutocomplete;
|
|
22597
22751
|
editor.commands.on('afterExec', this.doLiveAutocomplete);
|
|
22598
22752
|
inlineCompleter = {
|
|
22599
22753
|
getCompletions: async (editor, session, pos, prefix, callback)=>{
|
|
@@ -22621,13 +22775,14 @@ class LanguageProvider {
|
|
|
22621
22775
|
});
|
|
22622
22776
|
}
|
|
22623
22777
|
/**
|
|
22624
|
-
* Removes document from all linked services by session id
|
|
22625
|
-
*
|
|
22626
|
-
* @param
|
|
22778
|
+
* Removes document from all linked services by session id and cleans up all associated resources.
|
|
22779
|
+
* This includes removing event listeners, clearing marker groups, annotations, and notifying the server.
|
|
22780
|
+
* @param session - The Ace EditSession to close
|
|
22781
|
+
* @param [callback] - Optional callback to execute after the document is closed
|
|
22627
22782
|
*/ closeDocument(session, callback) {
|
|
22628
22783
|
let sessionProvider = this.$getSessionLanguageProvider(session);
|
|
22629
22784
|
if (sessionProvider) {
|
|
22630
|
-
sessionProvider.
|
|
22785
|
+
sessionProvider.dispose(callback);
|
|
22631
22786
|
delete this.$sessionLanguageProviders[session["id"]];
|
|
22632
22787
|
}
|
|
22633
22788
|
}
|
|
@@ -22669,6 +22824,8 @@ class LanguageProvider {
|
|
|
22669
22824
|
language_provider_define_property(this, "inlineCompleter", void 0);
|
|
22670
22825
|
language_provider_define_property(this, "doLiveAutocomplete", void 0);
|
|
22671
22826
|
language_provider_define_property(this, "completerAdapter", void 0);
|
|
22827
|
+
language_provider_define_property(this, "$editorEventHandlers", {});
|
|
22828
|
+
language_provider_define_property(this, "$editorOriginalState", {});
|
|
22672
22829
|
/**
|
|
22673
22830
|
* Registers a new editing session with the editor and associates it with a language provider.
|
|
22674
22831
|
* If a language provider for the specified editing session does not already exist, it initializes
|
|
@@ -22688,8 +22845,10 @@ class LanguageProvider {
|
|
|
22688
22845
|
language_provider_define_property(this, "codeActionCallback", void 0);
|
|
22689
22846
|
language_provider_define_property(this, "format", ()=>{
|
|
22690
22847
|
if (!this.options.functionality.format) return;
|
|
22691
|
-
|
|
22692
|
-
|
|
22848
|
+
if (this.activeEditor) {
|
|
22849
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
22850
|
+
sessionLanguageProvider.$sendDeltaQueue(sessionLanguageProvider.format);
|
|
22851
|
+
}
|
|
22693
22852
|
});
|
|
22694
22853
|
this.$messageController = new MessageController(worker, this);
|
|
22695
22854
|
this.setProviderOptions(options);
|
package/build/language-client.js
CHANGED
|
@@ -17960,11 +17960,31 @@ class LanguageClient extends base_service.BaseService {
|
|
|
17960
17960
|
}
|
|
17961
17961
|
async closeConnection() {
|
|
17962
17962
|
if (!this.connection) return;
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17963
|
+
try {
|
|
17964
|
+
Object.values(this.callbacks).forEach((callback)=>{
|
|
17965
|
+
if (typeof callback === 'function') {
|
|
17966
|
+
callback({
|
|
17967
|
+
error: 'Connection closed'
|
|
17968
|
+
});
|
|
17969
|
+
}
|
|
17970
|
+
});
|
|
17971
|
+
this.callbacks = {};
|
|
17972
|
+
if (this.isConnected) {
|
|
17973
|
+
await this.connection.sendRequest("shutdown");
|
|
17974
|
+
await this.connection.sendNotification('exit');
|
|
17975
|
+
}
|
|
17976
|
+
await this.dispose();
|
|
17977
|
+
if (this.socket && (this.socket.readyState === WebSocket.OPEN || this.socket.readyState === WebSocket.CONNECTING)) {
|
|
17978
|
+
this.socket.close();
|
|
17979
|
+
}
|
|
17980
|
+
this.isConnected = false;
|
|
17981
|
+
} catch (error) {
|
|
17982
|
+
language_client_console.error('Error closing connection:', error);
|
|
17983
|
+
this.isConnected = false;
|
|
17984
|
+
if (this.socket && this.socket.readyState !== WebSocket.CLOSED) {
|
|
17985
|
+
this.socket.close();
|
|
17986
|
+
}
|
|
17987
|
+
}
|
|
17968
17988
|
}
|
|
17969
17989
|
sendInitialize(initializationOptions) {
|
|
17970
17990
|
if (!this.isConnected) return;
|