Подчеркивание ошибок vs code

I'm using the eslint extension, and its producing errors in my code. However is there a way to show a error-indicating gutter on the lines with a error? Currently I just have this red underline: Is

I spent a lot of time and managed to make errors in vs code more visible. Still not in the gutter, but better then nothing. I replaced vs code squiggly error and warning underlines with background and thick underline:

enter image description hereenter image description here

(offtop: also on screenshot you can see how «Bracket Pair Colorizer» extension works :)

Install CSS and JS Loader and carefully follow all instructions (i had problem with link to css, which in windows must be like file:///C:/myfolder/myfile.css … better read whole extension instructions)

Create a css file with contents:

.monaco-editor.vs .squiggly-warning,
.monaco-editor.vs-dark .squiggly-warning {
  /* background */
  background: #f2e3b3;
  /* underline */
  border-bottom: 3px solid #ffc000; 
}
.monaco-editor.vs .squiggly-error,
.monaco-editor.vs-dark .squiggly-error {
  /* background */
  background: #ffc7c7;
  /* underline */
  border-bottom: 4px solid #ff0000; 
}

And place link to it in settings.json like said in CSS and JS Loader extension instructions

"vscode_custom_css.imports": ["file:///C:/yourfolder/youfilewithcustom.css"],
"vscode_custom_css.policy": true,

, then reload…

You can get color box around error (instead of underline, not simultaniously) if you use for example (border: instead of border-bottom: ):

border: 1px solid #ff0000; 

Or you can get custom border from any side (right border alone seems to look great, tried this while writing this post)

enter image description here

.monaco-editor.vs .squiggly-warning,
.monaco-editor.vs-dark .squiggly-warning {
  background: #f2e3b3;
  border-right: 5px solid #ffc000;
  border-bottom: 5px solid #ffc000;
  border-top: 3px solid #ffc000;
  border-left: 1px solid #ffc000;
}
.monaco-editor.vs .squiggly-error,
.monaco-editor.vs-dark .squiggly-error {
  background: #ffc7c7;
  border-right: 5px solid #ff0000;
  border-bottom: 3px solid #ff0000;
  border-top: 3px solid #ff0000;
  border-left: 1px solid #ff0000;
}

This css will only replace squiggle color from green to yellow:

.monaco-editor.vs .squiggly-warning,
.monaco-editor.vs-dark .squiggly-warning {
/* yellow squiggly */
background: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='3' width='6'><g fill='#FF0'><path d='M5.5 0l-3 3H1.1l3-3z'/><path d='M4 0l2 2V.6L5.4 0zM0 2l1 1h1.4L0 .6z'/></g></svg>") repeat-x 0 100%;
}

As you can see the name of class changed from .greensquiggly to .squiggly-warning, that’s why css from previous answer doesn’t work.
To find out new error css class i used Help -> Toggle Developer Tools, where after deleting bunch of blocks, i could find the error and warning classes.

I spent a lot of time and managed to make errors in vs code more visible. Still not in the gutter, but better then nothing. I replaced vs code squiggly error and warning underlines with background and thick underline:

enter image description hereenter image description here

(offtop: also on screenshot you can see how «Bracket Pair Colorizer» extension works :)

Install CSS and JS Loader and carefully follow all instructions (i had problem with link to css, which in windows must be like file:///C:/myfolder/myfile.css … better read whole extension instructions)

Create a css file with contents:

.monaco-editor.vs .squiggly-warning,
.monaco-editor.vs-dark .squiggly-warning {
  /* background */
  background: #f2e3b3;
  /* underline */
  border-bottom: 3px solid #ffc000; 
}
.monaco-editor.vs .squiggly-error,
.monaco-editor.vs-dark .squiggly-error {
  /* background */
  background: #ffc7c7;
  /* underline */
  border-bottom: 4px solid #ff0000; 
}

And place link to it in settings.json like said in CSS and JS Loader extension instructions

"vscode_custom_css.imports": ["file:///C:/yourfolder/youfilewithcustom.css"],
"vscode_custom_css.policy": true,

, then reload…

You can get color box around error (instead of underline, not simultaniously) if you use for example (border: instead of border-bottom: ):

border: 1px solid #ff0000; 

Or you can get custom border from any side (right border alone seems to look great, tried this while writing this post)

enter image description here

.monaco-editor.vs .squiggly-warning,
.monaco-editor.vs-dark .squiggly-warning {
  background: #f2e3b3;
  border-right: 5px solid #ffc000;
  border-bottom: 5px solid #ffc000;
  border-top: 3px solid #ffc000;
  border-left: 1px solid #ffc000;
}
.monaco-editor.vs .squiggly-error,
.monaco-editor.vs-dark .squiggly-error {
  background: #ffc7c7;
  border-right: 5px solid #ff0000;
  border-bottom: 3px solid #ff0000;
  border-top: 3px solid #ff0000;
  border-left: 1px solid #ff0000;
}

This css will only replace squiggle color from green to yellow:

.monaco-editor.vs .squiggly-warning,
.monaco-editor.vs-dark .squiggly-warning {
/* yellow squiggly */
background: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' height='3' width='6'><g fill='#FF0'><path d='M5.5 0l-3 3H1.1l3-3z'/><path d='M4 0l2 2V.6L5.4 0zM0 2l1 1h1.4L0 .6z'/></g></svg>") repeat-x 0 100%;
}

As you can see the name of class changed from .greensquiggly to .squiggly-warning, that’s why css from previous answer doesn’t work.
To find out new error css class i used Help -> Toggle Developer Tools, where after deleting bunch of blocks, i could find the error and warning classes.

2020/02/19

Марат

3874

0

vs_code |

Скачиваем и устанавливаем проверку орфографии русского языка в Visual Studio Code. Для проверки орфографии в Visual Studio Code — нам придется проделать пару манипуляций с программе. что проверка орфографии на русском языке заработала!

Скачать и установить плагин для проверки орфографии в Visual Studio Code

  1. Скачать и установить проверку орфографии на Visual Studio Code
  2. Включить проверку орфографии в программе Visual Studio Code
  3. Как пользоваться проверкой орфографии в Visual Studio Code
  4. Как добавить свое слово в словарь в Visual Studio Code<
  5. Отключаем проверку орфографию Visual Studio Code<
  1. Скачать и установить проверку орфографии на Visual Studio Code

    Пришло время скачать плагин проверки орфографии и установить его а Visual Studio Code!

    Открываем программу Visual Studio Code – слева ищем «иконку» где нарисовано четыре квадратика, нажимаем по ней!

    Сверху у вас появляется окно поиском, вбиваем туда :

    Code Spell Checker

    Видим результат поиска Russian — Code Spell Checker найден – нажимаем по строке.

    Справа внизу есть кнопка install, либо в открытом окне справа эта кнопка тоже есть. Устанавливаем!

    Нажмите, чтобы открыть в новом окне.

    Скачать и установить проверку орфографии на Visual Studio Code

  2. Включить проверку орфографии в программе Visual Studio Code

    После того, как вы скачали плагин проверки орфографии — его нужно включить!

    Вариант №1 включить проверку орфографии Visual Studio Code

    В очередной раз нажимаем по полюбившимся квадратикам в панели слева

    Перед вами должно открыться окно с перечислением установленных плагинов. Выбираем Russian — Code Spell Checker

    В правом нижнем углу видим шестеренку — > нажимаем включить проверку орфографии в Visual Studio Code

    Нажмите, чтобы открыть в новом окне.

    Вариант №1 включить проверку орфографии  Visual Studio Code

    Вариант №2 включить проверку орфографии Visual Studio Code

    Второй вариант включения Russian Spell Checker Dictionary

    Нажимаем F1 на клавиатуре.

    В окне ввода, если не нашли нужную строчку надо вставить Russian Spell Checker Dictionary

    После ввода вы должны увидеть активную строку, на которую нужно нажать, мы второй раз это сделать не сможем, поскольку проверка орфографии в нашей версии Visual Studio Code уже включена, что сигнализирует подчеркнутая строка:

    Enable Russian Spell Checker Dictionary

    Нажмите, чтобы открыть в новом окне.

    Вариант №2 включить проверку орфографии  Visual Studio Code

  3. Как пользоваться проверкой орфографии в Visual Studio Code

    Для того, чтобы продемонстрировать работу плагина проверки орфографии в Visual Studio Code, открывается какой-то файл и начинаем печатать текст на русском языке специально с ошибкой, и видим, что нашу ошибку программа Visual Studio Code прекрасно увидела, что свидетельствует подчеркивание слова с ошибкой:

    Если мы наведем на подчеркнутое слово, то увидим слова Unknown word — переводится как — «неизвестное слово»
    Как пользоваться проверкой орфографии в Visual Studio Code

  4. Как добавить сове слово в словарь в Visual Studio Code

    Также можно занести любое слово в ваш словарь!

    Нажимаем по строке ПКМ и в новом выпавшем окне ищем строку — Add Word to Folder Dictionary либо Add Word to User Dictionary
    Как добавить сове слово в словарь в Visual Studio Code

  5. Отключаем проверку орфографию Visual Studio Code.

    Для того, чтобы удалить проверку орфографии нужно проделать выше описанные действия в обратном направлении или смотри далее…

    Если вы хотите просто отключить проверку орфографии в Visual Studio Code

    Идем в установленные расширения.

    Находим установленное — «Russian — Code Spell Checker »

    И далее либо удаляем либо отключаем проверку орфографии!

    Нажмите, чтобы открыть в новом окне.

    Отключаем проверку орфографию Visual Studio Code.

Можете не благодарить, лучше помогите!

COMMENTS+

 
BBcode


Spelling Checker for Visual Studio Code

A basic spell checker that works well with code and documents.

The goal of this spell checker is to help catch common spelling errors while keeping the number of false positives low.

Support Further Development

  • Become a Patreon Patreon!

  • Support through PayPal

  • Open Collective

CodeStream Logo

Manage pull requests and conduct code reviews in your IDE with full source-tree context.
Comment on any line, not just the diffs. Use jump-to-definition, your favorite keybindings,
and code intelligence with more of your workflow.
Learn More

Functionality

Load a TypeScript, JavaScript, Text, etc. file. Words not in the dictionary files will have
a squiggly underline.

Example

Example

Suggestions

Example

To see the list of suggestions:

After positioning the cursor in the word, any of the following should display the list of suggestions:

  • Click on the 💡 (lightbulb) in the left hand margin.
  • Quick Fix Editor action command:
    • Mac: +. or Cmd+.
    • PC: Ctrl+.

Install

Open up VS Code and hit F1 and type ext select install and type code-spell-checker hit enter and reload window to enable.

Supported Languages

  • English (US)
  • English (GB) — turn on by changing "cSpell.language": "en" to "cSpell.language": "en-GB"

Add-On Language Dictionaries

  • Arabic
  • Catalan
  • Czech
  • Danish
  • Dutch
  • French
  • French Réforme 90
  • German
  • Greek
  • Hebrew
  • Italian
  • Persian
  • Polish
  • Portuguese — Brazilian
  • Portuguese
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Turkish
  • Ukrainian

Add-On Specialized Dictionaries

  • Medical Terms

Enabled File Types

  • AsciiDoc
  • C, C++
  • C#
  • css, less, scss
  • Dart
  • Elixir
  • Go
  • Html
  • Java
  • JavaScript
  • JSON / JSONC
  • LaTeX
  • Markdown
  • PHP
  • PowerShell
  • Pug / Jade
  • Python
  • reStructuredText
  • Ruby
  • Rust
  • Scala
  • Text
  • TypeScript
  • YAML

Enable / Disable File Types

To Enable or Disable spell checking for a file type:

  1. Click on the Spell Checker status in the status bar:

Spell Checker Status Bar

  1. On the Info screen, click the checkbox.

Spell Checker Information Window

How it works with camelCase

The concept is simple, split camelCase words before checking them against a list of known English words.

  • camelCase -> camel case
  • HTMLInput -> html input — Notice that the I is associated with Input and not HTML
  • snake_case_words -> snake case words
  • camel2snake -> camel snake — (the 2 is ignored)

Special case with ALL CAPS words

There are a few special cases to help with common spelling practices for ALL CAPS words.

Trailing s, ing, ies, es, ed are kept with the previous word.

  • CURLs -> curls — trailing s
  • CURLedRequest -> curled request — trailing ed

Things to note

  • This spellchecker is case insensitive. It will not catch errors like english which should be English.
  • The spellchecker uses a local word dictionary. It does not send anything outside your machine.
  • The words in the dictionary can and do contain errors.
  • There are missing words.
  • Only words longer than 3 characters are checked. «jsj» is ok, while «jsja» is not.
  • All symbols and punctuation are ignored.

In Document Settings

It is possible to add spell check settings into your source code.
This is to help with file specific issues that may not be applicable to the entire project.

All settings are prefixed with cSpell: or spell-checker:.

  • disable — turn off the spell checker for a section of code.
  • enable — turn the spell checker back on after it has been turned off.
  • ignore — specify a list of words to be ignored.
  • words — specify a list of words to be considered correct and will appear in the suggestions list.
  • locale — set locale (example: cSpell:locale fr,en to use French and English languages)
  • ignoreRegExp — Any text matching the regular expression will NOT be checked for spelling.
  • includeRegExp — Only text matching the collection of includeRegExp will be checked.
  • enableCompoundWords / disableCompoundWords — Allow / disallow words like: «stringlength».

Enable / Disable checking sections of code

It is possible to disable / enable the spell checker by adding comments to your code.

Disable Checking

  • /* cSpell:disable */
  • /* spell-checker: disable */
  • /* spellchecker: disable */
  • /* cspell: disable-line */
  • /* cspell: disable-next-line */

Enable Checking

  • /* cSpell:enable */
  • /* spell-checker: enable */
  • /* spellchecker: enable */

Example

// cSpell:disable
const wackyWord = ['zaallano', 'wooorrdd', 'zzooommmmmmmm'];
/* cSpell:enable */

// Nest disable / enable is not Supported

// spell-checker:disable
// It is now disabled.

var liep = 1;

/* cspell:disable */
// It is still disabled

// cSpell:enable
// It is now enabled

const str = 'goededag'; // <- will be flagged as an error.

// spell-checker:enable <- doesn't do anything

// cSPELL:DISABLE <-- also works.

// if there isn't an enable, spelling is disabled till the end of the file.
const str = 'goedemorgen'; // <- will NOT be flagged as an error.

Ignore

Ignore allows you the specify a list of words you want to ignore within the document.

// cSpell:ignore zaallano, wooorrdd
// cSpell:ignore zzooommmmmmmm
const wackyWord = ['zaallano', 'wooorrdd', 'zzooommmmmmmm'];

Note: words defined with ignore will be ignored for the entire file.

Words

The words list allows you to add words that will be considered correct and will be used as suggestions.

// cSpell:words woorxs sweeetbeat
const companyName = 'woorxs sweeetbeat';

Note: words defined with words will be used for the entire file.

Enable / Disable compound words

In some programing language it is common to glue words together.

// cSpell:enableCompoundWords
char * errormessage;  // Is ok with cSpell:enableCompoundWords
int    errornumber;   // Is also ok.

Note: Compound word checking cannot be turned on / off in the same file.
The last setting in the file determines the value for the entire file.

Excluding and Including Text to be checked.

By default, the entire document is checked for spelling.
cSpell:disable/cSpell:enable above allows you to block off sections of the document.
ignoreRegExp and includeRegExp give you the ability to ignore or include patterns of text.
By default the flags gim are added if no flags are given.

The spell checker works in the following way:

  1. Find all text matching includeRegExp
  2. Remove any text matching excludeRegExp
  3. Check the remaining text.

Exclude Example

// cSpell:ignoreRegExp 0x[0-9a-f]+     -- will ignore c style hex numbers
// cSpell:ignoreRegExp /0x[0-9A-F]+/g  -- will ignore upper case c style hex numbers.
// cSpell:ignoreRegExp g{5} h{5}       -- will only match ggggg, but not hhhhh or 'ggggg hhhhh'
// cSpell:ignoreRegExp g{5}|h{5}       -- will match both ggggg and hhhhh
// cSpell:ignoreRegExp /g{5} h{5}/     -- will match 'ggggg hhhhh'
/* cSpell:ignoreRegExp /n{5}/          -- will NOT work as expected because of the ending comment -> */
/*
   cSpell:ignoreRegExp /q{5}/          -- will match qqqqq just fine but NOT QQQQQ
*/
// cSpell:ignoreRegExp /[^s]{40,}/    -- will ignore long strings with no spaces.
// cSpell:ignoreRegExp Email           -- this will ignore email like patterns -- see Predefined RegExp expressions
var encodedImage = 'HR+cPzr7XGAOJNurPL0G8I2kU0UhKcqFssoKvFTR7z0T3VJfK37vS025uKroHfJ9nA6WWbHZ/ASn...';
var email1 = 'emailaddress@myfancynewcompany.com';
var email2 = '<emailaddress@myfancynewcompany.com>';

Note: ignoreRegExp and includeRegExp are applied to the entire file. They do not start and stop.

Include Example

In general you should not need to use includeRegExp. But if you are mixing languages then it could come in helpful.

# cSpell:includeRegExp #.*
# cSpell:includeRegExp /(["]{3}|[']{3})[^1]*?1/g
# only comments and block strings will be checked for spelling.
def sum_it(self, seq):
    """This is checked for spelling"""
    variabele = 0
    alinea = 'this is not checked'
    for num in seq:
        # The local state of 'value' will be retained between iterations
        variabele += num
        yield variabele

Predefined RegExp expressions

Exclude patterns

  • Urls1 — Matches urls
  • HexValues — Matches common hex format like #aaa, 0xfeef, u0134
  • EscapeCharacters1 — matches special characters: ‘n’, ‘t’ etc.
  • Base641 — matches base64 blocks of text longer than 40 characters.
  • Email — matches most email addresses.

Include Patterns

  • Everything1 — By default we match an entire document and remove the excludes.
  • string — This matches common string formats like ‘…’, «…», and `…`
  • CStyleComment — These are C Style comments /* */ and //
  • PhpHereDoc — This matches PHPHereDoc strings.

1. These patterns are part of the default include/exclude list for every file.

Customization

The spell checker configuration can be controlled via VS Code preferences or cspell.json configuration file.

Order of precedence:

  1. Workspace Folder cspell.json
  2. Workspace Folder .vscode/cspell.json
  3. VS Code Preferences cSpell section.

Adding words to the Workspace Dictionary

You have the option to add you own words to the workspace dictionary. The easiest, is to put your cursor
on the word you wish to add, when you lightbulb shows up, hit Ctrl+. (windows) / Cmd+. (Mac). You will get a list
of suggestions and the option to add the word.

You can also type in a word you want to add to the dictionary: F1 add word — select Add Word to Dictionary and type in the word you wish to add.

cspell.json

Words added to the dictionary are placed in the cspell.json file in the workspace folder.
Note, the settings in cspell.json will override the equivalent cSpell settings in VS Code’s settings.json.

Example cspell.json file

// cSpell Settings
{
    // Version of the setting file.  Always 0.2
    "version": "0.2",
    // language - current active spelling language
    "language": "en",
    // words - list of words to be always considered correct
    "words": [
        "mkdirp",
        "tsmerge",
        "githubusercontent",
        "streetsidesoftware",
        "vsmarketplacebadge",
        "visualstudio"
    ],
    // flagWords - list of words to be always considered incorrect
    // This is useful for offensive words and common spelling errors.
    // For example "hte" should be "the"
    "flagWords": [
        "hte"
    ]
}

VS Code Configuration Settings

    //-------- Code Spell Checker Configuration --------
    // The Language locale to use when spell checking. "en", "en-US" and "en-GB" are currently supported by default.
    "cSpell.language": "en",

    // Controls the maximum number of spelling errors per document.
    "cSpell.maxNumberOfProblems": 100,

    // Controls the number of suggestions shown.
    "cSpell.numSuggestions": 8,

    // The minimum length of a word before checking it against a dictionary.
    "cSpell.minWordLength": 4,

    // Specify file types to spell check.
    "cSpell.enabledLanguageIds": [
        "csharp",
        "go",
        "javascript",
        "javascriptreact",
        "markdown",
        "php",
        "plaintext",
        "typescript",
        "typescriptreact",
        "yml"
    ],

    // Enable / Disable the spell checker.
    "cSpell.enabled": true,

    // Display the spell checker status on the status bar.
    "cSpell.showStatus": true,

    // Words to add to dictionary for a workspace.
    "cSpell.words": [],

    // Enable / Disable compound words like 'errormessage'
    "cSpell.allowCompoundWords": false,

    // Words to be ignored and not suggested.
    "cSpell.ignoreWords": ["behaviour"],

    // User words to add to dictionary.  Should only be in the user settings.
    "cSpell.userWords": [],

    // Specify paths/files to ignore.
    "cSpell.ignorePaths": [
        "node_modules",        // this will ignore anything the node_modules directory
        "**/node_modules",     // the same for this one
        "**/node_modules/**",  // the same for this one
        "node_modules/**",     // Doesn't currently work due to how the current working directory is determined.
        "vscode-extension",    //
        ".git",                // Ignore the .git directory
        "*.dll",               // Ignore all .dll files.
        "**/*.dll"             // Ignore all .dll files
    ],

    // flagWords - list of words to be always considered incorrect
    // This is useful for offensive words and common spelling errors.
    // For example "hte" should be "the"`
    "cSpell.flagWords": ["hte"],

    // Set the delay before spell checking the document. Default is 50.
    "cSpell.spellCheckDelayMs": 50,

Dictionaries

The spell checker includes a set of default dictionaries.

General Dictionaries

  • wordsEn — Derived from Hunspell US English words.
  • wordsEnGb — Derived from Hunspell GB English words.
  • companies — List of well known companies
  • softwareTerms — Software Terms and concepts like «coroutine», «debounce», «tree», etc.
  • misc — Terms that do not belong in the other dictionaries.

Programming Language Dictionaries

  • typescript — keywords for Typescript and Javascript
  • node — terms related to using nodejs.
  • phpphp keywords and library methods
  • gogo keywords and library methods
  • pythonpython keywords
  • powershellpowershell keywords
  • htmlhtml related keywords
  • csscss, less, and scss related keywords

Miscellaneous Dictionaries

  • fonts — long list of fonts — to assist with css

Based upon the programming language, different dictionaries will be loaded.

Here are the default rules: «*» matches any language.
"locale" is used to filter based upon the "cSpell.language" setting.

{
"cSpell.languageSettings": [
    { "languageId": '*',      "locale": 'en',              "dictionaries": ['wordsEn'] },
    { "languageId": '*',      "locale": 'en-US',           "dictionaries": ['wordsEn'] },
    { "languageId": '*',      "locale": 'en-GB',           "dictionaries": ['wordsEnGb'] },
    { "languageId": '*',                                   "dictionaries": ['companies', 'softwareTerms', 'misc'] },
    { "languageId": "python", "allowCompoundWords": true,  "dictionaries": ["python"]},
    { "languageId": "go",     "allowCompoundWords": true,  "dictionaries": ["go"] },
    { "languageId": "javascript",                          "dictionaries": ["typescript", "node"] },
    { "languageId": "javascriptreact",                     "dictionaries": ["typescript", "node"] },
    { "languageId": "typescript",                          "dictionaries": ["typescript", "node"] },
    { "languageId": "typescriptreact",                     "dictionaries": ["typescript", "node"] },
    { "languageId": "html",                                "dictionaries": ["html", "fonts", "typescript", "css"] },
    { "languageId": "php",                                 "dictionaries": ["php", "html", "fonts", "css", "typescript"] },
    { "languageId": "css",                                 "dictionaries": ["fonts", "css"] },
    { "languageId": "less",                                "dictionaries": ["fonts", "css"] },
    { "languageId": "scss",                                "dictionaries": ["fonts", "css"] },
];
}

How to add your own Dictionaries

cSpell.customDictionaries

interface Settings {
    'cSpell.customDictionaries': {
        [name: string]: CustomDictionary;
    };
}

interface CustomDictionary {
    /**
     * @title Name of Dictionary
     * @markdownDescription
     * The reference name of the dictionary.
     *
     *
     * Example: `My Words` or `custom`
     *
     *
     * If they name matches a pre-defined dictionary, it will override the pre-defined dictionary.
     * If you use: `typescript` it will replace the built-in TypeScript dictionary.
     */
    name?: DictionaryId;

    /**
     * @title Description of the Dictionary
     * @markdownDescription
     * Optional: A human readable description.
     */
    description?: string;

    /**
     * @title Path to Dictionary Text File
     * @markdownDescription
     * Define the path to the dictionary text file.
     *
     *
     * **Note:** if path is `undefined` the `name`d dictionary is expected to be found
     * in the `dictionaryDefinitions`.
     *
     *
     * File Format: Each line in the file is considered a dictionary entry.
     * Case is preserved while leading and trailing space is removed.
     * The path should be absolute, or relative to the workspace.
     *
     * **Example:** relative to User's folder
     *
     * ```
     * ~/dictionaries/custom_dictionary.txt
     * ```
     *
     * **Example:** relative to the `client` folder in a multi-root workspace
     *
     * ```
     * ${workspaceFolder:client}/build/custom_dictionary.txt
     * ```
     *
     * **Example:** relative to the current workspace folder in a single-root workspace
     *
     * **Note:** this might no as expected in a multi-root workspace since it is based upon the relative
     * workspace for the currently open file.
     *
     * ```
     * ${workspaceFolder}/build/custom_dictionary.txt
     * ```
     *
     * **Example:** relative to the workspace folder in a single-root workspace or the first folder in
     * a multi-root workspace
     *
     * ```
     * ./build/custom_dictionary.txt
     * ```
     */
    path?: FsPath;

    /**
     * @title Add Words to Dictionary
     * @markdownDescription
     * Indicate if this custom dictionary should be used to store added words.
     * @default true
     */
    addWords?: boolean;

    /**
     * @title Scope of dictionary
     * @markdownDescription
     * Options are
     * - `user` - words that apply to all projects and workspaces
     * - `workspace` - words that apply to the entire workspace
     * - `folder` - words that apply to only a workspace folder
     */
    scope?: CustomDictionaryScope | CustomDictionaryScope[];
}

Global Dictionary

To add a global dictionary, you will need change your user settings.

Define the Dictionary

In your user settings, you will need to tell the spell checker where to find your word list.

Example adding medical terms, so words like acanthopterygious can be found.

VS Code Settings

"cSpell.customDictionaries": {
  "myWords": {
    "name": "myWords",
    "path": "~/my-words.txt",
    "scope": "user",
    "addWords": true
  }
}

Explained: In this example, we have told the spell checker where to find our personal dictionary called myWords.

  • name — this is the name of the dictionary, all references to this dictionary is done by the name.
  • path — this the path to the dictionary file. Since it is in the user settings, we have to use absolute paths or paths relative to the user directory by using ~/.
  • scope — (Optional) this is used to «scope» a dictionary to user, workspace, or folder. Scope is used to help communicate the intended use of the dictionary.
  • addWords — (Optional) default — true — is used to show / hide the dictionary as a possible target for adding words.

Project / Workspace Dictionary using cspell.json

To add a dictionary at the project level should be defined in a cspell.json file so it can be used with the cspell command line tool.
This file can be either at the project root or in the .vscode directory.

Example adding medical terms, where the terms are checked into the project and we only want to use it for .md files.

{
    "dictionaryDefinitions": [
        { "name": "medicalTerms", "path": "./dictionaries/medicalterms-en.txt"},
        { "name": "cities", "path": "./dictionaries/cities.txt"}
    ],
    "dictionaries": [
        "cities"
    ],
    "languageSettings": [
        { "languageId": "markdown", "dictionaries": ["medicalTerms"] },
        { "languageId": "plaintext", "dictionaries": ["medicalTerms"] }
    ]
}

Explained: In this example, two dictionaries were defined: cities and medicalTerms.
The paths are relative to the location of the cSpell.json file. This allows for dictionaries to be checked into the project.

The cities dictionary is used for every file type, because it was added to the list to dictionaries.
The medicalTerms dictionary is only used when editing markdown or plaintext files.

DictionaryDefinition

interface DictionaryDefinition {
    /**
     * This is the name of a dictionary.
     *
     * Name Format:
     * - Must contain at least 1 number or letter.
     * - Spaces are allowed.
     * - Leading and trailing space will be removed.
     * - Names ARE case-sensitive.
     * - Must not contain `*`, `!`, `;`, `,`, `{`, `}`, `[`, `]`, `~`.
     */
    name: DictionaryId;
    /** Optional description. */
    description?: string;
    /** Path to custom dictionary text file. */
    path: CustomDictionaryPath;
    /**
     * Defines the scope for when words will be added to the dictionary.
     * Scope values: `user`, `workspace`, `folder`.
     */
    scope?: CustomDictionaryScope | CustomDictionaryScope[];
    /**
     * When `true`, let's the spell checker know that words can be added to this dictionary.
     */
    addWords: boolean;
}

Project / Workspace Dictionary using VS Code Settings

VS Code Settings

"cSpell.customDictionaries": {
  "project-words": {
    "name": "project-words",
    "path": "${workspaceRoot}/project-words.txt",
    "description": "Words used in this project",
    "addWords": true
  },
  "medicalTerms": {
    "name": "medicalTerms",
    "path": "/Users/guest/projects/cSpell-WordLists/dictionaries/medicalterms-en.txt",
    "addWords": false // Do not add words to this dictionary
  },
  "companyTerms": {
    "name": "companyTerms",
    "path": "${workspaceFolder}/../company/terms.txt"
    // "addWords": true -- is implied
  }
  "custom": true, // Enable the `custom` dictionary
  "internal-terms": false // Disable the `internal-terms` dictionary
}

FAQ

See: FAQ

@alexdima
these are mine settings

{
  "breadcrumbs.filePath": "off",
  "breadcrumbs.symbolPath": "off",
  "editor.acceptSuggestionOnEnter": "smart",
  "editor.colorDecorators": false,
  "editor.cursorBlinking": "smooth",
  "editor.cursorStyle": "line-thin",
  "editor.detectIndentation": false,
  "editor.fontSize": 12,
  "editor.hover.enabled": false,
  "editor.minimap.renderCharacters": false,
  "editor.multiCursorModifier": "ctrlCmd",
  "editor.scrollBeyondLastLine": false,
  "editor.snippetSuggestions": "top",
  "editor.tabSize": 2,
  "editor.wordWrap": "on",
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,
  "files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/CVS": true,
    "**/.DS_Store": true,
    "**/node_modules": true,
  },
  "files.insertFinalNewline": true,
  "files.trimFinalNewlines": true,
  "files.trimTrailingWhitespace": true,
  "html.format.wrapAttributes": "force-expand-multiline",
  "window.closeWhenEmpty": true,
  "window.restoreFullscreen": true,
  "window.titleBarStyle": "custom",
  "workbench.commandPalette.history": 0,
  "workbench.editor.tabSizing": "shrink",
  "workbench.settings.editor": "json",
  "workbench.settings.useSplitJSON": true,
  "workbench.startupEditor": "newUntitledFile",
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "javascript.updateImportsOnFileMove.enabled": "always",
  "breadcrumbs.enabled": false,
  "editor.renderControlCharacters": false,
  "editor.renderWhitespace": "none",
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "diffEditor.renderSideBySide": true,
  "javascript.validate.enable": false,
  "search.searchOnTypeDebouncePeriod": 500,
  "git.openDiffOnClick": false,
  "workbench.colorTheme": "GitHub Dark",
  "svg.preview.mode": "svg",
  "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
  }
}

