how to specify what's considered an error, so that I can get squiggly lines - visual-studio-code

I'm programming in C, and often times I see myself forgetting to type the '&' when using scanf. I've used replit in the past and there, in that case the variable gets a squiggly underline showing it's wrong. Is there any way I could configure this in VS Code, in other words, can I specify what's considered an error?

Add the C/C++ extension from Microsoft. It will add IntelliSense
Use this link to learn how to add extensions: LINK
Use this link to read about customizing IntelliSense for your needs: LINK
(unless it already does what you need)

Related

VS Code, Syntax highlighting Powershell

Ive been scratching my head with this one. Previously VS Code highlighted Powershell scripts and modules just fine with highlighting functions in yellow and variables $var in light blue. Both as part of a string and "stand-alone". However, suddenly it doesn't highlight functions or variables anymore? I've tried to uninstall and reinstall the powershell extension from Microsoft, as well as disable and re-enable the built in language support for powershell.
I've not been able to find any support regarding this issue and hope that I might be able to find it here.
Have you tried this?
File Association.
Basically:
The easiest way I've found for a global association is simply to Ctrl+k m (or Ctrl+Shift+P and type "change language mode") with a file of the type you're associating open.
In the first selections will be the option "Configure File Association for 'x' " (whatever file type - see image attached). Selecting this gives you the option to choose the language and will then make the filetype association permanent.
if you start your code block with a ```PowerShell it will highlight the syntax properly.
I've noticed that you may also need to end your code block with a ``` in VSCode specifically.

How to know which extension provides what snippets in VSCode

I've installed many code snippet extensions in my Visual Stuidio Code, but when I considered to use them, I got several snippets choices with a same input. I cannot tell which one should I use.
Now I have to disable some extensions. How can I find out what extensions that each snippet is provided by? or what snippets an extension is providing?
Select a code snippet, and the extension name is showed in the hint window near the auto completing window.

How can I prevent html tags from being red underlined inside of .ejs files?

If I start an .ejs file with a tag like h1, it is underlined in red, like VSCode expects me to add the whole typical html boilerplate. However, I have seen many videos where the host doesn't get this underlining.
I have tried extensions, I have modified the settings.json with "*.ejs": "html", but nothing works.
Do you know how I can get rid of it without having to add DOCTYPE, , etc.?
So after figuring out that this problem caused by a lint or other validator (in this case W3C Validator) installed as an extension in Visual Studio Code, you can disable its warnings by going to extensions and disable the validator.
However, those tools are here for a reason :) and they help us write better code that fits to known standards and syntax issues, so disabling them is less recommended. (Although it can become bit annoying while using external third-party libs which can be can some warnings by that validator too - for that, some lints offers ignoring logic which let you ignore some of the files or lines in the code).
Good Luck, Happy coding!

VS Code - Text formatting in a new language extension

I'm building an extension providing a syntax highlighting for the 'Jack' language used in an online course I am taking (Nand2Tetris at Coursera - it is not a part of the course assignment). I have the syntax highlighting rules ready, but I would like to add custom formatting for some language elements. In particular, I would like type definitions to appear in italic.
I know how to change the user settings to get the desired result on my VS Code installation, but I would like that formatting to be the default behavior for anyone using the extension.
I've tried to create a new theme extension and then copy paste the 'themes' folder from it to the 'syntax' extension and reference the file from that folder in package.json, but it didn't work. I also tried adding the 'configuration' setting in the 'contributes' section of package.json, without success. I browsed numerous VC Code extensions on GitHub and couldn't find one providing similar functionality.
Is it even possible to provide syntax definition and 'theming' in one extension? If so how?
Based on VS Code Semantic Highlight Guide, besides syntax highlighting rules, you'll also need
Implement and register a Semantic token provider in your extension.
Declare Enablement of semantic highlighting in settings.json.
Customize tokens in Theming.
VS Code team kindly provides a Semantic tokens sample. Note that this example skips step 3 and customizes tokens directly in settings.json.

VSCode Error/Warning Validation Decoration Setting

10 shillings to whomever can tell me how to switch the error/warning decoration in vscode from a squiggly underline to an outline. It's what I am used to in Sublime Text, but I cannot seem to find the option to change it in vscode. Perhaps it is not possible? Knowing that would be a sufficient answer too.
As far as I know, there isn't a setting for this.
There IS an extension point for decorating text that would allow this, but as far as I know it isn't possible to access the errors for a file from the API to decorate the text. You can create new ones, but I don't believe it is possible to access existing errors.
tl;dr - I don't think this is possible at the moment.
`Microsoft/vscode issue 9209 points out more recently (2019/2020) to:
Error Gutter: This is the VSCodium (or Visual Studio Code) version of error gutters available in other text editors, such as Sublime Text or Atom.
And:
Error Lens: ErrorLens turbo-charges language diagnostic features by making diagnostics stand out more prominently, highlighting the entire line wherever a diagnostic is generated by the language and also prints the message inline.