I'm going crazy, VSCode is giving me this error EVERYWHERE (including js files and .gitignore .dockerignore files, even for simple lines such as node_modules in .gitignore)
I need some ideas
my config file
{
"workbench.iconTheme": "vscode-icons",
"workbench.colorTheme": "One Monokai",
"vsicons.dontShowNewVersionMessage": true,
"editor.formatOnSave": true,
"editor.tabSize": 4,
"prettier.tabWidth": 4,
"editor.tabCompletion": "on",
"prettier.singleQuote": true,
"prettier.printWidth": 80,
"window.zoomLevel": 0,
"editor.acceptSuggestionOnEnter": "off",
"editor.minimap.enabled": false
}
My extensions are pretty standard
prettier
react snippets
docker
sass
eslint
some random themes
editor config
graphql
auto-import
This issue randomly appeared for me today as well.
This process worked to solve it on my system, although I don't know what actually caused the issue.
restart vscode
check for a vscode update
(optional) Restart system
If 1-3 don't work you can try
In the command palette run Extensions: Disable All Installed Extension
These steps worked for me when this issue started popping up after installing macOS 10.15 Catalina.
Reinstall node.js using nvm, e.g. nvm install 10 && nvm use 10 to install and use the latest node.js 10.x version (pick your preferred version)
Reinstall eslint via npm i -g eslint
Restart VS Code
Related
I am trying to get PEP8-naming working on my VSCode (Version: 1.72.2 (Universal)) without luck.
I have flake8, isort and mypy enabled in my code and this all works as expected. I have installed pep8-naming (conda install -c conda-forge pep8-naming) and it shows in my flake8 version info:
flake8 --version
4.0.1 (mccabe: 0.7.0, naming: 0.13.2, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.8.13 on Darwin
However, I am not seeing the errors for naming conventions showing in my VSCode editor.
I have the following set in my settings.json file
{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.pycodestyleEnabled": true,
"python.linting.pycodestyleArgs": ["--max-line-length=120"]
}
What am I missing so as to be able to see (for instance) that variables are named in Camel case rather than lower case with underscores?
I have tried this without any luck.
I have been using flake8 for linting but somehow it stopped showing me errors in the code in any of my workspaces (the squiggly underlines in the editor).
flake8 is installed in my conda environment.
Here is my settings.json:
{
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--max-line-length=80",
"--docstring-convention=google",
"--verbose"
]
}
When I run flake8 from the console, it does show me the errors.
I am using VS Code version 1.72.2 on Windows, and I installed flake8 version 5.0.4. Any idea what could be wrong with it?
Open Command Palette and type in Linter. Select the option Python: Select Linter and it opens up all the available linters.
In the drop down, select Flake8 and if required install it.
That should work now!
I run Jupyter on a remote server via ssh inside VSCode. Everything works fine except that Jupyter does not create any checkpoints. However, it creates empty .ipynb_checkpoints folder.
If I start the browser version of Jupyter Notebook from the VSCode terminal, it saves checkpoints with no problems. I prefer the VSCode extension over regular Jupyter because it enables autocompletion and lots of other features. Still, I feel unsafe about not having an option to revert to a checkpoint.
Any suggestions on what might be wrong and how I could fix it?
VSCode version: 1.63.0
Jupyter Extension version: v2021.11.1001550889
settings.json
"remote.SSH.remotePlatform": {
"remote_server": "linux"
},
"terminal.integrated.inheritEnv": false,
"notebook.lineNumbers": "on",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"workbench.iconTheme": "material-icon-theme",
"window.autoDetectHighContrast": false,
"workbench.colorTheme": "Visual Studio Light",
"editor.fontSize": 15,
"notebook.output.textLineLimit": 100,
"breadcrumbs.enabled": false,
"checkpoints.addCheckpointOnSave": true,
"checkpoints.askForCheckpointName": false,
"jupyter.generateSVGPlots": true,
"files.autoSave": "onFocusChange"
}
Thank you for the help!
Background
In a repo, we have a pre-commit configuration that requires version 2.2.1 of prettier:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.2.1"
hooks:
- id: prettier
And in my .devcontainer I specify use of prettier, so that my code gets formatted on save:
{
// ...
"settings": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
// ...
}
}
Prettier is installed by the vscode extension, not globally, so doing:
npm list -g | grep prettier
in my dev container doesn't list anything installed.
The problem
A different version of prettier is being used, and I get a conflict in how it formats arrays in json files. Every time I open up a particular json file, it gets reformatted by my editor.
Also, if I rebuild my devcontainer, I'm then liable to unknowingly switch the version of code formatter I use, leading to git hell.
The question
How can I specify that my devcontainer use an exact prettier version so I can enforce the same behaviour in my dev environment as in our code quality tools?
I have already tried this:
You can set up the prettier extension to use a resolved version of prettier, according to the instructions under "Prettier Resolution" here.
So I added to the Dockerfile:
# Ensure prettier is installed globally so the esbenp.prettier-vscode can find a specific version
# as discussed here:
# https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
# NB You can remove the -g flag if you have a node project. I install globally because I use prettier on all projects, whether they have a node_modules folder or not.
RUN npm install prettier#2.2.1 -g -D --save-exact
And in the .devcontainer.json settings, told the extension to resolve the prettier module instead of using its own:
{
// ...
"settings": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.resolveGlobalModules": true,
// ...
}
}
That didn't work so I also tried adding:
"prettier.prettierPath": "$(npm root -g)/prettier",
Which also didn't work; the prettier extension is still using it's own version.
You can set the version in the .devcontainer like this:
"extensions": ["esbenp.prettier-vscode#8.0.1"],
The trick is you also have to turn off extension automatic updates:
"settings": {
"extensions.autoCheckUpdates": false,
"extensions.autoUpdate": false
},
Note: This turns off automatic updates for all extensions.
Also, RUN npm install prettier#2.2.1 -g -D --save-exact in the Dockerfile adds the prettier CLI to the environment, not the VS Code extension.
Is it possible to tweak VSC somehow to see GCC warnings in the text editor?
Refer to the screenshot below - it shows only errors in the console.
I'm using 1.43.2 version with C/C++ extension 0.26.3 installed.
Tried adding -Wall compiler flag to "args" in tasks.json but it didn't help.
Below are my settings:
{
"editor.fontSize": 13,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 100,
"files.insertFinalNewline": true,
}
The warning and errors are shown in Problem Panel.
You can see Problems 4 on it.
You might need to install Visual Studio IntelliCode or C++ Intellisense to help you identify mistakes before compilation.