I haven’t touched them since the last update and highlighting stopped working.
--user-data-dir with this highlighting works. soo, should I delete my settings and start over?

0 / 0 / 0

Регистрация: 18.03.2021

Сообщений: 4

1

VS 2019

18.03.2021, 10:36. Показов 13781. Ответов 18


Добрый день!

Вчера перестало работать подчёркивание ошибок. IntelliSense показывает инфу по типам переменных, функциям и т.д., но подчёркивания ошибок нет. Любая чушь, введённая в поле с кодом, будет приниматься программой и в списке ошибок будет писаться «Проблемы не найдены» до того момента, пока не проведёшь отладку. Менял настройки по советам из интернета, сбрасывал настройки полностью, перезагружал и студию и комп несколько раз. Результата нет. Может быть, кто-то с этим сталкивался? Не хотелось бы сносить VS и ставить заново, но пока других вариантов я не вижу

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

18.03.2021, 11:22

2

forMax, а так пробовали

Кликните здесь для просмотра всего текста

Не подчёркиваются ошибки в Visual Studio 2019



0



0 / 0 / 0

Регистрация: 18.03.2021

Сообщений: 4

18.03.2021, 12:01

 [ТС]

3

Да, пробовал. Не помогает. Он не только не подчёркивает ошибки, но и не проверяет правильность кода при написании — то есть внизу будет указано 0 ошибок, даже если они есть и они очевидны



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

