Can't get VScode to trimFinalNewlines - visual-studio-code

I just turned into a VScode developer from Atom. I have worked out all of the things needed to keep same, if not better workflow here but one thing bugs me alot. VScode will not remove empty lines at the end of the file.
My settings.json looks like this:
"files.autoSave": "onFocusChange",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"workbench.colorTheme": "Solarized Dark",
"atomKeymap.promptV3Features": true,
"csscomb.formatOnSave": true............muchmore:)
Do I need to order the "files.insertFinalNewline": true, "files.trimFinalNewlines": true in another way? or is it something else I have done wrong?
Can't seem to find anyone else having this problem anymore since they introduced this to VScode..

Related

Wrong formatting on save on VSCode

VSCode started to format my code in the wrong way.
E.g. I set it to use single quotes but VSCode changes it to double quotes on save.
I’ve disabled all extensions which could format code except for Prettier, checked all Prettier settings for User and Workflow (they are the same for now), and set Prettier as a default formatter for all types of files which I am working with.
But still, a code is formatted in the wrong way.
What else do I need to check to find what exactly format my files on save? How to fix this problem?
settings.json:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"prettier.arrowParens": "avoid",
"prettier.jsxSingleQuote": true
}

Move position of underline for Rust in Visual Studio Code

I'm using a reduced line height in VS Code to fit more code on screen, which has served me pretty well for my mostly-web work.
Now I'm dipping my toes into Rust and VS Code helpfully underlines mutable variables. The underline is pretty far from the text though and interferes with the next line:
VS Code is so very customizable, is there a way to move that line a few pixels up?
I'm not looking to disable it, but I would also consider alternative highlighting (e.g. background, bold, italics).
I'm not sure what your VSCode settings are, but they are most certainly non-standard.
This is what it looks like at my screen:
You can look at your settings by doing Ctrl + , and clicking Open Settings (JSON) in the top right corner.
Those are my settings:
{
"breadcrumbs.enabled": true,
"editor.formatOnSave": true,
"editor.renderWhitespace": "boundary",
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"telemetry.telemetryLevel": "off",
"window.titleBarStyle": "custom",
"workbench.editor.showTabs": false,
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"workbench.startupEditor": "none",
"workbench.enableExperiments": false,
"workbench.tree.indent": 24,
"workbench.tree.renderIndentGuides": "always",
"editor.detectIndentation": false,
"crates.useLocalCargoIndex": false,
"rust-analyzer.cargo.features": "all",
"window.zoomLevel": 1
}
If you configured the line distance that short on purpose, I'm not sure if you can actually modify the underline position. You could disable the underline, however: How do I disable the underlining of Rust variables and their methods in Visual Studio Code?
But I think the underline serves an important purpose, so I myself would increase the newline distance in your editor.

VSCode no longer formats on save

About every couple months, VSCode "formats on save" stops working.
This is mostly for Javascript, React and HTML.
I have prettier installed.
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.formatOnSave": true
},
If this the correct way to do it? Is there anything else I can do to future proof this?
It is a little frustrating to have this always break.

Not seeing how to disable typing auto-suggest drop-down in VS Code

This seemed to have happened with a recent update, but when I start typing anything that could have a suggestion, it drops down a box showing potential completion suggestions; it obscures code and is distracting, and I only want it to happen when I manually activate it, like with Ctrl+Space.
However, I'm not finding the option to stop it from happening while typing... the best I can find is in File > Preferences > Settings > Editor: Quick Suggestions (Controls whether suggestions should automatically show up while typing.), which just has a link to "Edit in settings.json", when I click that I get these options:
{
"editor.hover": false,
"editor.wordBasedCompletion": true,
"editor.parameterHints": false,
"editor.parameterHints.cycle": true,
"editor.hover.delay": 3000,
"editor.hover.sticky": false,
"editor.parameterHints.enabled": false,
"liveServer.settings.donotShowInfoMsg": true,
"files.autoSave": "onWindowChange",
"editor.fontSize": 12,
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"debug.node.autoAttach": "on",
"terminal.external.windowsExec": "C:\\Program Files\\Git\\git-bash.exe",
"terminal.explorerKind": "external",
"editor.quickSuggestionsDelay": 0,
"workbench.colorTheme": "Default Light+",
"editor.suggestOnTriggerCharacters": false,
}
Everything looks correct there... I change a few and it doesn't fix it. I'm not sure what I'm supposed to click or whatever to disable this annoying feature.
I am using 1.36.1
I think the setting you are looking for is
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false,
}
Please add it in settings.json

When trying to enter a ctrl sequence I affected the screen display

While coding I hit some ctrl keys and totally lost my screen display. The font size has to be 60px! Removed Vs code from Control Panel and deleted settings.json. Downloaded and installed latest Vs code. When Vs code was brought up I started entering values. Added values from saved settings.json file before deletion. Problem returned.
Deleted vscode program via Control Panel, deleted settings.json.
Downloaded and installed latest release of Windows 10 VSCode
Started reentering settings.json values.
Problem returned. Feel like it is a UI problem??
{
"workbench.startupEditor": "newUntitledFile",
"workbench.iconTheme": "vscode-icons",
// Controls the font size in pixels.
"editor.fontSize": 8,
// Controls if the editor should automatically adjust the indentation when
// users type, paste or move lines. Indentation rules of the language must be
// available.
"editor.autoIndent": true,
// The number of spaces a tab is equal to. This setting is overridden based
// on the file contents when `editor.detectIndentation` is on.
"editor.detectIndentation": true,
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.wordWrap": "on",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"workbench.colorTheme": "Oceanic Next (dimmed bg)",
"editor.minimap.enabled": false,
"files.autoSave": "off",
"window.zoomLevel": 21,
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"explorer.confirmDelete": false,
"vsicons.dontShowNewVersionMessage": true,
// Enable/disable built-in PHP validation.
"php.validate.enable": true,
// Points to the PHP executable.
"php.validate.executablePath": "C:/Program Files/PHP/php.exe",
"phpfmt.php_bin": "\"C:\\Program Files\\PHP\\php.exe\"",
}
Tried to include several screen dumps but could not figure out how to do it.
I can best describe the problem as trying to display a 60" TV screen on a 15" Laptop Monitor.
I had the same problem. For me it was this line in settings.json:
"window.zoomLevel": -1,
Setting it to the following solved the issue:
"window.zoomLevel": 0,