vscode-spell-checker
vscode-spell-checker copied to clipboard
regex engine
Issue
The regex engine is not clearly explained.
Background
I'm using some long abbreviation for my personal use with this extension and trying to ingore fully uppercase words. Later I added the 1-5 length constraint.
Current behavior
-
The example in the settings is ["href"] in the settings GUI , like this:
-
Then I added what I thought,
["\b[A-Z]\b"]
, with the add button. There was no effect. -
Then I removed the
[""]
and with\b[A-Z]\b
still no effect. -
I did some guess, figured out its actually
\\b
instead of\b
, and the extension SILENTLY stopped checkcing all words. -
I tried
/\\b[A-Z]{1,5}\\b/g
in the end and it worked at last.
Suggestion
- Specify the char escape of \b, \w, etc.
- In settings GUI, add a line of "Current Patterns and Pattern names" and change
Add Item
toAdd Pattern or Pattern name
- Cancel the setting regex delimiter
//
will be considered as//i
so the example becomes/["href"]/i
or/["href"]/
. This way automatically clearer(recommand). An alternative is to specify Pattern/string without regex delimiter//
will be considered as//i
.
I can PR this if some one assign me to this.
@PabloLION,
I empathize with the confusion. What you are seeing is an issue with the VS Code "GUI". An extension does not have much control over the options. The extension is only able to provide a single description that is used in the GUI and when editing the .vscode/settings.json
file. The Example given was for the .vscode/settings.json
.
Problem:
- If the user uses the VS Code Settings GUI to change the value, then escaping
\
is not necessary because the GUI will do it for you when it writes to.vcode/settings.json
. - If the user edits
.vscode/settings.json
file directly, then escaping is necessary. - The same documentation is displayed to the use in both cases.
You make a good point about the default flags: gi
.
A PR is welcome. Changing the DocBlock and building will update the description. https://github.com/streetsidesoftware/vscode-spell-checker/blob/main/packages/_server/src/config/cspellConfig.ts#L592
Hi @Jason3S
I'm trying to PR this but when I search to exclude html href
across the root.. there are 9 references and only used once in the settings GUI. I saw some of them are from the json schema. Maybe you can consider improve it with the "definition" first, like using defs or ref?
This would avoid a lot of works for me to avoid making mistakes. Thanks.
@PabloLION,
Thank you for trying. The "UI" shown in VS Code is based upon the json schema. The json schema is built from the code.
If you change: https://github.com/streetsidesoftware/vscode-spell-checker/blob/6212bcbccfaed1636f4023f551ab14cb4b57c101/packages/_server/src/config/cspellConfig.ts#L589-L592
/**
* @scope resource
*/
ignoreRegExpList?: CSpellSettings['ignoreRegExpList'];
to
/**
* @scope resource
* @markdownDescription
* List of RegExp patterns or Pattern names to exclude from spell checking.
*
* vvvv your examples blow VVV
* Example: ["href"] - to exclude html href.
*/
ignoreRegExpList?: CSpellSettings['ignoreRegExpList'];
If you type yarn
in the root of the project, it will build all the JSON schema files.
Thank @Jason3S . This is really cool stuff although I don't know how it works. I'll finish the PR first.
I tried this method you said and the CONTRIBUTE.md (I didn't see it before, sorry). I think the @description
changes the UI
and markdownDescription
changes the document/schema? Should I add this to CONTRIBUTE?
And now I see why you rephrased my problem. I myself find it not readable too. Sorry about that.
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.