18.03.2021, 13:24

4

Лучший ответ Сообщение было отмечено forMax как решение

Решение

Может через Visual Studio Installer попробовать восстановить

Кликните здесь для просмотра всего текста

Не подчёркиваются ошибки в Visual Studio 2019



1



0 / 0 / 0

Регистрация: 18.03.2021

Сообщений: 4

18.03.2021, 15:12

 [ТС]

5

January29, спасибо, это помогло. Но частично. Теперь в новых проектах подсказки и исправления работают. А вот в старых, увы, проблема осталась. Благо, их у меня пока немного



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

18.03.2021, 15:24

6

Лучший ответ Сообщение было отмечено OwenGlendower как решение

Решение

Цитата
Сообщение от forMax
Посмотреть сообщение

А вот в старых, увы, проблема осталась.

Странно, наверно там когда ошибки, записывает какой то файл с ошибками. Может быть, я точно не знаю.
Попробуйте очистить и пересобрать проект.



1



0 / 0 / 0

Регистрация: 18.03.2021

Сообщений: 4

19.03.2021, 10:05

 [ТС]

7

January29, очистил, пересобрал и…. Оно заработало как надо. Спасибо огромное за помощь



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

19.03.2021, 10:28

8

forMax, не за что я рад что заработало



0



фрилансер

