question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC | Ways to improve dictionary suggestions.

See original GitHub issue

Issue

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: image

recommended list if no regular expression is specified: image

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:closed
  • Created 2 years ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Jason3Scommented, Feb 7, 2022

Would you try this:

    "dictionaryDefinitions": [
        {
            "name": "ug-khan",
            "path": "./khan.dict.trie.gz",
            "description": "Ug-khan dictionary for cspell.",
            "dictionaryInformation": {
                "alphabet": "\u0626-\u06d5",
                "locale": "ug",
                "suggestionEditCosts": [
                    {
                        "map": "\u0626\u0627\u0648\u0649\u06c6\u06c7\u06c8\u06d0\u06d5",
                        "insDel": 1,
                        "replace": 1,
                        "swap": 1
                    }
                ]
            }
        }
    ],

I get the following: (I don’t have RTL)

cspell suggestions -v دىگەن
دىگەن:
 - دېگەن    -    1 ug-khan
 - دىبەن    -  100 ug-khan
 - دىگەر    -  100 ug-khan
 - دىلۇن    -  101 ug-khan
 - دىۋان    -  101 ug-khan
 - دىۋىن    -  101 ug-khan
 - دېگەك    -  101 ug-khan
 - دېگەي    -  101 ug-khan
 - دېگەچ    -  101 ug-khan

0reactions
github-actions[bot]commented, May 7, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC: What would you like to see in Style Dictionary 4.0? ‍
I'd love to see a few things to better support strongly typed languages such as Kotlin/Java: Support passing context between a transform and...
Read more >
RFC 1024: HEMS variable definitions
Readers with suggestions for additional object definitions, or improved definitions are encouraged to contact the authors. Partridge & Trewitt [Page 1] ...
Read more >
Recommendation to Use the Ethernet Control Word RFC 8469
Recommendation to Use the Ethernet Control Word (RFC 8469, November 2018)
Read more >
RFC-WORD-LIST-1 - Vocabulary.com
Practice An adaptive activity where students answer a few questions on each word in this list. If a student struggles with a word,...
Read more >
Running RFC with my WorkFlow - ServiceNow Community
1) where should I get the propper url to my workflow? 2) how can I replace the std workflow with my own (just...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found