VSCode Code Spell Checker extension - Include TXT files - visual-studio-code

I'm using the VSCode Code Spell Checker, and I wish to detect typos in TXT files. But the issue is, that I want to detect it on TXT files that are being ignored for search by the VSCode.
Here is my settings.js file:
{
"cSpell.words": [
"BING",
"DOGPILE"
],
"search.exclude": {
"**/.vscode": true,
"**/dist": true,
"**/misc": true,
"**/misc/documents": true,
"**/misc/": true,
"/misc/": true,
"misc/**": true,
"**/misc/**": true,
"**/misc/documents/**": true,
"**/node_modules": true,
"**/sources": true
},
"eslint.validate": [
"javascript"
],
"http.proxy": "",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": false,
"editor.renderWhitespace": "none"
}
The file that I want to detect typo located inside the misc directory, that is declared in the "search.exclude" list (I don't want search results from any files in this directory), but I DO WANT to detect typos on theses files.
If I remove all of theses and the settings.js looks like that:
{
"cSpell.words": [
"BING",
"DOGPILE"
],
"search.exclude": { },
"eslint.validate": [
"javascript"
],
"http.proxy": "",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": false,
"editor.renderWhitespace": "none"
}
The TXT file typo detection works, but I get the search results that include files inside the misc directory, which is NOT what I want.
Has anyone faced this issue before and know how to solve it?
Thanks.

as it is explicitly stated in Spell Checker FAQ
What files are excluded by the spell checker?
By default the spell checker excludes the same files excluded by the VS Code search.exclude setting. See discussion: #16, #55 and #95
the correct way to address the problem exposed in the question I would say is to open an issue to the project for a new feature request to allow to override this default behavoir.
as a last resort if you absolutely need to prevent search.exclude from being added to the exclusions you could try to force the code installed on your machine and after restarting vscode you will have the spell check working also in those paths.
DISCLAIMER please note what is illustrated below is a discouraged hack mentioned in here for informational purposes only, obviously if you try this kind of workaround you must be extremely aware of what you are doing
for example:
assuming the extension was installed in ~/.vscode/extensions/streetsidesoftware.code-spell-checker-1.10.2
in the source server/config/documentSettings.js there is the function async fetchSettingsFromVSCode(uri) where it is added :
ignorePaths: ignorePaths.concat(CSpell.ExclusionHelper.extractGlobsFromExcludeFilesGlobMap(exclude)),
by changing in to
ignorePaths: ignorePaths
then quit fron vscode and when re-open it the extension no longer excludes the same files excluded by the VS Code search.exclude setting.

Related

VSCode Code Spell Checker extension - include .todo files

I'm using vscode extension for spell checking:
https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker
The problem is - I can't include ".todo" files type. (my .todo files are not in any markup language. They are just "plain text").
I tried(none works for me):
"cSpell.files": ["**/**.todo"] (also turns off all existing files check)
"cSpell.enableFiletypes": [ "*" ] to inclue all fiels types
I notice there is a languages list, but didn't find way to add new one.
Try adding the following cSpell override to your .vscode/cSpell.json file:
{
"name": "lorem ipsum",
"enabledLanguageIds": ["plaintext"], // etc.
"overrides": [
{
"filename": "**/*.todo",
"languageId": "plaintext"
}
]
}
I found out, that by default spell check extension ignore all files from .gitignore.
In my case solution was to add following Modifications in my vscode user settings:
"cSpell.enableFiletypes": [
"todo" // enable .todo files checking
],
"cSpell.useGitignore": false, // disable ignoring files from .gitignore
Thanks to everyone who tried to help me!

How can I get Web API autocomplete/IntelliSense in VSCode?

I'm using VSCode for web development and I noticed that there is no JavaScript autocomplete/IntelliSense for browser-related types such as Element nor functions such as document.querySelector(). Is there an extension for this that anyone has found?
// tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"alwaysStrict": true,
"checkJs": true,
"outDir": "./root/js",
"rootDir": "./src",
"target": "ESNext"
},
"exclude": ["./root/**/*"],
"include": ["./src/**/*"]
}
I was starting to type out document.querySelector() and noticed halfway through that autocomplete wasn't triggering. I triggered it manually (Ctrl-I) and got no suggestions.
For clarification, I'm looking for something that will do this, but with frontend code:
Tried searching for extensions in marketplace, on Google, in VSCode itself - to no avail.
The issue is that the lib field (tsconfig.json or jsconfig.json) hasn't been set to include "dom", which tells the TypeScript compiler (and VS Code's TypeScript support) to include types for web APIs like the DOM.
Fun fact: If you leave the lib field empty, TypeScript will assume certain things to be in it "by default". For more info on that, see this answer I wrote to "How can I make vscode assume a node.js context, so that it doesn't assume fetch exists?"
Turns out #user was right — I needed to add this to my tsconfig.json:
{
"lib": [
"DOM"
]
}