4483 / 3992 / 871

Регистрация: 11.10.2019

Сообщений: 10,515

19.03.2021, 15:47

9

January29, это лечится (возможно) так:

в любом открытом файле правой кнопкой мыши —

Не подчёркиваются ошибки в Visual Studio 2019



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

19.03.2021, 16:32

10

Алексей1153, Вот что то нет у меня вот этого

Не подчёркиваются ошибки в Visual Studio 2019



0



фрилансер

4483 / 3992 / 871

Регистрация: 11.10.2019

Сообщений: 10,515

19.03.2021, 16:58

11

January29, нуу, я не знаю, почему так )



0



Администратор

Эксперт .NET

15258 / 12296 / 4906

Регистрация: 17.03.2014

Сообщений: 24,900

Записей в блоге: 1

20.03.2021, 09:42

12

Цитата
Сообщение от Алексей1153
Посмотреть сообщение

в любом открытом файле правой кнопкой мыши —

Это вроде только для С/С++ файлов.



0



1 / 1 / 0

Регистрация: 30.11.2021

Сообщений: 4

21.01.2023, 10:28

13

Такая же проблема появилась на версии 2022 17.
Ничего не помогает. Удалял полностью. Сбрасывал настройки. Устанавливал заново. Не подчеркивает, пишет, что 0 ошибок в коде, но при компиляции пишет ошибки.
Не понятно что такое



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

