Disable Auto Replace Visual Studio Code - visual-studio-code

I want to save the following code:
But after saving Visual Studio is replacing this.modalHelpContent['offsetHeight'] by this.modalHelpContent.offsetHeight and sets it with an error:
I am trying to look for where I can remove this autocomplete, but I can't find it.
Btw, the declaration of that variable is " #Input() modalHelpContent: ElementRef;"
Can someone help me please?

Try turning off "Format On Save" in your settings either through the GUI or JSON:
"editor.formatOnSave": false

Related

Remove blue box text on vscode rust (Im using rust-analyzer) [duplicate]

For VS Code, I use rust-analyzer to handle syntax highlighting and flychecking.
How do I remove the inlay type and parameter annotations in grey below?
In Visual Studio Code you can easily do this.
Open the settings page (Ctrl+,)
Search for "rust-analyzer inlay"
Uncheck things you don't want
In your case that would be "Parameter Hints" and "Type Hints"
If you're not using Visual Studio Code you'll need to manually edit the JSON config file of rust-analyzer (helpful link to the documentation). Basically
Open the JSON config file in your favourite text editor
Add a new property to the root of the JSON object like so:
{
"inlayHints": {
"typeHints": false,
"parameterHints": false
},
// further configuration
}
Update Sept 2022.
They now use VSCode builtin inlay function from 1.67
I setup mine as follow:
{
"editor.inlayHints.enabled": "offUnlessPressed"
}
Then you can toggle them with Ctrl + Alt pressed.
Old Answer
There is now a togglable command (ctrl+shit+p) : Rust Analyzer: Toggle inlay hints

How can I remove type annotation help when using rust-analyzer?

For VS Code, I use rust-analyzer to handle syntax highlighting and flychecking.
How do I remove the inlay type and parameter annotations in grey below?
In Visual Studio Code you can easily do this.
Open the settings page (Ctrl+,)
Search for "rust-analyzer inlay"
Uncheck things you don't want
In your case that would be "Parameter Hints" and "Type Hints"
If you're not using Visual Studio Code you'll need to manually edit the JSON config file of rust-analyzer (helpful link to the documentation). Basically
Open the JSON config file in your favourite text editor
Add a new property to the root of the JSON object like so:
{
"inlayHints": {
"typeHints": false,
"parameterHints": false
},
// further configuration
}
Update Sept 2022.
They now use VSCode builtin inlay function from 1.67
I setup mine as follow:
{
"editor.inlayHints.enabled": "offUnlessPressed"
}
Then you can toggle them with Ctrl + Alt pressed.
Old Answer
There is now a togglable command (ctrl+shit+p) : Rust Analyzer: Toggle inlay hints

Visual Studio Code / VS Code: Turn off Cursor line/Current line Highlight option

I'm not sure how I made this feature but I can't stop highlighting the cursor line. As you can see, I have a green underline at the position of the cursor line.
This feature is good if you do not use .ipynb/jupyter file but if you do you can see this:
I have looked all settings and also deleted .json setting file parameters to be sure not there but did not work.
Does anyone knows the exact parameter name that I can turn off this feature?
I have similar issue, but later I found that is the column select mode. You need to remove it from the setting.json
"editor.columnSelection": true

Prettier Code Formatter for VS code fails with 'No loader specified for extension ".cjs"'

In VS Code, When I select Format Document With... then choose Prettier - Code Formatter, I get the following error:
Command 'Format Document' resulted in an error (No loader specified for extension ".cjs", so searchPlaces item ".prettierrc.cjs" is invalid)
From what I can gather this has something to do with underlying TypeScript in VS Code not having a loader available for .cjs files and Prettier searching for prettierrc.cjs but I can't quite see how that all fits together, or how to work around it.
Has anyone else encountered, found a work around or solved this or a similar issue in VS Code?
I tried disabling the Prettier VS Code extension and enabling it again and that fixed the issue for me.
Credits #NikolajDamLarsen

Visual Studio Code html formatting doesn't work

Code formatting doesn't seem work in Visual Studio Code. I have tried with shift+alt+f, but it wouldn't format html code. I run ctrl+shift+p and type Format and only option I have is Format Document(shift+alt+f) and Format Selection (don't have Format code). I don't understand what I' doing wrong? Do I need to install some kind of extension in order for this formatting to work on html files?
This worked for me:
Right click inside html file that is being edited.
Select "Format Document With...".
Selected "Configure Default Formatter ...".
Changed from "Prettier - Code formatter" to "HTML Language Features".
This worked for me in Visual Studio 2015 (VS2015):
Right-click on the code window with the HTML you want to format
Click 'Un-minify" in the popup menu.
That worked for me when Format Document (Ctrl-K, Ctrl-D) and Format Selection (Ctrk-K, Ctrl-F) failed to format HTML that I pasted into a Visual Studio HTML document.
There are two scenarios here
You are editing an html file with a non-standard html extension. Find fix #1 below.
You are editing a non-html file with html embedded. For this scenario find fix #2.
Both fixes involve installing the Beautify extension so do that first.
Fix 1
To fix this issue, you will need to update your js-beautify extension properties to include those types. From the Beautify documentation:
You can contol which file types, extensions, or specific file names should
be beautified with the beautify.language setting.
{
"beautify.language": {
"js": {
"type": ["javascript", "json"],
"filename": [".jshintrc", ".jsbeautifyrc"]
// "ext": ["js", "json"]
// ^^ to set extensions to be beautified using the javascript beautifier
},
"css": ["css", "scss"],
"html": ["htm", "html"]
// ^^ providing just an array sets the VS Code file type
}
}
Fix 2
In this case when you run the beautify command (after installing the extension) it will prompt you for the language type. Select html and voila.
You might have some error in your html document like maybe you forgot to close a tag. I had the same problem but after fixing that error code formatting works well. If you have a large file then try pasting your code here and validating it here