ace-linters 1.8.5 → 1.8.7
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 +188 -25
- package/build/ace-linters.d.ts +27 -4
- package/build/ace-linters.js +188 -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);
|
|
@@ -21021,6 +21035,10 @@ class SignatureTooltip extends BaseTooltip {
|
|
|
21021
21035
|
this.provideSignatureHelp();
|
|
21022
21036
|
});
|
|
21023
21037
|
signature_tooltip_define_property(this, "provideSignatureHelp", ()=>{
|
|
21038
|
+
if (!this.$activeEditor) {
|
|
21039
|
+
// Editor was deactivated before this callback
|
|
21040
|
+
return;
|
|
21041
|
+
}
|
|
21024
21042
|
let cursor = this.$activeEditor.getCursorPosition();
|
|
21025
21043
|
let session = this.$activeEditor.session;
|
|
21026
21044
|
let docPos = session.screenToDocumentPosition(cursor.row, cursor.column);
|
|
@@ -21718,6 +21736,7 @@ class LightbulbWidget {
|
|
|
21718
21736
|
removeListeners() {
|
|
21719
21737
|
this.editor.off("changeSelection", this.hideAll);
|
|
21720
21738
|
this.editor.off("focus", this.hideAll);
|
|
21739
|
+
this.editor.renderer.off("afterRender", this.setPosition);
|
|
21721
21740
|
this.editor.session.off("changeScrollTop", this.setPosition);
|
|
21722
21741
|
this.editor.session.off("changeScrollLeft", this.setPosition);
|
|
21723
21742
|
}
|
|
@@ -21806,7 +21825,10 @@ class LightbulbWidget {
|
|
|
21806
21825
|
}
|
|
21807
21826
|
dispose() {
|
|
21808
21827
|
this.removeListeners();
|
|
21809
|
-
|
|
21828
|
+
if (this.lightbulb && this.lightbulb.parentNode) {
|
|
21829
|
+
this.lightbulb.parentNode.removeChild(this.lightbulb);
|
|
21830
|
+
}
|
|
21831
|
+
this.popup.destroy();
|
|
21810
21832
|
}
|
|
21811
21833
|
constructor(editor, executeActionCallback){
|
|
21812
21834
|
lightbulb_define_property(this, "codeActions", void 0);
|
|
@@ -22910,6 +22932,39 @@ class SessionLanguageProvider {
|
|
|
22910
22932
|
}, 20);
|
|
22911
22933
|
});
|
|
22912
22934
|
}
|
|
22935
|
+
/**
|
|
22936
|
+
* Disposes of the SessionLanguageProvider, cleaning up all event listeners,
|
|
22937
|
+
* marker groups, and notifying the server to close the document.
|
|
22938
|
+
* This method should be called when the session is no longer needed.
|
|
22939
|
+
*
|
|
22940
|
+
* @param callback - Optional callback to execute after the document is closed
|
|
22941
|
+
*/ dispose(callback) {
|
|
22942
|
+
this.session.doc.off("change", this.$changeListener);
|
|
22943
|
+
this.session.off("changeMode", this.$changeMode);
|
|
22944
|
+
if (this.$changeScrollTopHandler) {
|
|
22945
|
+
this.session.off("changeScrollTop", this.$changeScrollTopHandler);
|
|
22946
|
+
this.$changeScrollTopHandler = undefined;
|
|
22947
|
+
}
|
|
22948
|
+
if (this.state.occurrenceMarkers) {
|
|
22949
|
+
this.state.occurrenceMarkers.setMarkers([]);
|
|
22950
|
+
this.state.occurrenceMarkers = null;
|
|
22951
|
+
}
|
|
22952
|
+
if (this.state.diagnosticMarkers) {
|
|
22953
|
+
this.state.diagnosticMarkers.setMarkers([]);
|
|
22954
|
+
this.state.diagnosticMarkers = null;
|
|
22955
|
+
}
|
|
22956
|
+
this.session.clearAnnotations();
|
|
22957
|
+
if (this.session.setSemanticTokens) {
|
|
22958
|
+
this.session.setSemanticTokens(undefined);
|
|
22959
|
+
}
|
|
22960
|
+
this.$deltaQueue = null;
|
|
22961
|
+
this.$requestsQueue = [];
|
|
22962
|
+
if (this.documentUri) {
|
|
22963
|
+
delete this.$provider.$urisToSessionsIds[this.documentUri];
|
|
22964
|
+
}
|
|
22965
|
+
this.$isConnected = false;
|
|
22966
|
+
this.closeDocument(callback);
|
|
22967
|
+
}
|
|
22913
22968
|
closeDocument(callback) {
|
|
22914
22969
|
this.$messageController.closeDocument(this.comboDocumentIdentifier, callback);
|
|
22915
22970
|
}
|
|
@@ -22942,6 +22997,7 @@ class SessionLanguageProvider {
|
|
|
22942
22997
|
session_language_provider_define_property(this, "editor", void 0);
|
|
22943
22998
|
session_language_provider_define_property(this, "semanticTokensLegend", void 0);
|
|
22944
22999
|
session_language_provider_define_property(this, "$provider", void 0);
|
|
23000
|
+
session_language_provider_define_property(this, "$changeScrollTopHandler", void 0);
|
|
22945
23001
|
session_language_provider_define_property(this, "$connected", (capabilities)=>{
|
|
22946
23002
|
this.$isConnected = true;
|
|
22947
23003
|
this.setServerCapabilities(capabilities);
|
|
@@ -23095,7 +23151,8 @@ class SessionLanguageProvider {
|
|
|
23095
23151
|
this.addSemanticTokenSupport(session); //TODO: ?
|
|
23096
23152
|
session.on("changeMode", this.$changeMode);
|
|
23097
23153
|
if (this.$provider.options.functionality.semanticTokens) {
|
|
23098
|
-
|
|
23154
|
+
this.$changeScrollTopHandler = ()=>this.getSemanticTokens();
|
|
23155
|
+
session.on("changeScrollTop", this.$changeScrollTopHandler);
|
|
23099
23156
|
}
|
|
23100
23157
|
this.$init(config);
|
|
23101
23158
|
}
|
|
@@ -23251,6 +23308,17 @@ class LanguageProvider {
|
|
|
23251
23308
|
config = config !== null && config !== void 0 ? config : editor.session.lspConfig;
|
|
23252
23309
|
this.registerSession(editor.session, editor, config);
|
|
23253
23310
|
}
|
|
23311
|
+
/**
|
|
23312
|
+
* Unregisters an Ace editor instance, removing all event listeners, completers, tooltips,
|
|
23313
|
+
* and cleaning up associated resources. This is the counterpart to registerEditor.
|
|
23314
|
+
*
|
|
23315
|
+
* @param editor - The Ace editor instance to be unregistered.
|
|
23316
|
+
* @param cleanupSession - Optional flag to also dispose the current session. When true,
|
|
23317
|
+
* calls closeDocument on the editor's session, cleaning up all
|
|
23318
|
+
* session-related resources. Default: false.
|
|
23319
|
+
*/ unregisterEditor(editor, cleanupSession = false) {
|
|
23320
|
+
if (this.editors.includes(editor)) this.$unregisterEditor(editor, cleanupSession);
|
|
23321
|
+
}
|
|
23254
23322
|
/**
|
|
23255
23323
|
* Sets a callback function that will be triggered with an array of code actions grouped by service.
|
|
23256
23324
|
*
|
|
@@ -23318,20 +23386,25 @@ class LanguageProvider {
|
|
|
23318
23386
|
AceVirtualRenderer.getConstructor(editor);
|
|
23319
23387
|
AceEditor.getConstructor(editor);
|
|
23320
23388
|
editor.setOption("useWorker", false);
|
|
23389
|
+
this.$editorEventHandlers[editor.id] = {};
|
|
23321
23390
|
if (!this.options.manualSessionControl) {
|
|
23322
|
-
|
|
23391
|
+
const changeSessionHandler = ({ session })=>this.registerSession(session, editor, session.lspConfig);
|
|
23392
|
+
this.$editorEventHandlers[editor.id].changeSession = changeSessionHandler;
|
|
23393
|
+
editor.on("changeSession", changeSessionHandler);
|
|
23323
23394
|
}
|
|
23324
23395
|
if (this.options.functionality.completion || this.options.functionality.inlineCompletion) {
|
|
23325
23396
|
this.$registerCompleters(editor);
|
|
23326
23397
|
}
|
|
23327
23398
|
var _this_activeEditor;
|
|
23328
23399
|
(_this_activeEditor = this.activeEditor) !== null && _this_activeEditor !== void 0 ? _this_activeEditor : this.activeEditor = editor;
|
|
23329
|
-
|
|
23400
|
+
const focusHandler = ()=>{
|
|
23330
23401
|
this.activeEditor = editor;
|
|
23331
|
-
}
|
|
23402
|
+
};
|
|
23403
|
+
this.$editorEventHandlers[editor.id].focus = focusHandler;
|
|
23404
|
+
editor.on("focus", focusHandler);
|
|
23332
23405
|
if (this.options.functionality.documentHighlights) {
|
|
23333
23406
|
var $timer;
|
|
23334
|
-
|
|
23407
|
+
const changeSelectionForHighlights = ()=>{
|
|
23335
23408
|
if (!$timer) $timer = setTimeout(()=>{
|
|
23336
23409
|
let sessionLanguageProvider = this.$getSessionLanguageProvider(editor.session);
|
|
23337
23410
|
if (!sessionLanguageProvider) {
|
|
@@ -23342,7 +23415,9 @@ class LanguageProvider {
|
|
|
23342
23415
|
this.$messageController.findDocumentHighlights(this.$getFileName(editor.session), fromPoint(cursor), sessionLanguageProvider.$applyDocumentHighlight);
|
|
23343
23416
|
$timer = undefined;
|
|
23344
23417
|
}, 50);
|
|
23345
|
-
}
|
|
23418
|
+
};
|
|
23419
|
+
this.$editorEventHandlers[editor.id].changeSelectionForHighlights = changeSelectionForHighlights;
|
|
23420
|
+
editor.on("changeSelection", changeSelectionForHighlights);
|
|
23346
23421
|
}
|
|
23347
23422
|
if (this.options.functionality.codeActions) {
|
|
23348
23423
|
this.$provideCodeActions(editor);
|
|
@@ -23358,6 +23433,71 @@ class LanguageProvider {
|
|
|
23358
23433
|
}
|
|
23359
23434
|
this.setStyles(editor);
|
|
23360
23435
|
}
|
|
23436
|
+
$unregisterEditor(editor, cleanupSession = false) {
|
|
23437
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2;
|
|
23438
|
+
const editorIndex = this.editors.indexOf(editor);
|
|
23439
|
+
if (editorIndex > -1) {
|
|
23440
|
+
this.editors.splice(editorIndex, 1);
|
|
23441
|
+
}
|
|
23442
|
+
const handlers = this.$editorEventHandlers[editor.id];
|
|
23443
|
+
if (handlers) {
|
|
23444
|
+
if (handlers.changeSession) {
|
|
23445
|
+
editor.off("changeSession", handlers.changeSession);
|
|
23446
|
+
}
|
|
23447
|
+
if (handlers.focus) {
|
|
23448
|
+
editor.off("focus", handlers.focus);
|
|
23449
|
+
}
|
|
23450
|
+
if (handlers.changeSelectionForHighlights) {
|
|
23451
|
+
editor.off("changeSelection", handlers.changeSelectionForHighlights);
|
|
23452
|
+
}
|
|
23453
|
+
if (handlers.changeSelectionForCodeActions) {
|
|
23454
|
+
editor.off("changeSelection", handlers.changeSelectionForCodeActions);
|
|
23455
|
+
}
|
|
23456
|
+
if (handlers.afterExec) {
|
|
23457
|
+
editor.commands.off('afterExec', handlers.afterExec);
|
|
23458
|
+
}
|
|
23459
|
+
delete this.$editorEventHandlers[editor.id];
|
|
23460
|
+
}
|
|
23461
|
+
const originalState = this.$editorOriginalState[editor.id];
|
|
23462
|
+
if (originalState) {
|
|
23463
|
+
var _this_options_functionality3, _this_options_functionality4, _this_options_functionality5;
|
|
23464
|
+
if (((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.completion) && originalState.completers !== undefined) {
|
|
23465
|
+
editor.completers = originalState.completers;
|
|
23466
|
+
}
|
|
23467
|
+
if (((_this_options_functionality4 = this.options.functionality) === null || _this_options_functionality4 === void 0 ? void 0 : _this_options_functionality4.inlineCompletion) && originalState.inlineCompleters !== undefined) {
|
|
23468
|
+
editor.inlineCompleters = originalState.inlineCompleters;
|
|
23469
|
+
}
|
|
23470
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
23471
|
+
if (originalState.inlineAutocompleteCommand) {
|
|
23472
|
+
editor.commands.addCommand(originalState.inlineAutocompleteCommand);
|
|
23473
|
+
} else {
|
|
23474
|
+
try {
|
|
23475
|
+
editor.commands.removeCommand("startInlineAutocomplete");
|
|
23476
|
+
} catch (e) {}
|
|
23477
|
+
}
|
|
23478
|
+
}
|
|
23479
|
+
delete this.$editorOriginalState[editor.id];
|
|
23480
|
+
}
|
|
23481
|
+
if ((_this_options_functionality = this.options.functionality) === null || _this_options_functionality === void 0 ? void 0 : _this_options_functionality.signatureHelp) {
|
|
23482
|
+
this.$signatureTooltip.unregisterEditor(editor);
|
|
23483
|
+
}
|
|
23484
|
+
if (((_this_options_functionality1 = this.options.functionality) === null || _this_options_functionality1 === void 0 ? void 0 : _this_options_functionality1.hover) && this.$hoverTooltip) {
|
|
23485
|
+
this.$hoverTooltip.removeFromEditor(editor);
|
|
23486
|
+
}
|
|
23487
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.codeActions) {
|
|
23488
|
+
const lightBulb = this.$lightBulbWidgets[editor.id];
|
|
23489
|
+
if (lightBulb) {
|
|
23490
|
+
lightBulb.dispose();
|
|
23491
|
+
delete this.$lightBulbWidgets[editor.id];
|
|
23492
|
+
}
|
|
23493
|
+
}
|
|
23494
|
+
if (this.activeEditor === editor) {
|
|
23495
|
+
this.activeEditor = this.editors.length > 0 ? this.editors[0] : null;
|
|
23496
|
+
}
|
|
23497
|
+
if (cleanupSession && editor.session) {
|
|
23498
|
+
this.closeDocument(editor.session);
|
|
23499
|
+
}
|
|
23500
|
+
}
|
|
23361
23501
|
$provideCodeActions(editor) {
|
|
23362
23502
|
const lightBulb = new LightbulbWidget(editor);
|
|
23363
23503
|
this.$lightBulbWidgets[editor.id] = lightBulb;
|
|
@@ -23376,7 +23516,7 @@ class LanguageProvider {
|
|
|
23376
23516
|
}
|
|
23377
23517
|
});
|
|
23378
23518
|
var actionTimer;
|
|
23379
|
-
|
|
23519
|
+
const changeSelectionForCodeActions = ()=>{
|
|
23380
23520
|
if (!actionTimer) actionTimer = setTimeout(()=>{
|
|
23381
23521
|
if (!this.$getSessionLanguageProvider(editor.session)) {
|
|
23382
23522
|
actionTimer = undefined;
|
|
@@ -23394,7 +23534,9 @@ class LanguageProvider {
|
|
|
23394
23534
|
});
|
|
23395
23535
|
actionTimer = undefined;
|
|
23396
23536
|
}, 500);
|
|
23397
|
-
}
|
|
23537
|
+
};
|
|
23538
|
+
this.$editorEventHandlers[editor.id].changeSelectionForCodeActions = changeSelectionForCodeActions;
|
|
23539
|
+
editor.on("changeSelection", changeSelectionForCodeActions);
|
|
23398
23540
|
}
|
|
23399
23541
|
$initHoverTooltip(editor) {
|
|
23400
23542
|
const Range = editor.getSelectionRange().constructor;
|
|
@@ -23508,8 +23650,10 @@ class LanguageProvider {
|
|
|
23508
23650
|
}
|
|
23509
23651
|
getSemanticTokens() {
|
|
23510
23652
|
if (!this.options.functionality.semanticTokens) return;
|
|
23511
|
-
|
|
23512
|
-
|
|
23653
|
+
if (this.activeEditor) {
|
|
23654
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
23655
|
+
sessionLanguageProvider.getSemanticTokens();
|
|
23656
|
+
}
|
|
23513
23657
|
}
|
|
23514
23658
|
doComplete(editor, session, callback) {
|
|
23515
23659
|
let cursor = editor.getCursorPosition();
|
|
@@ -23523,16 +23667,27 @@ class LanguageProvider {
|
|
|
23523
23667
|
this.$messageController.doResolve(item["fileName"], toCompletionItem(item), callback);
|
|
23524
23668
|
}
|
|
23525
23669
|
$registerCompleters(editor) {
|
|
23526
|
-
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4,
|
|
23670
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4, _this_options, _this_options_functionality5;
|
|
23527
23671
|
let completer, inlineCompleter;
|
|
23528
23672
|
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
23673
|
return;
|
|
23530
23674
|
}
|
|
23531
|
-
|
|
23532
|
-
|
|
23675
|
+
this.$editorOriginalState[editor.id] = {};
|
|
23676
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.completion) {
|
|
23677
|
+
this.$editorOriginalState[editor.id].completers = editor.completers ? [
|
|
23678
|
+
...editor.completers
|
|
23679
|
+
] : [];
|
|
23680
|
+
if (this.options.functionality.completion.overwriteCompleters) {
|
|
23681
|
+
editor.completers = [];
|
|
23682
|
+
}
|
|
23533
23683
|
}
|
|
23534
|
-
if ((
|
|
23535
|
-
editor.inlineCompleters = [
|
|
23684
|
+
if ((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.inlineCompletion) {
|
|
23685
|
+
this.$editorOriginalState[editor.id].inlineCompleters = editor.inlineCompleters ? [
|
|
23686
|
+
...editor.inlineCompleters
|
|
23687
|
+
] : [];
|
|
23688
|
+
if (this.options.functionality.inlineCompletion.overwriteCompleters) {
|
|
23689
|
+
editor.inlineCompleters = [];
|
|
23690
|
+
}
|
|
23536
23691
|
}
|
|
23537
23692
|
if (this.options.functionality.completion) {
|
|
23538
23693
|
completer = {
|
|
@@ -23578,7 +23733,7 @@ class LanguageProvider {
|
|
|
23578
23733
|
};
|
|
23579
23734
|
editor.completers.push(completer);
|
|
23580
23735
|
}
|
|
23581
|
-
if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : (
|
|
23736
|
+
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
23737
|
this.checkInlineCompletionAdapter(()=>{
|
|
23583
23738
|
if (this.completerAdapter) {
|
|
23584
23739
|
var _editor;
|
|
@@ -23590,7 +23745,9 @@ class LanguageProvider {
|
|
|
23590
23745
|
}
|
|
23591
23746
|
});
|
|
23592
23747
|
}
|
|
23593
|
-
if ((
|
|
23748
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
23749
|
+
const existingCommand = editor.commands.commands["startInlineAutocomplete"];
|
|
23750
|
+
this.$editorOriginalState[editor.id].inlineAutocompleteCommand = existingCommand || null;
|
|
23594
23751
|
editor.commands.addCommand({
|
|
23595
23752
|
name: "startInlineAutocomplete",
|
|
23596
23753
|
exec: (editor, options)=>{
|
|
@@ -23603,6 +23760,7 @@ class LanguageProvider {
|
|
|
23603
23760
|
mac: "Option-C"
|
|
23604
23761
|
}
|
|
23605
23762
|
});
|
|
23763
|
+
this.$editorEventHandlers[editor.id].afterExec = this.doLiveAutocomplete;
|
|
23606
23764
|
editor.commands.on('afterExec', this.doLiveAutocomplete);
|
|
23607
23765
|
inlineCompleter = {
|
|
23608
23766
|
getCompletions: async (editor, session, pos, prefix, callback)=>{
|
|
@@ -23630,13 +23788,14 @@ class LanguageProvider {
|
|
|
23630
23788
|
});
|
|
23631
23789
|
}
|
|
23632
23790
|
/**
|
|
23633
|
-
* Removes document from all linked services by session id
|
|
23634
|
-
*
|
|
23635
|
-
* @param
|
|
23791
|
+
* Removes document from all linked services by session id and cleans up all associated resources.
|
|
23792
|
+
* This includes removing event listeners, clearing marker groups, annotations, and notifying the server.
|
|
23793
|
+
* @param session - The Ace EditSession to close
|
|
23794
|
+
* @param [callback] - Optional callback to execute after the document is closed
|
|
23636
23795
|
*/ closeDocument(session, callback) {
|
|
23637
23796
|
let sessionProvider = this.$getSessionLanguageProvider(session);
|
|
23638
23797
|
if (sessionProvider) {
|
|
23639
|
-
sessionProvider.
|
|
23798
|
+
sessionProvider.dispose(callback);
|
|
23640
23799
|
delete this.$sessionLanguageProviders[session["id"]];
|
|
23641
23800
|
}
|
|
23642
23801
|
}
|
|
@@ -23678,6 +23837,8 @@ class LanguageProvider {
|
|
|
23678
23837
|
language_provider_define_property(this, "inlineCompleter", void 0);
|
|
23679
23838
|
language_provider_define_property(this, "doLiveAutocomplete", void 0);
|
|
23680
23839
|
language_provider_define_property(this, "completerAdapter", void 0);
|
|
23840
|
+
language_provider_define_property(this, "$editorEventHandlers", {});
|
|
23841
|
+
language_provider_define_property(this, "$editorOriginalState", {});
|
|
23681
23842
|
/**
|
|
23682
23843
|
* Registers a new editing session with the editor and associates it with a language provider.
|
|
23683
23844
|
* If a language provider for the specified editing session does not already exist, it initializes
|
|
@@ -23697,8 +23858,10 @@ class LanguageProvider {
|
|
|
23697
23858
|
language_provider_define_property(this, "codeActionCallback", void 0);
|
|
23698
23859
|
language_provider_define_property(this, "format", ()=>{
|
|
23699
23860
|
if (!this.options.functionality.format) return;
|
|
23700
|
-
|
|
23701
|
-
|
|
23861
|
+
if (this.activeEditor) {
|
|
23862
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
23863
|
+
sessionLanguageProvider.$sendDeltaQueue(sessionLanguageProvider.format);
|
|
23864
|
+
}
|
|
23702
23865
|
});
|
|
23703
23866
|
this.$messageController = new MessageController(worker, this);
|
|
23704
23867
|
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);
|
|
@@ -20012,6 +20026,10 @@ class SignatureTooltip extends BaseTooltip {
|
|
|
20012
20026
|
this.provideSignatureHelp();
|
|
20013
20027
|
});
|
|
20014
20028
|
signature_tooltip_define_property(this, "provideSignatureHelp", ()=>{
|
|
20029
|
+
if (!this.$activeEditor) {
|
|
20030
|
+
// Editor was deactivated before this callback
|
|
20031
|
+
return;
|
|
20032
|
+
}
|
|
20015
20033
|
let cursor = this.$activeEditor.getCursorPosition();
|
|
20016
20034
|
let session = this.$activeEditor.session;
|
|
20017
20035
|
let docPos = session.screenToDocumentPosition(cursor.row, cursor.column);
|
|
@@ -20709,6 +20727,7 @@ class LightbulbWidget {
|
|
|
20709
20727
|
removeListeners() {
|
|
20710
20728
|
this.editor.off("changeSelection", this.hideAll);
|
|
20711
20729
|
this.editor.off("focus", this.hideAll);
|
|
20730
|
+
this.editor.renderer.off("afterRender", this.setPosition);
|
|
20712
20731
|
this.editor.session.off("changeScrollTop", this.setPosition);
|
|
20713
20732
|
this.editor.session.off("changeScrollLeft", this.setPosition);
|
|
20714
20733
|
}
|
|
@@ -20797,7 +20816,10 @@ class LightbulbWidget {
|
|
|
20797
20816
|
}
|
|
20798
20817
|
dispose() {
|
|
20799
20818
|
this.removeListeners();
|
|
20800
|
-
|
|
20819
|
+
if (this.lightbulb && this.lightbulb.parentNode) {
|
|
20820
|
+
this.lightbulb.parentNode.removeChild(this.lightbulb);
|
|
20821
|
+
}
|
|
20822
|
+
this.popup.destroy();
|
|
20801
20823
|
}
|
|
20802
20824
|
constructor(editor, executeActionCallback){
|
|
20803
20825
|
lightbulb_define_property(this, "codeActions", void 0);
|
|
@@ -21901,6 +21923,39 @@ class SessionLanguageProvider {
|
|
|
21901
21923
|
}, 20);
|
|
21902
21924
|
});
|
|
21903
21925
|
}
|
|
21926
|
+
/**
|
|
21927
|
+
* Disposes of the SessionLanguageProvider, cleaning up all event listeners,
|
|
21928
|
+
* marker groups, and notifying the server to close the document.
|
|
21929
|
+
* This method should be called when the session is no longer needed.
|
|
21930
|
+
*
|
|
21931
|
+
* @param callback - Optional callback to execute after the document is closed
|
|
21932
|
+
*/ dispose(callback) {
|
|
21933
|
+
this.session.doc.off("change", this.$changeListener);
|
|
21934
|
+
this.session.off("changeMode", this.$changeMode);
|
|
21935
|
+
if (this.$changeScrollTopHandler) {
|
|
21936
|
+
this.session.off("changeScrollTop", this.$changeScrollTopHandler);
|
|
21937
|
+
this.$changeScrollTopHandler = undefined;
|
|
21938
|
+
}
|
|
21939
|
+
if (this.state.occurrenceMarkers) {
|
|
21940
|
+
this.state.occurrenceMarkers.setMarkers([]);
|
|
21941
|
+
this.state.occurrenceMarkers = null;
|
|
21942
|
+
}
|
|
21943
|
+
if (this.state.diagnosticMarkers) {
|
|
21944
|
+
this.state.diagnosticMarkers.setMarkers([]);
|
|
21945
|
+
this.state.diagnosticMarkers = null;
|
|
21946
|
+
}
|
|
21947
|
+
this.session.clearAnnotations();
|
|
21948
|
+
if (this.session.setSemanticTokens) {
|
|
21949
|
+
this.session.setSemanticTokens(undefined);
|
|
21950
|
+
}
|
|
21951
|
+
this.$deltaQueue = null;
|
|
21952
|
+
this.$requestsQueue = [];
|
|
21953
|
+
if (this.documentUri) {
|
|
21954
|
+
delete this.$provider.$urisToSessionsIds[this.documentUri];
|
|
21955
|
+
}
|
|
21956
|
+
this.$isConnected = false;
|
|
21957
|
+
this.closeDocument(callback);
|
|
21958
|
+
}
|
|
21904
21959
|
closeDocument(callback) {
|
|
21905
21960
|
this.$messageController.closeDocument(this.comboDocumentIdentifier, callback);
|
|
21906
21961
|
}
|
|
@@ -21933,6 +21988,7 @@ class SessionLanguageProvider {
|
|
|
21933
21988
|
session_language_provider_define_property(this, "editor", void 0);
|
|
21934
21989
|
session_language_provider_define_property(this, "semanticTokensLegend", void 0);
|
|
21935
21990
|
session_language_provider_define_property(this, "$provider", void 0);
|
|
21991
|
+
session_language_provider_define_property(this, "$changeScrollTopHandler", void 0);
|
|
21936
21992
|
session_language_provider_define_property(this, "$connected", (capabilities)=>{
|
|
21937
21993
|
this.$isConnected = true;
|
|
21938
21994
|
this.setServerCapabilities(capabilities);
|
|
@@ -22086,7 +22142,8 @@ class SessionLanguageProvider {
|
|
|
22086
22142
|
this.addSemanticTokenSupport(session); //TODO: ?
|
|
22087
22143
|
session.on("changeMode", this.$changeMode);
|
|
22088
22144
|
if (this.$provider.options.functionality.semanticTokens) {
|
|
22089
|
-
|
|
22145
|
+
this.$changeScrollTopHandler = ()=>this.getSemanticTokens();
|
|
22146
|
+
session.on("changeScrollTop", this.$changeScrollTopHandler);
|
|
22090
22147
|
}
|
|
22091
22148
|
this.$init(config);
|
|
22092
22149
|
}
|
|
@@ -22242,6 +22299,17 @@ class LanguageProvider {
|
|
|
22242
22299
|
config = config !== null && config !== void 0 ? config : editor.session.lspConfig;
|
|
22243
22300
|
this.registerSession(editor.session, editor, config);
|
|
22244
22301
|
}
|
|
22302
|
+
/**
|
|
22303
|
+
* Unregisters an Ace editor instance, removing all event listeners, completers, tooltips,
|
|
22304
|
+
* and cleaning up associated resources. This is the counterpart to registerEditor.
|
|
22305
|
+
*
|
|
22306
|
+
* @param editor - The Ace editor instance to be unregistered.
|
|
22307
|
+
* @param cleanupSession - Optional flag to also dispose the current session. When true,
|
|
22308
|
+
* calls closeDocument on the editor's session, cleaning up all
|
|
22309
|
+
* session-related resources. Default: false.
|
|
22310
|
+
*/ unregisterEditor(editor, cleanupSession = false) {
|
|
22311
|
+
if (this.editors.includes(editor)) this.$unregisterEditor(editor, cleanupSession);
|
|
22312
|
+
}
|
|
22245
22313
|
/**
|
|
22246
22314
|
* Sets a callback function that will be triggered with an array of code actions grouped by service.
|
|
22247
22315
|
*
|
|
@@ -22309,20 +22377,25 @@ class LanguageProvider {
|
|
|
22309
22377
|
AceVirtualRenderer.getConstructor(editor);
|
|
22310
22378
|
AceEditor.getConstructor(editor);
|
|
22311
22379
|
editor.setOption("useWorker", false);
|
|
22380
|
+
this.$editorEventHandlers[editor.id] = {};
|
|
22312
22381
|
if (!this.options.manualSessionControl) {
|
|
22313
|
-
|
|
22382
|
+
const changeSessionHandler = ({ session })=>this.registerSession(session, editor, session.lspConfig);
|
|
22383
|
+
this.$editorEventHandlers[editor.id].changeSession = changeSessionHandler;
|
|
22384
|
+
editor.on("changeSession", changeSessionHandler);
|
|
22314
22385
|
}
|
|
22315
22386
|
if (this.options.functionality.completion || this.options.functionality.inlineCompletion) {
|
|
22316
22387
|
this.$registerCompleters(editor);
|
|
22317
22388
|
}
|
|
22318
22389
|
var _this_activeEditor;
|
|
22319
22390
|
(_this_activeEditor = this.activeEditor) !== null && _this_activeEditor !== void 0 ? _this_activeEditor : this.activeEditor = editor;
|
|
22320
|
-
|
|
22391
|
+
const focusHandler = ()=>{
|
|
22321
22392
|
this.activeEditor = editor;
|
|
22322
|
-
}
|
|
22393
|
+
};
|
|
22394
|
+
this.$editorEventHandlers[editor.id].focus = focusHandler;
|
|
22395
|
+
editor.on("focus", focusHandler);
|
|
22323
22396
|
if (this.options.functionality.documentHighlights) {
|
|
22324
22397
|
var $timer;
|
|
22325
|
-
|
|
22398
|
+
const changeSelectionForHighlights = ()=>{
|
|
22326
22399
|
if (!$timer) $timer = setTimeout(()=>{
|
|
22327
22400
|
let sessionLanguageProvider = this.$getSessionLanguageProvider(editor.session);
|
|
22328
22401
|
if (!sessionLanguageProvider) {
|
|
@@ -22333,7 +22406,9 @@ class LanguageProvider {
|
|
|
22333
22406
|
this.$messageController.findDocumentHighlights(this.$getFileName(editor.session), fromPoint(cursor), sessionLanguageProvider.$applyDocumentHighlight);
|
|
22334
22407
|
$timer = undefined;
|
|
22335
22408
|
}, 50);
|
|
22336
|
-
}
|
|
22409
|
+
};
|
|
22410
|
+
this.$editorEventHandlers[editor.id].changeSelectionForHighlights = changeSelectionForHighlights;
|
|
22411
|
+
editor.on("changeSelection", changeSelectionForHighlights);
|
|
22337
22412
|
}
|
|
22338
22413
|
if (this.options.functionality.codeActions) {
|
|
22339
22414
|
this.$provideCodeActions(editor);
|
|
@@ -22349,6 +22424,71 @@ class LanguageProvider {
|
|
|
22349
22424
|
}
|
|
22350
22425
|
this.setStyles(editor);
|
|
22351
22426
|
}
|
|
22427
|
+
$unregisterEditor(editor, cleanupSession = false) {
|
|
22428
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2;
|
|
22429
|
+
const editorIndex = this.editors.indexOf(editor);
|
|
22430
|
+
if (editorIndex > -1) {
|
|
22431
|
+
this.editors.splice(editorIndex, 1);
|
|
22432
|
+
}
|
|
22433
|
+
const handlers = this.$editorEventHandlers[editor.id];
|
|
22434
|
+
if (handlers) {
|
|
22435
|
+
if (handlers.changeSession) {
|
|
22436
|
+
editor.off("changeSession", handlers.changeSession);
|
|
22437
|
+
}
|
|
22438
|
+
if (handlers.focus) {
|
|
22439
|
+
editor.off("focus", handlers.focus);
|
|
22440
|
+
}
|
|
22441
|
+
if (handlers.changeSelectionForHighlights) {
|
|
22442
|
+
editor.off("changeSelection", handlers.changeSelectionForHighlights);
|
|
22443
|
+
}
|
|
22444
|
+
if (handlers.changeSelectionForCodeActions) {
|
|
22445
|
+
editor.off("changeSelection", handlers.changeSelectionForCodeActions);
|
|
22446
|
+
}
|
|
22447
|
+
if (handlers.afterExec) {
|
|
22448
|
+
editor.commands.off('afterExec', handlers.afterExec);
|
|
22449
|
+
}
|
|
22450
|
+
delete this.$editorEventHandlers[editor.id];
|
|
22451
|
+
}
|
|
22452
|
+
const originalState = this.$editorOriginalState[editor.id];
|
|
22453
|
+
if (originalState) {
|
|
22454
|
+
var _this_options_functionality3, _this_options_functionality4, _this_options_functionality5;
|
|
22455
|
+
if (((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.completion) && originalState.completers !== undefined) {
|
|
22456
|
+
editor.completers = originalState.completers;
|
|
22457
|
+
}
|
|
22458
|
+
if (((_this_options_functionality4 = this.options.functionality) === null || _this_options_functionality4 === void 0 ? void 0 : _this_options_functionality4.inlineCompletion) && originalState.inlineCompleters !== undefined) {
|
|
22459
|
+
editor.inlineCompleters = originalState.inlineCompleters;
|
|
22460
|
+
}
|
|
22461
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
22462
|
+
if (originalState.inlineAutocompleteCommand) {
|
|
22463
|
+
editor.commands.addCommand(originalState.inlineAutocompleteCommand);
|
|
22464
|
+
} else {
|
|
22465
|
+
try {
|
|
22466
|
+
editor.commands.removeCommand("startInlineAutocomplete");
|
|
22467
|
+
} catch (e) {}
|
|
22468
|
+
}
|
|
22469
|
+
}
|
|
22470
|
+
delete this.$editorOriginalState[editor.id];
|
|
22471
|
+
}
|
|
22472
|
+
if ((_this_options_functionality = this.options.functionality) === null || _this_options_functionality === void 0 ? void 0 : _this_options_functionality.signatureHelp) {
|
|
22473
|
+
this.$signatureTooltip.unregisterEditor(editor);
|
|
22474
|
+
}
|
|
22475
|
+
if (((_this_options_functionality1 = this.options.functionality) === null || _this_options_functionality1 === void 0 ? void 0 : _this_options_functionality1.hover) && this.$hoverTooltip) {
|
|
22476
|
+
this.$hoverTooltip.removeFromEditor(editor);
|
|
22477
|
+
}
|
|
22478
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.codeActions) {
|
|
22479
|
+
const lightBulb = this.$lightBulbWidgets[editor.id];
|
|
22480
|
+
if (lightBulb) {
|
|
22481
|
+
lightBulb.dispose();
|
|
22482
|
+
delete this.$lightBulbWidgets[editor.id];
|
|
22483
|
+
}
|
|
22484
|
+
}
|
|
22485
|
+
if (this.activeEditor === editor) {
|
|
22486
|
+
this.activeEditor = this.editors.length > 0 ? this.editors[0] : null;
|
|
22487
|
+
}
|
|
22488
|
+
if (cleanupSession && editor.session) {
|
|
22489
|
+
this.closeDocument(editor.session);
|
|
22490
|
+
}
|
|
22491
|
+
}
|
|
22352
22492
|
$provideCodeActions(editor) {
|
|
22353
22493
|
const lightBulb = new LightbulbWidget(editor);
|
|
22354
22494
|
this.$lightBulbWidgets[editor.id] = lightBulb;
|
|
@@ -22367,7 +22507,7 @@ class LanguageProvider {
|
|
|
22367
22507
|
}
|
|
22368
22508
|
});
|
|
22369
22509
|
var actionTimer;
|
|
22370
|
-
|
|
22510
|
+
const changeSelectionForCodeActions = ()=>{
|
|
22371
22511
|
if (!actionTimer) actionTimer = setTimeout(()=>{
|
|
22372
22512
|
if (!this.$getSessionLanguageProvider(editor.session)) {
|
|
22373
22513
|
actionTimer = undefined;
|
|
@@ -22385,7 +22525,9 @@ class LanguageProvider {
|
|
|
22385
22525
|
});
|
|
22386
22526
|
actionTimer = undefined;
|
|
22387
22527
|
}, 500);
|
|
22388
|
-
}
|
|
22528
|
+
};
|
|
22529
|
+
this.$editorEventHandlers[editor.id].changeSelectionForCodeActions = changeSelectionForCodeActions;
|
|
22530
|
+
editor.on("changeSelection", changeSelectionForCodeActions);
|
|
22389
22531
|
}
|
|
22390
22532
|
$initHoverTooltip(editor) {
|
|
22391
22533
|
const Range = editor.getSelectionRange().constructor;
|
|
@@ -22499,8 +22641,10 @@ class LanguageProvider {
|
|
|
22499
22641
|
}
|
|
22500
22642
|
getSemanticTokens() {
|
|
22501
22643
|
if (!this.options.functionality.semanticTokens) return;
|
|
22502
|
-
|
|
22503
|
-
|
|
22644
|
+
if (this.activeEditor) {
|
|
22645
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
22646
|
+
sessionLanguageProvider.getSemanticTokens();
|
|
22647
|
+
}
|
|
22504
22648
|
}
|
|
22505
22649
|
doComplete(editor, session, callback) {
|
|
22506
22650
|
let cursor = editor.getCursorPosition();
|
|
@@ -22514,16 +22658,27 @@ class LanguageProvider {
|
|
|
22514
22658
|
this.$messageController.doResolve(item["fileName"], toCompletionItem(item), callback);
|
|
22515
22659
|
}
|
|
22516
22660
|
$registerCompleters(editor) {
|
|
22517
|
-
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4,
|
|
22661
|
+
var _this_options_functionality, _this_options_functionality1, _this_options_functionality2, _this_options_functionality3, _this_options_functionality4, _this_options, _this_options_functionality5;
|
|
22518
22662
|
let completer, inlineCompleter;
|
|
22519
22663
|
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
22664
|
return;
|
|
22521
22665
|
}
|
|
22522
|
-
|
|
22523
|
-
|
|
22666
|
+
this.$editorOriginalState[editor.id] = {};
|
|
22667
|
+
if ((_this_options_functionality2 = this.options.functionality) === null || _this_options_functionality2 === void 0 ? void 0 : _this_options_functionality2.completion) {
|
|
22668
|
+
this.$editorOriginalState[editor.id].completers = editor.completers ? [
|
|
22669
|
+
...editor.completers
|
|
22670
|
+
] : [];
|
|
22671
|
+
if (this.options.functionality.completion.overwriteCompleters) {
|
|
22672
|
+
editor.completers = [];
|
|
22673
|
+
}
|
|
22524
22674
|
}
|
|
22525
|
-
if ((
|
|
22526
|
-
editor.inlineCompleters = [
|
|
22675
|
+
if ((_this_options_functionality3 = this.options.functionality) === null || _this_options_functionality3 === void 0 ? void 0 : _this_options_functionality3.inlineCompletion) {
|
|
22676
|
+
this.$editorOriginalState[editor.id].inlineCompleters = editor.inlineCompleters ? [
|
|
22677
|
+
...editor.inlineCompleters
|
|
22678
|
+
] : [];
|
|
22679
|
+
if (this.options.functionality.inlineCompletion.overwriteCompleters) {
|
|
22680
|
+
editor.inlineCompleters = [];
|
|
22681
|
+
}
|
|
22527
22682
|
}
|
|
22528
22683
|
if (this.options.functionality.completion) {
|
|
22529
22684
|
completer = {
|
|
@@ -22569,7 +22724,7 @@ class LanguageProvider {
|
|
|
22569
22724
|
};
|
|
22570
22725
|
editor.completers.push(completer);
|
|
22571
22726
|
}
|
|
22572
|
-
if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : (
|
|
22727
|
+
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
22728
|
this.checkInlineCompletionAdapter(()=>{
|
|
22574
22729
|
if (this.completerAdapter) {
|
|
22575
22730
|
var _editor;
|
|
@@ -22581,7 +22736,9 @@ class LanguageProvider {
|
|
|
22581
22736
|
}
|
|
22582
22737
|
});
|
|
22583
22738
|
}
|
|
22584
|
-
if ((
|
|
22739
|
+
if ((_this_options_functionality5 = this.options.functionality) === null || _this_options_functionality5 === void 0 ? void 0 : _this_options_functionality5.inlineCompletion) {
|
|
22740
|
+
const existingCommand = editor.commands.commands["startInlineAutocomplete"];
|
|
22741
|
+
this.$editorOriginalState[editor.id].inlineAutocompleteCommand = existingCommand || null;
|
|
22585
22742
|
editor.commands.addCommand({
|
|
22586
22743
|
name: "startInlineAutocomplete",
|
|
22587
22744
|
exec: (editor, options)=>{
|
|
@@ -22594,6 +22751,7 @@ class LanguageProvider {
|
|
|
22594
22751
|
mac: "Option-C"
|
|
22595
22752
|
}
|
|
22596
22753
|
});
|
|
22754
|
+
this.$editorEventHandlers[editor.id].afterExec = this.doLiveAutocomplete;
|
|
22597
22755
|
editor.commands.on('afterExec', this.doLiveAutocomplete);
|
|
22598
22756
|
inlineCompleter = {
|
|
22599
22757
|
getCompletions: async (editor, session, pos, prefix, callback)=>{
|
|
@@ -22621,13 +22779,14 @@ class LanguageProvider {
|
|
|
22621
22779
|
});
|
|
22622
22780
|
}
|
|
22623
22781
|
/**
|
|
22624
|
-
* Removes document from all linked services by session id
|
|
22625
|
-
*
|
|
22626
|
-
* @param
|
|
22782
|
+
* Removes document from all linked services by session id and cleans up all associated resources.
|
|
22783
|
+
* This includes removing event listeners, clearing marker groups, annotations, and notifying the server.
|
|
22784
|
+
* @param session - The Ace EditSession to close
|
|
22785
|
+
* @param [callback] - Optional callback to execute after the document is closed
|
|
22627
22786
|
*/ closeDocument(session, callback) {
|
|
22628
22787
|
let sessionProvider = this.$getSessionLanguageProvider(session);
|
|
22629
22788
|
if (sessionProvider) {
|
|
22630
|
-
sessionProvider.
|
|
22789
|
+
sessionProvider.dispose(callback);
|
|
22631
22790
|
delete this.$sessionLanguageProviders[session["id"]];
|
|
22632
22791
|
}
|
|
22633
22792
|
}
|
|
@@ -22669,6 +22828,8 @@ class LanguageProvider {
|
|
|
22669
22828
|
language_provider_define_property(this, "inlineCompleter", void 0);
|
|
22670
22829
|
language_provider_define_property(this, "doLiveAutocomplete", void 0);
|
|
22671
22830
|
language_provider_define_property(this, "completerAdapter", void 0);
|
|
22831
|
+
language_provider_define_property(this, "$editorEventHandlers", {});
|
|
22832
|
+
language_provider_define_property(this, "$editorOriginalState", {});
|
|
22672
22833
|
/**
|
|
22673
22834
|
* Registers a new editing session with the editor and associates it with a language provider.
|
|
22674
22835
|
* If a language provider for the specified editing session does not already exist, it initializes
|
|
@@ -22688,8 +22849,10 @@ class LanguageProvider {
|
|
|
22688
22849
|
language_provider_define_property(this, "codeActionCallback", void 0);
|
|
22689
22850
|
language_provider_define_property(this, "format", ()=>{
|
|
22690
22851
|
if (!this.options.functionality.format) return;
|
|
22691
|
-
|
|
22692
|
-
|
|
22852
|
+
if (this.activeEditor) {
|
|
22853
|
+
let sessionLanguageProvider = this.$getSessionLanguageProvider(this.activeEditor.session);
|
|
22854
|
+
sessionLanguageProvider.$sendDeltaQueue(sessionLanguageProvider.format);
|
|
22855
|
+
}
|
|
22693
22856
|
});
|
|
22694
22857
|
this.$messageController = new MessageController(worker, this);
|
|
22695
22858
|
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;
|