21.01.2023, 14:32

14

Цитата
Сообщение от Tsarst
Посмотреть сообщение

Не подчеркивает, пишет, что 0 ошибок в коде

Пробовали с поста 2. Попробуйте через Visual Studio Installer восстановить студию, как в посте 4.
Может собачка зарыта в скрытой папке .vs, удалите её или переименуйте если не хотите удалять.
Но я думаю проект не так запускаете.
Ещё может быть наверно цвет волнистой линии для ошибок изменен в цвет фона.
Скриншот бы увидеть, с кодом и где ошибки.



0



1 / 1 / 0

Регистрация: 30.11.2021

Сообщений: 4

21.01.2023, 15:38

15

Цитата
Сообщение от January29
Посмотреть сообщение

Пробовали с поста 2.

Пробовал. Галка уже стоит. Пробовал убирать и заново ставить

Цитата
Сообщение от January29
Посмотреть сообщение

Попробуйте через Visual Studio Installer восстановить студию

Восстанавливал и переустанавливал несколько раз. Как будто настройка где-то сохраняется в другом месте.

Цитата
Сообщение от January29
Посмотреть сообщение

Может собачка зарыта в скрытой папке .vs, удалите её или переименуйте если не хотите удалять.
Но я думаю проект не так запускаете.

В инете видел этот совет и удалял. Дело в том, что не подчеркивает ошибки не просто в старом проекте, но и в новых.

