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.
Related
When I write C# code in VS Code and start typing some word and IntelliSense appears and focus on some suggestion I can press dot or space and this word appears in code.
But in python I strictly have to press Enter only if I want to get suggested word. Is it possible to make IntelliSense in Python behave like it behaves in C#?
Try changing the following lines to your settings.json file
"editor.acceptSuggestionOnCommitCharacter": true,
"editor.acceptSuggestionOnEnter": "on",
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
In addition to #DreamyPlayer's answer, add the following line to settings.json (or rewrite it, if key editor.inlineSuggest.enabled exists):
"editor.inlineSuggest.enabled": true
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
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,
I've just made the switch from Atom to VSCode.
When I used Atom and I'm typing JSX in .js files, I could type anything and press tab and it would turn what I tabbed into a custom component. For example, asdf and then tab would give <asdf></asdf>.
Now I have VSCode along with Emmet but this only works some of the time. I've experimented with Emmet and everything works except for basic custom components
All the HTML tags work as expected. i.e div.blue & tab return <div className="blue"></div>
Nesting works asdf>jkl & tab return
<asdf>
<jkl></jkl>
</asdf>
For some reason adding a colon triggers it. as:df & tab return <as:df></as:df> but asdf & tab does not return <asdf></asdf>. I just get my cursor tabbed forward.
I'm not sure whether Intellisense or Snippets are interfering in some way.
The relevant extensions I have installed are JavaScript and TypeScript Intellisense v0.0.7, Javascript Snippet Pack v0.1.5 and simple React Snippets 1.2.2.
And here are my settings:
{
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"prettier.singleQuote": true,
"prettier.jsxBracketSameLine": true,
"prettier.semi": false,
"prettier.useTabs": true,
"html.format.indentInnerHtml": true,
"workbench.colorTheme": "Base16 Tomorrow Dark",
"liveServer.settings.donotShowInfoMsg": true,
"window.zoomLevel": 0.5,
"editor.fontSize": 11,
"emmet.includeLanguages": {
"javascript": "javascriptreact"
}
}
I've found the answer. In settings add "emmet.triggerExpansionOnTab": true and it will work the way I want it to. By default it was set to false
I'm using VS Code to edit projects in multiple languages (mostly Ruby, PHP and Javascript) and for each language we have different indentation models (spaces/tabs and width). Looks like VS Code supports this as it allows both editor.insertSpaces and editor.tabSize to be set to "auto" which is a per-language definition.
But while editor.tabSize looks to do about what I want, editor.insertSpaces always insert spaces when in "auto" mode.
I've tried to find where one can edit the per-language configuration but have found no such setting. I've also looked in the language directories under resources/app/client/vs/languages but have failed to find something that specifies these features.
Any idea how to customize the per-language settings?
To use perlanguage settings, you use the [language_id] in square brackets:
example:
{
"[typescript]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[markdown]": {
"editor.formatOnSave": true,
"editor.wrappingColumn": 0,
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": false
}
}
Update: editor.tabSize and editor.insertSpaces are now supported in version 1.10