RFC | Ways to improve dictionary suggestions.
See original GitHub issueIssue
One of the features of the language I’m proofreading is that it has vowels and consonants. The suggested list for editing distance 1 with different vowels should be at the beginning。
for fake exmaple:
i have word adam
, x
is volwes and i have suggested list "adom", "adim", "adem", "adxm"
. the diff is o,i,e,x。
when I want to edit distance 1 and change the character to X words to be guaranteed to appear at the beginning of the suggested list, this cannot be done now.
If you control the order of the recommendation list with a regular expression, you should be able to do this。
Code I am testing
Here is a simple test case I did:
export function registerCompletionItemProvider() {
vscode.languages.registerCompletionItemProvider("markdown", {
provideCompletionItems() {
// get the difference char from targer not in src
const difference = (src, target) => {
return Array.from(target).filter(
(char) => !Array.from(src).includes(char)
);
};
const orderReg = new RegExp("[x]");
//const orderReg = new RegExp("[a-z]");
const result = ["adom", "adim", "adem", "adxm"].map((item) => {
const i = new vscode.CompletionItem(
item,
vscode.CompletionItemKind.Text
);
// for example my src word is "adam"
if (orderReg.test(difference("adam", item).join(""))) {
i.sortText = "a";
}
return i;
});
console.log("result", result);
return result;
},
resolveCompletionItem(item) {
return item;
},
});
}
The effect
The list of recommendations when I enter a when rule x is specified in the regular expression:
recommended list if no regular expression is specified:
Recommend
I think this is very useful in some special scenarios, so I recommend adding a regular rule configuration for suggesting list sorting
Issue Analytics
- State:
- Created 2 years ago
- Comments:23 (1 by maintainers)
Top GitHub Comments
Would you try this:
I get the following: (I don’t have RTL)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.