Цитата
Сообщение от January29
Посмотреть сообщение

Ещё может быть наверно цвет волнистой линии для ошибок изменен в цвет фона.

Про это тоже читал. Менял цветовую схему на другую и возвращал обратно.
Где именно цвет подчеркивания менять?

Миниатюры

Не подчёркиваются ошибки в Visual Studio 2019
 



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

21.01.2023, 18:01

16

Tsarst, кажись нашел пробуйте
Путь к проблеме в строке меню в верху
Средства > Параметры…,
Текстовый редактор > C# > Дополнительно, переходим на право и там Показывать ошибки и предупреждения компилятора для: установить Текущий документ

Скрин

Не подчёркиваются ошибки в Visual Studio 2019



1



1 / 1 / 0

Регистрация: 30.11.2021

Сообщений: 4

21.01.2023, 18:40

17

Это то, что надо! Спасибо.



0



1872 / 1689 / 364

Регистрация: 17.02.2019

Сообщений: 2,691

21.01.2023, 18:52

18

Цитата
Сообщение от Tsarst
Посмотреть сообщение

Это то, что надо!

а что там было, если не секрет?



0



1 / 1 / 0

Регистрация: 30.11.2021

Сообщений: 4

21.01.2023, 18:56

19

Эта настройка была выключена. Установил на текущий документ, стало всё подчёркивать, показывать опечатки



1



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

21.01.2023, 18:56

19

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Подумайте как развитие индустриальной революции изменило социальную картину общества
  • Подтягивания основные ошибки
  • Подтормаживает смартфон как исправить
  • Подтормаживает айпад как исправить
  • Подтекание мочи после родов как исправить

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии