Keybindings "value is not accepted" (after the 1.40 update) - visual-studio-code

I have several entries in my keybindings.json file. Yesterday, shortly after updating to the October VSCode release, I tried adding a few new keybindings through the "Keyboard shortcuts" widget via the Command Palette, but encountered the following error:
I checked for errors in my keybindings.json file (full copy here), and all I have are entries like the one below.
What's strange about this:
I only have warnings, yet VSCode complains about errors
All of these errors are tied to emacs-mcx from this extension (for reference I opened an issue with them here just in case)
With this in mind:
How does VSCode check for values that it can accept? (the warning says "Value is not accepted")
Can I tell VSCode to ignore those problematic entries? (there is no syntax error per se)
If all I have are warnings, why does VSCode complain about errors in the file?

This was apparently a bug that VSCode resolved here after I created an issue tied to this question (coming out in the October recovery release)
This is because the parser needs option allowTrailingComma to be set to true. It was default to true before.
#aeschli Looks like this was added in last milestone and not adopted
in keybindings service.
Patch here

Related

VSCode: set terminal shell on workspaces after latest update

On VSCode, if I needed a different terminal shell on a certain workspace, I had added the following setting in the workspace file (.code-workspace):
"settings": {
"terminal.integrated.shell.windows": "path\to\the\shell.exe"
}
After the latest update (April 2021 - version 1.56) this doesn't work anymore and I get this warning:
This is deprecated, use #terminal.integrated.defaultProfile.windows# instead
If I replace the setting name with the suggested one I get:
This setting can be applied only in application user settings
How can I set a different terminal shell per workspace?
Unfortunately, here is the same issue: https://github.com/microsoft/vscode/issues/123031 from https://github.com/microsoft/vscode/issues/123133.
Issue 123133 was closed 05/05/2021 with a temporary fix, see that issue and https://github.com/microsoft/vscode/commit/006591a7cfa31b9778e712b742b6e37f4afd0ed9. Here is my Insiders Build workspace settings file after the fix:
Note the previous error message is gone. I suspect that this "fix" will be in a point release to v1.56 fairly soon rather than waiting for v1.57.
As zendu pointed out, there's an open issue about it with a temporary fix:
A temporary fix was added to re-enable workspace shell settings when "terminal.integrated.allowWorkspaceConfiguration": true is set #122104
I tried it and it seems to work (at least for now).

How to enable real-time linting while typing with rust-analyzer in VSCode?

I have rust-analyzer extension in VSCode.
In settings I only changed Rust-analyzer › Check On Save: Command from check to clippy (this shouldn't matter).
Problem is I don't see errors when I type, only after I save.
Typed (no error):
Saved (can see error):
Can it be changed?
Problem is I don't see errors when I type, only after I save.
Rust-analyzer does not support real-time linting (yet?).
In short, rust-analyzer essentially runs cargo check. For small projects this can be quite fast. However, as project sizes increase, this can take significantly more time, which makes it unfeasible to check in real-time.
See also issue #4185 and "Drawbacks" on the "First Release" post.
The next best thing you can do (as you already know), is to use "check on save":
"rust-analyzer.checkOnSave.enable": true
(which is enabled by default in the VSCode extension)
You could:
Enable autoSave in your settings.json file within the .vscode folder.
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 20,
Install Error Lens extension for vscode:
https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens
This way you'll get inline errors while writing rust code.

bizarre problem in visual studio code with renaming a file (F2) - goes out of edit mode

When I highlight a file and hit F2, the file is normally replaced with an edit box where you can rename it.
After a few seconds, the edit box goes away and you need to quickly type the different file name (every time). I'm not sure what could cause this - any idea?
I'm on Ubuntu 20.04.1 LTS, Visual Studio code 1.52.1
Thanks
This looks like a bug reported in a few issues since v1.52 that all point to this one:
https://github.com/microsoft/vscode/issues/111652
also https://github.com/microsoft/vscode/issues/112555 and https://github.com/microsoft/vscode/issues/112438
It is reported in 111652 as fixed in the Insiders' Build. Can you test it there? I can't reproduce in Stable Build, W10.

Why does vscode pylint miss obvious errors?

I have a python file open in Visual Studio Code with an obvious error (using an undefined variable) but the pylint issues listed under 'Problems' show only a long list of minor convention issues.
Running pylint manually on it (separately from vscode) spots the error fine. The error is not explicitly excluded by any vscode pylint-related configs as far as I can see.
Eventually I discovered this was due to the following default setting in vscode:
"python.linting.maxNumberOfProblems": 100
Editing this config to a higher number (e.g. 1000) made the error show up.
Evidently this limit is applied blindly to the pylint output in the order the problems are found, so if enough minor issues precede an error then the error will be hidden - not ideal.

How to prevent Visual Studio Code from always reopening the previous files or folders?

Visual Studio Code always seems to remember my session and reopen the files and/or projects that were open the last time I used it. It obviously behaves correctly when running it from the command line with a file or folder supplied, but when opening from a taskbar shortcut, I'd like it to default to an empty environment.
Is there any way to change this behavior?
You can also go into your settings and use the following:
"window.reopenFolders": "none"
which will not reopen the folders you were working on when you closed the editor. The other options are one (the default) and all.
Edit 2017-11-09:
The option is now changed in latest versions.
"window.restoreWindows": "none"
See Mathieu DOMER's answer.
Edit 2018-09-12:
Another setting related to this is the hotExit setting. This has been discussed in this answer to a related question. To prevent reopening and remembering unsaved files, you can set this to:
"files.hotExit": "off"
But from the test I've made, when the window.restoreWindows setting is set to none, this is not needed. I haven't tested every possible combination, so YMMV.
And to answer a question in the comments, to edit the settings, you have to open the settings file. Some documentation can be found here (at least on the date I am writing this).
Edit 2022-03-16:
If you prefer using a GUI to change the settings, see D'Arcy Rittich's answer.
In VS Code:
for Windows/Linux Ctrl+, (or choose File/Preferences/Settings) to open the settings page.
for Mac ⌘+, (or choose Code -> Preferences -> Settings) to open the settings page.
then type restoreWindows in the Search settings input to filter for this setting. Set it to none and restart VS Code.
With latest update, it seems that the parameter has changed, now use:
"window.restoreWindows": "none"
You can add the -n option to the startup of VS Code and it will always start with an empty window, not restoring your previous session.
01 December 2018
This works for me. i.e. "C:\Users\Sampath\AppData\Local\Programs\Microsoft VS Code\Code.exe" -n
For me, none of above is working while I'm trying to close "dirty" unsaved files which I accidentally edited 1000 files and wanted to ignore saving all of them.
My fix was adding this line into settings.json:
"files.hotExit": "off"
Open up vscode, close vscode and just click the confirmation button to close all of the files without saving.
Then open back vscode and boom.. no more unsaved files being shown.
If "window.restoreWindows": "none" not solve the problem,then try to run code as root -> sudo code --user-data-dir code files and restart code normally without root.
Below worked for me
Right-click on Shortcut and add --disable-gpu to Target as per screen shot.
For me the only solution that worked was to go to the solution root and delete the .vs folder.
I reinstalled Visual Studio Code by downloading the latest update. I did not have to uninstall the previously installed Code. It work ok for me now.