vscode emphasises in red my project due to something inside `.terraform` folder despite explicitly telling it to ignore it

I have tried to configure every possible thing I can find in vscode to make sure that the .terraform folder gets ignored, but nothing seems to have done the trick.
Current configs:
"search.exclude": {
"**/.terraform/**": true
},
"files.watcherExclude": {
"**/.terraform/**": true
},
"files.exclude": {
"**/.terraform": true
},
The folder is indeed excluded from search and the explorer on the left, but the parent folder remains emphasised in red.
Any ideas how to get around this?

How to add a new match/mapping for an existing language?

Thanks to an extension (Caddyfile Syntax, Caddyfile Support) I have highlighting for Caddyfile. Installing the extensions also mapped Caddyfile files with the relevant syntax highlighting rules.
I now would like to also have the same mapping for caddy.conf files.
According to the documentation, I should add an alias for caddy.conf so that it is handled the same way as Caddyfile.
The problem is that I do not know where to add this information in settings.json.
I had a look for anything "caddy" in defaultSettings.json but I do not see any structure that would match th eone in the documentation. Namely, I only see
// Configure settings to be overridden for the caddyfile language.
"[caddyfile]": {
"editor.insertSpaces": false,
"editor.formatOnSave": true
},
What I am looking for should more look like (according to the documentation above)
"languages": [{
"id": "java",
"extensions": [ ".java", ".jav" ],
"aliases": [ "Java", "java" ]
}]
So in practical terms - where in setting.json should I add the alias (or possibly a new mapping)?
Try adding this to your settings.json:
"files.associations": {
"*.conf": "caddyfile"
}
Alternatively, you can invoke the workbench.action.editor.changeLanguageMode command (Ctrl+K M by default, also works by clicking the language label in the status bar) and select the language you want. This is probably preferable if you might have files with the same extension, but different syntax.

Lua extension in vscode suddenly adding stuff to my code

I am using the sumneko extension for lua in vscode.
I was editing the settings.json to try to stop autocomplete in comments, but somewhere in the process, I messed something up, and now in my code I am seeing extra words, such as:
require 'utils'
becomes:
require modname:'utils'
I'm also seeing :table, :integer, :string, etc, so it looks like the highlighter is analyzing the status of function arguments, and adding that as text. I'd love if it changed the color, rather than adding the text, but I've yet to find any setting that looks like it would do that.
The new characters do not copy, so are display only, I suppose. They seem like useful information, and I wonder if they are supposed to be showing up as highlighting instead?? That would be nice! But still they are very confusing to see in my code... I am using the default dark theme.
Can someone tell me what setting I inadvertently turned on? Also, I am still getting auto-complete in comments, despite turning it off. I'm also seeing word completion, although the delay seems to work. I don't know if the issues are related. Can you see anything wrong in my settings file? It is not showing any syntax errors.
Here is the settings.json file:
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.quickSuggestions": { "other": false, "comments": false, "strings": false },
"editor.quickSuggestionsDelay": 1000,
"editor.wordBasedSuggestions": false,
"editor.semanticHighlighting.enabled": true,
"Lua.workspace.library": {
},
"explorer.confirmDelete": false,
"git.confirmSync": false,
"diffEditor.renderSideBySide": true,
"git.enableSmartCommit": true,
"Lua.awakened.cat": false,
"Lua.completion.callSnippet": "Both",
"files.trimTrailingWhitespace": true,
"workbench.enableExperiments": false,
"workbench.sash.size": 6,
"workbench.startupEditor": "newUntitledFile",
"Lua.hover.viewNumber": false,
"Lua.hover.viewString": false,
"Lua.intelliSense.searchDepth": 10,
"Lua.completion.workspaceWord": false,
"Lua.diagnostics.workspaceDelay": 1000,
"Lua.diagnostics.workspaceRate": 70,
"Lua.hover.previewFields": 20,
}
and here is the workspace settings.json file, in case that matters:
{
"Lua.diagnostics.globals": [
"gfx",
"reaper",
"GetRGB",
"RandomColor",
"MButtonPanel"
],
"Lua.diagnostics.disable": [
"unused-function",
"undefined-global",
]
}
Okay, I discovered the developer's github site had a q&a forum, and he answered the question about the display-only items. It was a setting, with a non-obvious (to me!) name:
hint:param type
that mysteriously got turned on...
Just in case someone else comes here looking.
I am going to make the assumption that those contextual "display only" items are a feature and you won't be able to change that.
However, worst case you can always go into the C:\Users\YOU\.vscode\extensions\TheLuaExtension\ folder and edit the package.json file to read like you have above...
"editor.quickSuggestions": { "other": false, "comments": false, "strings": false },
My point is, the information is coming from somewhere, if it is ignoring your personal settings, then change the definition it is using.