Reputation: 1026
I am using Visual Studio Code (VSC) as my IDE. My computer just updated to Catalina 10.15.2 (19C57) and since the update, VSCode is no longer highlighting syntax errors. The extensions I have seem to be working and it recognizes my miniconda Python environment.
Is there a solution for this yet? I was avoiding Catalina as I know it has caused a lot of issues but now that I was forced to install it I need a solution.
Upvotes: 25
Views: 119102
Reputation: 381
Sometimes I get this issue when switching between interpreters (e.g. a conda environment and a pip venv). Restarting the language server often resolves the issue without having to change any configuration. This can be done by:
Python: Restart Language Server
Upvotes: 0
Reputation: 1
Same issue occurred to me yesterday. I first tried upgrading my Mac to Ventura, uninstall and install a few older versions of VScode nothing worked. Then I realised by luck that it's caused by an extension Pylance (v2023.10.53) once I switch back to pre-release version inside my VScode extension and restart everything's back to normal - the highlight, definition, underlined error - all back!
Upvotes: 0
Reputation: 2788
It's very specific but for me it was a missing semicolon in my CSS, I use styled-components
in React and it didn't throw an error for the missing semicolon but highlighting was suddenly gone.
Upvotes: 2
Reputation: 1026
In my case, the Catalina installation didn't remove my Python installation.
After checking as suggested by @Brett Cannon in his comment, the update to Catalina uninstalled some extensions from VS Code. These are not available in the VS Code extension Marketplace anymore so there must be an issue regarding compatibility.
I fixed it by doing the following:
Python: Select Linter
and select pylint
Install with Conda
optionNow it's working correctly, though it's still not shown in my extensions section in VS Code.
It's necessary to point out that you will have to install pylint
in every Python environment you are using, in my case I have multiple Conda environments.
Upvotes: 7
Reputation: 2291
I also had the same problem for TypeScript React (.tsx
) files though in my case it was due to the JavaScript & TypeScript Nightly extension so disabling it fixed my syntax highlighting.
Upvotes: 12
Reputation: 5094
In my case, it was just the theme issue. After the latest update, VSCode changed the theme to Dark Modern which is fine, but I wanted to use my existing one so I selected the Dark Theme (but my previous one was actually Dark+).
The difference between the two is the syntax highlighting feature so switching to the Dark+ Theme fixed the syntax highlighting not being enabled.
Upvotes: 40
Reputation: 3126
The issue in my case was the Python language server setting (python.languageServer
) was set to the wrong option. It should be set to Default
or Pylance
though for some reason switched over to Jedi
which I never changed.
File > Preferences > Settings
Search for python.languageServer
Change the setting as required:
Restart Visual Studio Code
Upvotes: 8
Reputation: 248
Encountered this issue for weeks now (June 2023), just found out this is due to the VScode color theme, apart from extension issue (potentially the now deprecated Python for VSCode
)
Ctrl + Shift + P
Preferences: Color Theme
Dark Modern
or Dark+
Dark (Visual studio) is the one preventing Python syntax from being highlighted properly.
Upvotes: 5
Reputation: 4900
In my case I needed to deactivate the plugin Pylance to work in Python. With Pylance it has broken syntax highlighting. after deactivation of all plugin, the broken highlighting was gone. I then activated one after the other and found Pylance as source for the problem.
Upvotes: 3
Reputation: 5182
Had similar issue on new vscode setup - my problem was rather that eslint warnings are not being highlighted, only errors.
After opening my eslint setup for the project - .eslintrc.js
file, saw message saying that eslint needed permission accessing some files, which I did by clicking the lightbulb next to module.exports
and hitting accept button.
Upvotes: 0
Reputation: 16080
If you were using the global install of Python then that was removed in Catalina which would break your virtual environment. A new install of Python and recreating the virtual environment should fix things.
Upvotes: 1