ace-linters 1.2.2 → 1.2.3
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/README.md +14 -15
- package/build/ace-language-client.js +15 -9
- package/build/ace-linters.js +15 -9
- package/build/css-service.js +8 -5
- package/build/json-service.js +8 -5
- package/build/language-client.js +5 -7
- package/build/lua-service.js +8 -5
- package/build/php-service.js +8 -5
- package/build/python-service.js +8 -5
- package/build/service-manager.js +3 -1
- package/build/typescript-service.js +8 -5
- package/build/yaml-service.js +8 -5
- package/package.json +1 -1
- package/types/message-controller.d.ts +1 -1
- package/types/message-types.d.ts +2 -1
- package/types/type-converters/lsp/lsp-converters.d.ts +1 -1
- package/types/types/message-controller-interface.d.ts +1 -1
package/README.md
CHANGED
|
@@ -81,16 +81,15 @@ LanguageProvider.create(worker, {functionality: {semanticTokens: true}})
|
|
|
81
81
|
<div id="editor" style="height: 100px">some text</div>
|
|
82
82
|
|
|
83
83
|
<script>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
provider.registerEditor(editor);
|
|
84
|
+
ace.require("ace/ext/language_tools"); //To allow autocompletion
|
|
85
|
+
var editor = ace.edit("editor", {
|
|
86
|
+
enableBasicAutocompletion: true,
|
|
87
|
+
enableLiveAutocompletion: true,
|
|
88
|
+
mode: "ace/mode/css"
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
var provider = LanguageProvider.fromCdn("https://www.unpkg.com/ace-linters@latest/build/");
|
|
92
|
+
provider.registerEditor(editor);
|
|
94
93
|
</script>
|
|
95
94
|
```
|
|
96
95
|
|
|
@@ -110,14 +109,14 @@ import {AceLanguageClient} from "ace-linters/build/ace-language-client";
|
|
|
110
109
|
|
|
111
110
|
// Create a web socket
|
|
112
111
|
const serverData = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
module: () => import("ace-linters/build/language-client"),
|
|
113
|
+
modes: "json|json5",
|
|
114
|
+
type: "socket",
|
|
115
|
+
socket: new WebSocket("ws://127.0.0.1:3000/exampleServer"), // address of your websocket server
|
|
117
116
|
}
|
|
118
117
|
// Create an Ace editor
|
|
119
118
|
let editor = ace.edit("container", {
|
|
120
|
-
|
|
119
|
+
mode: new JSONMode() // Set the mode of the editor to JSON
|
|
121
120
|
});
|
|
122
121
|
|
|
123
122
|
// Create a language provider for web socket
|
|
@@ -9621,13 +9621,15 @@ class DeltasMessage extends BaseMessage {
|
|
|
9621
9621
|
}
|
|
9622
9622
|
}
|
|
9623
9623
|
class ChangeModeMessage extends BaseMessage {
|
|
9624
|
-
constructor(sessionId, value, mode){
|
|
9624
|
+
constructor(sessionId, value, version, mode){
|
|
9625
9625
|
super(sessionId);
|
|
9626
9626
|
_define_property(this, "type", MessageType.changeMode);
|
|
9627
9627
|
_define_property(this, "mode", void 0);
|
|
9628
9628
|
_define_property(this, "value", void 0);
|
|
9629
|
+
_define_property(this, "version", void 0);
|
|
9629
9630
|
this.value = value;
|
|
9630
9631
|
this.mode = mode;
|
|
9632
|
+
this.version = version;
|
|
9631
9633
|
}
|
|
9632
9634
|
}
|
|
9633
9635
|
class ChangeOptionsMessage extends BaseMessage {
|
|
@@ -19463,8 +19465,8 @@ class MessageController extends (events_default()) {
|
|
|
19463
19465
|
}
|
|
19464
19466
|
this.postMessage(message, callback);
|
|
19465
19467
|
}
|
|
19466
|
-
changeMode(sessionId, value, mode, callback) {
|
|
19467
|
-
this.postMessage(new message_types/* ChangeModeMessage */.s7(sessionId, value, mode), callback);
|
|
19468
|
+
changeMode(sessionId, value, version, mode, callback) {
|
|
19469
|
+
this.postMessage(new message_types/* ChangeModeMessage */.s7(sessionId, value, version, mode), callback);
|
|
19468
19470
|
}
|
|
19469
19471
|
changeOptions(sessionId, options, callback, merge = false) {
|
|
19470
19472
|
this.postMessage(new message_types/* ChangeOptionsMessage */.GC(sessionId, options, merge), callback);
|
|
@@ -19577,8 +19579,11 @@ function toCompletion(item) {
|
|
|
19577
19579
|
let kind = itemKind ? Object.keys(main.CompletionItemKind)[Object.values(main.CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
19578
19580
|
var _item_textEdit_newText, _ref;
|
|
19579
19581
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
19582
|
+
// filtering would happen on ace editor side
|
|
19583
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
19584
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
19580
19585
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
19581
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
19586
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
19582
19587
|
let completion = {
|
|
19583
19588
|
meta: kind,
|
|
19584
19589
|
caption: item.label,
|
|
@@ -19655,16 +19660,16 @@ function toCompletionItem(completion) {
|
|
|
19655
19660
|
completionItem["service"] = completion["service"]; //TODO:
|
|
19656
19661
|
return completionItem;
|
|
19657
19662
|
}
|
|
19658
|
-
function getTextEditRange(textEdit) {
|
|
19659
|
-
|
|
19660
|
-
|
|
19663
|
+
function getTextEditRange(textEdit, filterText) {
|
|
19664
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
19665
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
19661
19666
|
let mergedRanges = (0,utils/* mergeRanges */.lr)([
|
|
19662
19667
|
toRange(textEdit.insert),
|
|
19663
19668
|
toRange(textEdit.replace)
|
|
19664
19669
|
]);
|
|
19665
19670
|
return mergedRanges[0];
|
|
19666
19671
|
} else {
|
|
19667
|
-
textEdit
|
|
19672
|
+
textEdit.range.start.character -= filterLength;
|
|
19668
19673
|
return toRange(textEdit.range);
|
|
19669
19674
|
}
|
|
19670
19675
|
}
|
|
@@ -21246,7 +21251,8 @@ class SessionLanguageProvider {
|
|
|
21246
21251
|
this.state.diagnosticMarkers.setMarkers([]);
|
|
21247
21252
|
}
|
|
21248
21253
|
this.session.setSemanticTokens(undefined); //clear all semantic tokens
|
|
21249
|
-
|
|
21254
|
+
let newVersion = this.session.doc["version"]++;
|
|
21255
|
+
this.$messageController.changeMode(this.fileName, this.session.getValue(), newVersion, this.$mode, this.setServerCapabilities);
|
|
21250
21256
|
});
|
|
21251
21257
|
language_provider_define_property(this, "setServerCapabilities", (capabilities)=>{
|
|
21252
21258
|
if (!capabilities) return;
|
package/build/ace-linters.js
CHANGED
|
@@ -18910,13 +18910,15 @@ class DeltasMessage extends BaseMessage {
|
|
|
18910
18910
|
}
|
|
18911
18911
|
}
|
|
18912
18912
|
class ChangeModeMessage extends BaseMessage {
|
|
18913
|
-
constructor(sessionId, value, mode){
|
|
18913
|
+
constructor(sessionId, value, version, mode){
|
|
18914
18914
|
super(sessionId);
|
|
18915
18915
|
message_types_define_property(this, "type", MessageType.changeMode);
|
|
18916
18916
|
message_types_define_property(this, "mode", void 0);
|
|
18917
18917
|
message_types_define_property(this, "value", void 0);
|
|
18918
|
+
message_types_define_property(this, "version", void 0);
|
|
18918
18919
|
this.value = value;
|
|
18919
18920
|
this.mode = mode;
|
|
18921
|
+
this.version = version;
|
|
18920
18922
|
}
|
|
18921
18923
|
}
|
|
18922
18924
|
class ChangeOptionsMessage extends BaseMessage {
|
|
@@ -19057,8 +19059,8 @@ class MessageController extends (events_default()) {
|
|
|
19057
19059
|
}
|
|
19058
19060
|
this.postMessage(message, callback);
|
|
19059
19061
|
}
|
|
19060
|
-
changeMode(sessionId, value, mode, callback) {
|
|
19061
|
-
this.postMessage(new ChangeModeMessage(sessionId, value, mode), callback);
|
|
19062
|
+
changeMode(sessionId, value, version, mode, callback) {
|
|
19063
|
+
this.postMessage(new ChangeModeMessage(sessionId, value, version, mode), callback);
|
|
19062
19064
|
}
|
|
19063
19065
|
changeOptions(sessionId, options, callback, merge = false) {
|
|
19064
19066
|
this.postMessage(new ChangeOptionsMessage(sessionId, options, merge), callback);
|
|
@@ -19171,8 +19173,11 @@ function toCompletion(item) {
|
|
|
19171
19173
|
let kind = itemKind ? Object.keys(main.CompletionItemKind)[Object.values(main.CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
19172
19174
|
var _item_textEdit_newText, _ref;
|
|
19173
19175
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
19176
|
+
// filtering would happen on ace editor side
|
|
19177
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
19178
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
19174
19179
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
19175
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
19180
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
19176
19181
|
let completion = {
|
|
19177
19182
|
meta: kind,
|
|
19178
19183
|
caption: item.label,
|
|
@@ -19249,16 +19254,16 @@ function toCompletionItem(completion) {
|
|
|
19249
19254
|
completionItem["service"] = completion["service"]; //TODO:
|
|
19250
19255
|
return completionItem;
|
|
19251
19256
|
}
|
|
19252
|
-
function getTextEditRange(textEdit) {
|
|
19253
|
-
|
|
19254
|
-
|
|
19257
|
+
function getTextEditRange(textEdit, filterText) {
|
|
19258
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
19259
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
19255
19260
|
let mergedRanges = mergeRanges([
|
|
19256
19261
|
toRange(textEdit.insert),
|
|
19257
19262
|
toRange(textEdit.replace)
|
|
19258
19263
|
]);
|
|
19259
19264
|
return mergedRanges[0];
|
|
19260
19265
|
} else {
|
|
19261
|
-
textEdit
|
|
19266
|
+
textEdit.range.start.character -= filterLength;
|
|
19262
19267
|
return toRange(textEdit.range);
|
|
19263
19268
|
}
|
|
19264
19269
|
}
|
|
@@ -20840,7 +20845,8 @@ class SessionLanguageProvider {
|
|
|
20840
20845
|
this.state.diagnosticMarkers.setMarkers([]);
|
|
20841
20846
|
}
|
|
20842
20847
|
this.session.setSemanticTokens(undefined); //clear all semantic tokens
|
|
20843
|
-
|
|
20848
|
+
let newVersion = this.session.doc["version"]++;
|
|
20849
|
+
this.$messageController.changeMode(this.fileName, this.session.getValue(), newVersion, this.$mode, this.setServerCapabilities);
|
|
20844
20850
|
});
|
|
20845
20851
|
language_provider_define_property(this, "setServerCapabilities", (capabilities)=>{
|
|
20846
20852
|
if (!capabilities) return;
|
package/build/css-service.js
CHANGED
|
@@ -52473,8 +52473,11 @@ function toCompletion(item) {
|
|
|
52473
52473
|
let kind = itemKind ? Object.keys(CompletionItemKind)[Object.values(CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
52474
52474
|
var _item_textEdit_newText, _ref;
|
|
52475
52475
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
52476
|
+
// filtering would happen on ace editor side
|
|
52477
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
52478
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
52476
52479
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
52477
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
52480
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
52478
52481
|
let completion = {
|
|
52479
52482
|
meta: kind,
|
|
52480
52483
|
caption: item.label,
|
|
@@ -52551,16 +52554,16 @@ function toCompletionItem(completion) {
|
|
|
52551
52554
|
completionItem["service"] = completion["service"]; //TODO:
|
|
52552
52555
|
return completionItem;
|
|
52553
52556
|
}
|
|
52554
|
-
function getTextEditRange(textEdit) {
|
|
52555
|
-
|
|
52556
|
-
|
|
52557
|
+
function getTextEditRange(textEdit, filterText) {
|
|
52558
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
52559
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
52557
52560
|
let mergedRanges = mergeRanges([
|
|
52558
52561
|
toRange(textEdit.insert),
|
|
52559
52562
|
toRange(textEdit.replace)
|
|
52560
52563
|
]);
|
|
52561
52564
|
return mergedRanges[0];
|
|
52562
52565
|
} else {
|
|
52563
|
-
textEdit
|
|
52566
|
+
textEdit.range.start.character -= filterLength;
|
|
52564
52567
|
return toRange(textEdit.range);
|
|
52565
52568
|
}
|
|
52566
52569
|
}
|
package/build/json-service.js
CHANGED
|
@@ -20579,8 +20579,11 @@ function toCompletion(item) {
|
|
|
20579
20579
|
let kind = itemKind ? Object.keys(CompletionItemKind)[Object.values(CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
20580
20580
|
var _item_textEdit_newText, _ref;
|
|
20581
20581
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
20582
|
+
// filtering would happen on ace editor side
|
|
20583
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
20584
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
20582
20585
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
20583
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
20586
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
20584
20587
|
let completion = {
|
|
20585
20588
|
meta: kind,
|
|
20586
20589
|
caption: item.label,
|
|
@@ -20657,16 +20660,16 @@ function toCompletionItem(completion) {
|
|
|
20657
20660
|
completionItem["service"] = completion["service"]; //TODO:
|
|
20658
20661
|
return completionItem;
|
|
20659
20662
|
}
|
|
20660
|
-
function getTextEditRange(textEdit) {
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
+
function getTextEditRange(textEdit, filterText) {
|
|
20664
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
20665
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
20663
20666
|
let mergedRanges = mergeRanges([
|
|
20664
20667
|
toRange(textEdit.insert),
|
|
20665
20668
|
toRange(textEdit.replace)
|
|
20666
20669
|
]);
|
|
20667
20670
|
return mergedRanges[0];
|
|
20668
20671
|
} else {
|
|
20669
|
-
textEdit
|
|
20672
|
+
textEdit.range.start.character -= filterLength;
|
|
20670
20673
|
return toRange(textEdit.range);
|
|
20671
20674
|
}
|
|
20672
20675
|
}
|
package/build/language-client.js
CHANGED
|
@@ -17022,13 +17022,15 @@ class DeltasMessage extends (/* unused pure expression or super */ null && (Base
|
|
|
17022
17022
|
}
|
|
17023
17023
|
}
|
|
17024
17024
|
class ChangeModeMessage extends (/* unused pure expression or super */ null && (BaseMessage)) {
|
|
17025
|
-
constructor(sessionId, value, mode){
|
|
17025
|
+
constructor(sessionId, value, version, mode){
|
|
17026
17026
|
super(sessionId);
|
|
17027
17027
|
_define_property(this, "type", MessageType.changeMode);
|
|
17028
17028
|
_define_property(this, "mode", void 0);
|
|
17029
17029
|
_define_property(this, "value", void 0);
|
|
17030
|
+
_define_property(this, "version", void 0);
|
|
17030
17031
|
this.value = value;
|
|
17031
17032
|
this.mode = mode;
|
|
17033
|
+
this.version = version;
|
|
17032
17034
|
}
|
|
17033
17035
|
}
|
|
17034
17036
|
class ChangeOptionsMessage extends (/* unused pure expression or super */ null && (BaseMessage)) {
|
|
@@ -17231,7 +17233,7 @@ class LanguageClient extends base_service.BaseService {
|
|
|
17231
17233
|
this.enqueueIfNotConnected(()=>this.connection.sendNotification('textDocument/didOpen', textDocumentMessage));
|
|
17232
17234
|
}
|
|
17233
17235
|
enqueueIfNotConnected(callback) {
|
|
17234
|
-
if (!this.isConnected) {
|
|
17236
|
+
if (!this.isConnected || !this.isInitialized) {
|
|
17235
17237
|
this.requestsQueue.push(callback);
|
|
17236
17238
|
} else {
|
|
17237
17239
|
callback();
|
|
@@ -17401,14 +17403,10 @@ class LanguageClient extends base_service.BaseService {
|
|
|
17401
17403
|
}
|
|
17402
17404
|
setGlobalOptions(options) {
|
|
17403
17405
|
super.setGlobalOptions(options);
|
|
17404
|
-
if (!this.isConnected) {
|
|
17405
|
-
this.requestsQueue.push(()=>this.setGlobalOptions(options));
|
|
17406
|
-
return;
|
|
17407
|
-
}
|
|
17408
17406
|
const configChanges = {
|
|
17409
17407
|
settings: options
|
|
17410
17408
|
};
|
|
17411
|
-
this.connection.sendNotification('workspace/didChangeConfiguration', configChanges);
|
|
17409
|
+
this.enqueueIfNotConnected(()=>this.connection.sendNotification('workspace/didChangeConfiguration', configChanges));
|
|
17412
17410
|
}
|
|
17413
17411
|
async findDocumentHighlights(document, position) {
|
|
17414
17412
|
var _this_serviceCapabilities;
|
package/build/lua-service.js
CHANGED
|
@@ -16446,8 +16446,11 @@ function toCompletion(item) {
|
|
|
16446
16446
|
let kind = itemKind ? Object.keys(CompletionItemKind)[Object.values(CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
16447
16447
|
var _item_textEdit_newText, _ref;
|
|
16448
16448
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
16449
|
+
// filtering would happen on ace editor side
|
|
16450
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
16451
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
16449
16452
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
16450
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
16453
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
16451
16454
|
let completion = {
|
|
16452
16455
|
meta: kind,
|
|
16453
16456
|
caption: item.label,
|
|
@@ -16524,16 +16527,16 @@ function toCompletionItem(completion) {
|
|
|
16524
16527
|
completionItem["service"] = completion["service"]; //TODO:
|
|
16525
16528
|
return completionItem;
|
|
16526
16529
|
}
|
|
16527
|
-
function getTextEditRange(textEdit) {
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
+
function getTextEditRange(textEdit, filterText) {
|
|
16531
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
16532
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
16530
16533
|
let mergedRanges = mergeRanges([
|
|
16531
16534
|
toRange(textEdit.insert),
|
|
16532
16535
|
toRange(textEdit.replace)
|
|
16533
16536
|
]);
|
|
16534
16537
|
return mergedRanges[0];
|
|
16535
16538
|
} else {
|
|
16536
|
-
textEdit
|
|
16539
|
+
textEdit.range.start.character -= filterLength;
|
|
16537
16540
|
return toRange(textEdit.range);
|
|
16538
16541
|
}
|
|
16539
16542
|
}
|
package/build/php-service.js
CHANGED
|
@@ -22769,8 +22769,11 @@ function toCompletion(item) {
|
|
|
22769
22769
|
let kind = itemKind ? Object.keys(CompletionItemKind)[Object.values(CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
22770
22770
|
var _item_textEdit_newText, _ref;
|
|
22771
22771
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
22772
|
+
// filtering would happen on ace editor side
|
|
22773
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
22774
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
22772
22775
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
22773
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
22776
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
22774
22777
|
let completion = {
|
|
22775
22778
|
meta: kind,
|
|
22776
22779
|
caption: item.label,
|
|
@@ -22847,16 +22850,16 @@ function toCompletionItem(completion) {
|
|
|
22847
22850
|
completionItem["service"] = completion["service"]; //TODO:
|
|
22848
22851
|
return completionItem;
|
|
22849
22852
|
}
|
|
22850
|
-
function getTextEditRange(textEdit) {
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
+
function getTextEditRange(textEdit, filterText) {
|
|
22854
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
22855
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
22853
22856
|
let mergedRanges = mergeRanges([
|
|
22854
22857
|
toRange(textEdit.insert),
|
|
22855
22858
|
toRange(textEdit.replace)
|
|
22856
22859
|
]);
|
|
22857
22860
|
return mergedRanges[0];
|
|
22858
22861
|
} else {
|
|
22859
|
-
textEdit
|
|
22862
|
+
textEdit.range.start.character -= filterLength;
|
|
22860
22863
|
return toRange(textEdit.range);
|
|
22861
22864
|
}
|
|
22862
22865
|
}
|
package/build/python-service.js
CHANGED
|
@@ -14281,8 +14281,11 @@ function toCompletion(item) {
|
|
|
14281
14281
|
let kind = itemKind ? Object.keys(CompletionItemKind)[Object.values(CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
14282
14282
|
var _item_textEdit_newText, _ref;
|
|
14283
14283
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
14284
|
+
// filtering would happen on ace editor side
|
|
14285
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
14286
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
14284
14287
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
14285
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
14288
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
14286
14289
|
let completion = {
|
|
14287
14290
|
meta: kind,
|
|
14288
14291
|
caption: item.label,
|
|
@@ -14359,16 +14362,16 @@ function toCompletionItem(completion) {
|
|
|
14359
14362
|
completionItem["service"] = completion["service"]; //TODO:
|
|
14360
14363
|
return completionItem;
|
|
14361
14364
|
}
|
|
14362
|
-
function getTextEditRange(textEdit) {
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
+
function getTextEditRange(textEdit, filterText) {
|
|
14366
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
14367
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
14365
14368
|
let mergedRanges = mergeRanges([
|
|
14366
14369
|
toRange(textEdit.insert),
|
|
14367
14370
|
toRange(textEdit.replace)
|
|
14368
14371
|
]);
|
|
14369
14372
|
return mergedRanges[0];
|
|
14370
14373
|
} else {
|
|
14371
|
-
textEdit
|
|
14374
|
+
textEdit.range.start.character -= filterLength;
|
|
14372
14375
|
return toRange(textEdit.range);
|
|
14373
14376
|
}
|
|
14374
14377
|
}
|
package/build/service-manager.js
CHANGED
|
@@ -114,13 +114,15 @@ class DeltasMessage extends (/* unused pure expression or super */ null && (Base
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
class ChangeModeMessage extends (/* unused pure expression or super */ null && (BaseMessage)) {
|
|
117
|
-
constructor(sessionId, value, mode){
|
|
117
|
+
constructor(sessionId, value, version, mode){
|
|
118
118
|
super(sessionId);
|
|
119
119
|
_define_property(this, "type", MessageType.changeMode);
|
|
120
120
|
_define_property(this, "mode", void 0);
|
|
121
121
|
_define_property(this, "value", void 0);
|
|
122
|
+
_define_property(this, "version", void 0);
|
|
122
123
|
this.value = value;
|
|
123
124
|
this.mode = mode;
|
|
125
|
+
this.version = version;
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
class ChangeOptionsMessage extends (/* unused pure expression or super */ null && (BaseMessage)) {
|
|
@@ -187340,8 +187340,11 @@ function toCompletion(item) {
|
|
|
187340
187340
|
let kind = itemKind ? Object.keys(CompletionItemKind)[Object.values(CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
187341
187341
|
var _item_textEdit_newText, _ref;
|
|
187342
187342
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
187343
|
+
// filtering would happen on ace editor side
|
|
187344
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
187345
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
187343
187346
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
187344
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
187347
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
187345
187348
|
let completion = {
|
|
187346
187349
|
meta: kind,
|
|
187347
187350
|
caption: item.label,
|
|
@@ -187418,16 +187421,16 @@ function toCompletionItem(completion) {
|
|
|
187418
187421
|
completionItem["service"] = completion["service"]; //TODO:
|
|
187419
187422
|
return completionItem;
|
|
187420
187423
|
}
|
|
187421
|
-
function getTextEditRange(textEdit) {
|
|
187422
|
-
|
|
187423
|
-
|
|
187424
|
+
function getTextEditRange(textEdit, filterText) {
|
|
187425
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
187426
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
187424
187427
|
let mergedRanges = mergeRanges([
|
|
187425
187428
|
toRange(textEdit.insert),
|
|
187426
187429
|
toRange(textEdit.replace)
|
|
187427
187430
|
]);
|
|
187428
187431
|
return mergedRanges[0];
|
|
187429
187432
|
} else {
|
|
187430
|
-
textEdit
|
|
187433
|
+
textEdit.range.start.character -= filterLength;
|
|
187431
187434
|
return toRange(textEdit.range);
|
|
187432
187435
|
}
|
|
187433
187436
|
}
|
package/build/yaml-service.js
CHANGED
|
@@ -71136,8 +71136,11 @@ function toCompletion(item) {
|
|
|
71136
71136
|
let kind = itemKind ? Object.keys(CompletionItemKind)[Object.values(CompletionItemKind).indexOf(itemKind)] : undefined;
|
|
71137
71137
|
var _item_textEdit_newText, _ref;
|
|
71138
71138
|
let text = (_ref = (_item_textEdit_newText = (_item_textEdit = item.textEdit) === null || _item_textEdit === void 0 ? void 0 : _item_textEdit.newText) !== null && _item_textEdit_newText !== void 0 ? _item_textEdit_newText : item.insertText) !== null && _ref !== void 0 ? _ref : item.label;
|
|
71139
|
+
// filtering would happen on ace editor side
|
|
71140
|
+
// TODO: if filtering and sorting are on server side, we should disable FilteredList in ace completer
|
|
71141
|
+
text = item.filterText && !text.startsWith(item.filterText) ? item.filterText + text : text;
|
|
71139
71142
|
let command = ((_item_command = item.command) === null || _item_command === void 0 ? void 0 : _item_command.command) == "editor.action.triggerSuggest" ? "startAutocomplete" : undefined;
|
|
71140
|
-
let range = item.textEdit ? getTextEditRange(item.textEdit) : undefined;
|
|
71143
|
+
let range = item.textEdit ? getTextEditRange(item.textEdit, item.filterText) : undefined;
|
|
71141
71144
|
let completion = {
|
|
71142
71145
|
meta: kind,
|
|
71143
71146
|
caption: item.label,
|
|
@@ -71214,16 +71217,16 @@ function toCompletionItem(completion) {
|
|
|
71214
71217
|
completionItem["service"] = completion["service"]; //TODO:
|
|
71215
71218
|
return completionItem;
|
|
71216
71219
|
}
|
|
71217
|
-
function getTextEditRange(textEdit) {
|
|
71218
|
-
|
|
71219
|
-
|
|
71220
|
+
function getTextEditRange(textEdit, filterText) {
|
|
71221
|
+
const filterLength = filterText ? filterText.length : 0;
|
|
71222
|
+
if ("insert" in textEdit && "replace" in textEdit) {
|
|
71220
71223
|
let mergedRanges = mergeRanges([
|
|
71221
71224
|
toRange(textEdit.insert),
|
|
71222
71225
|
toRange(textEdit.replace)
|
|
71223
71226
|
]);
|
|
71224
71227
|
return mergedRanges[0];
|
|
71225
71228
|
} else {
|
|
71226
|
-
textEdit
|
|
71229
|
+
textEdit.range.start.character -= filterLength;
|
|
71227
71230
|
return toRange(textEdit.range);
|
|
71228
71231
|
}
|
|
71229
71232
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export declare class MessageController extends EventEmitter implements IMessageC
|
|
|
15
15
|
format(sessionId: string, range: lsp.Range, format: lsp.FormattingOptions, callback?: (edits: lsp.TextEdit[]) => void): void;
|
|
16
16
|
doHover(sessionId: string, position: lsp.Position, callback?: (hover: lsp.Hover[]) => void): void;
|
|
17
17
|
change(sessionId: string, deltas: any, document: Ace.Document, callback?: () => void): void;
|
|
18
|
-
changeMode(sessionId: string, value: string, mode: string, callback?: (capabilities: any) => void): void;
|
|
18
|
+
changeMode(sessionId: string, value: string, version: number, mode: string, callback?: (capabilities: any) => void): void;
|
|
19
19
|
changeOptions(sessionId: string, options: ServiceOptions, callback?: () => void, merge?: boolean): void;
|
|
20
20
|
closeDocument(sessionId: string, callback?: () => void): void;
|
|
21
21
|
dispose(callback: () => void): void;
|
package/types/message-types.d.ts
CHANGED
|
@@ -61,7 +61,8 @@ export declare class ChangeModeMessage extends BaseMessage {
|
|
|
61
61
|
type: MessageType.changeMode;
|
|
62
62
|
mode: string;
|
|
63
63
|
value: string;
|
|
64
|
-
|
|
64
|
+
version: number;
|
|
65
|
+
constructor(sessionId: string, value: string, version: number, mode: string);
|
|
65
66
|
}
|
|
66
67
|
export declare class ChangeOptionsMessage extends BaseMessage {
|
|
67
68
|
type: MessageType.changeOptions;
|
|
@@ -15,7 +15,7 @@ export declare function toCompletion(item: CompletionItem): {
|
|
|
15
15
|
export declare function toCompletions(completions: CompletionService[]): Ace.Completion[];
|
|
16
16
|
export declare function toResolvedCompletion(completion: Ace.Completion, item: CompletionItem): Ace.Completion;
|
|
17
17
|
export declare function toCompletionItem(completion: Ace.Completion): CompletionItem;
|
|
18
|
-
export declare function getTextEditRange(textEdit: TextEdit | InsertReplaceEdit): AceRangeData;
|
|
18
|
+
export declare function getTextEditRange(textEdit: TextEdit | InsertReplaceEdit, filterText?: string): AceRangeData;
|
|
19
19
|
export declare function toTooltip(hover: Hover[] | undefined): Tooltip | undefined;
|
|
20
20
|
export declare function fromSignatureHelp(signatureHelp: SignatureHelp[] | undefined): Tooltip | undefined;
|
|
21
21
|
export declare function fromMarkupContent(content?: string | MarkupContent): string | undefined;
|
|
@@ -19,7 +19,7 @@ export interface IMessageController {
|
|
|
19
19
|
format(sessionId: string, range: lsp.Range, format: lsp.FormattingOptions, callback?: (edits: lsp.TextEdit[]) => void): any;
|
|
20
20
|
doHover(sessionId: string, position: lsp.Position, callback?: (hover: lsp.Hover[]) => void): any;
|
|
21
21
|
change(sessionId: string, deltas: lsp.TextDocumentContentChangeEvent[], document: Ace.Document, callback?: () => void): void;
|
|
22
|
-
changeMode(sessionId: string, value: string, mode: string, callback?: (capabilities: {
|
|
22
|
+
changeMode(sessionId: string, value: string, version: number, mode: string, callback?: (capabilities: {
|
|
23
23
|
[serviceName: string]: lsp.ServerCapabilities;
|
|
24
24
|
}) => void): any;
|
|
25
25
|
changeOptions(sessionId: string, options: ServiceOptions, callback?: () => void): any;
|