The syntax highlighting has almost been lost in vscode.
enter image description here
My vscode version is:
Version: 1.40.1 (system setup)
Commit: 8795a9889db74563ddd43eb0a897a2384129a619
Date: 2019-11-13T16:49:35.976Z
Electron: 6.1.2
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362
I have installed all the extensions in the Python Extension Pack (1.6.0).
Operating system: Windows 10
What should I do to restore the syntax highlighting?
Thanks
Two things to check. One, make sure you have a colour theme chosen which highlights what you want highlighted. Two, make sure that your file has a its language mode set to "Python".
Otherwise VS Code provides Python syntax highlighting out of the box without any extensions.
Related
I keep getting this message when I run Jupyter Notebook.
comment :
output:
Pylance is now the default language server (see here). As such, I resolved the issue by changing my settings.json to:
"python.languageServer": "Pylance"
You may need to install the Pylance extension, if you don't already have it.
I met this issue on Ubuntu 18.04 LTS with python interpreter python3.6.9 + VS code python extension 2022.14
If I downgrade the VS code python extension to 2022.06, it works.
If I install a new version python (e.g. python3.9), it works.
So the reason should be:
The new version python extension is not compatible with old python version 3.6.9.
Solution:
either downgrade the python extension to 2022.06(can be even earlier, not fully tested); or upgrade the python interpreter version.
Check whether the following code is specified correctly in your setting.json:
"python.languageServer":"Jedi"
I just installed VS Code on my Macbook, and set out to test a few of its features. I installed the Python extension, pylint, selected the Python interpreter...followed the docs to the letter. Oddly, the Intellisense feature doesn't seem to be working, and pylint looks a bit odd. I expect squiggly red error lines, and a lightbulb next to the line with np.array suggesting that I import numpy. Instead I have double red underlines and no lightbulb. See image 1. It also only lints when I save the file. The error when I hover the np line is "undefined variable np." So it seems like it's linting, but not doing intellisense.
Similarly, I don't have any code snippets; when I type if and then ^-Space for the drop-down, there aren't any snippets.
I have anaconda installed, but it doesn't make any difference which Python interpreter I use.
Any suggestions? Thanks!
Settings.json file:
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": "/usr/bin/python3" }
VS Code Info:
Version: 1.52.1
Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523
Date: 2020-12-16T16:30:02.420Z (1 mo ago)
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0
According to the information you provided, I reproduced this problem, please refer to the following method:
The reason for the double horizontal line instead of the wavy line shown in the code is the use of color themes.
(Change theme: F1, Preferences: Color Theme)
Please make sure that the module "pylint" has been installed in your currently selected Python environment. (Install: pip install pylint; check: pip show pylint)
before:
after:
I am using Visual Studio Code (VSC) as my IDE. My computer just updated to Catalina 10.15.2 (19C57) and since the update, now VSC is not 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 lots of errors, but now that I was forced to install it I need a solution as I love VSC.
I also had the same problem for typescript react files. Tried many things and nothing worked. Finally I checked the extensions I've installed for typescript react. Disabling JavaScript and TypeScript Nightly extension worked for me
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 after I opened my command palette (Command + Shift + p) and typed python: select linter. Then selected pylint, selected the install with conda option, Close/Open VS Code and now it's working(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.
It's very specific but for me it was a missing semicolon in my css (styled-component). I use styled-components in react and it didn't throw an error for missing semicolon but highlighting was suddenly gone.
I had given up and left it that way until I came up with the solution quite by accident.
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.
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.
I try to compile PJSUA2 for Python. I could manage to compile the source with Visual Studio 2015 Community edition.
My question is, how can I install the Python module now?
The guide suggests to use make and make install. I tried to install also minwg, but it is not working as the project was compiled with VS.
I have also tried to compile with minwg, but I never could succeed due to undefined requirements. Also official PJSUA guide recommend to use VS for Windows.
Following settings have been applied to build from source:
Swig location has been added to path
JAVA_home system variable has been added
Java location has been added to path
Empty pjlib/include/pj/config_site.h has been created
Opened source in VS 2015 Community (all suggested VS package and module has been installed)
Set following project to do not compile:
pjsua_cli_uwp_comp
pjsua_cli_wp8
pjsua_cli_wp8_comp
Set swig_java_pjsua2 to build.
Add following folders to swig_java_pjsua2 VC++ include directories
c:\Program Files\Java\jdk-11.0.2\include
c:\Program Files\Java\jdk-11.0.2\include\win32
Build solution
I could make a workaround to compile pjsua2 for Python 3.7. If you have a better solution or just suggestion to this workaround, let me know
Preconditions:
List item
Download and extract swig (swigwin 4.0.0)
Download and install JDK
Download and install Python (Python 3.7.3 x64) and set at custom installation:
tick "Add Python to environment variables"
tick "Precompile standard library"
tick "Download debugging symbols"
tick "Download debug binaries (requires VS 2015 or later)"
set custom path if you want
add swigwin location to system path
add Python location to system path
add JAVA_HOME system variable
add %JAVA_HOME%\bin to system path
Install Visual Studio 2015 Community edition
Steps:
Download and extract pjsip 2.8
Create empty config_site.h under pjlib/inlclude/pj/ folder
Open pjproject-vs14.sln in VS
There will be an unsupported warning window, press OK
At the "Install Missing Features" windows, press install
VS installer will be started, and VS has to be closed to complete installation.
I have also added "Windows 10 SDK (10.0.10586)" to the installation.
I have also enabled developer mode on my Windows 10, but this could be optional
Open project again in VS
Set project to Release and x64 on the top dropdown
Right click on the solution, and go to Configuration Properties> Configuration
Remove all uwp and wp8 related projects from selection, like pjsua_cli_uwp_comp, pjsua_cli_wp8_comp
press OK, and build solution
I have had 34 succeeded and 0 failed solution after build.
Add following lines to pjsua2.i in pjsip-apps/src/swig folder
%inline %{
pj_ssize_t new_pj_ssize_t(int s) {
return (pj_ssize_t) s;
}
%}
this extra inline swig function provides workaround for create recorder issue
Open a command line (powershell did not work for this)
go to pjsip-apps/src/swig/python
Execute following command:
swig -I../../../../pjlib/include -I../../../../pjlib-util/include -I../../../../pjmedia/include -I../../../../pjsip/include -I../../../../pjnath/include -py3 -c++ -python -threads ../pjsua2.i
Add new "Empty Project" (Visual C++) to solution with swig_python_pjsua2 name
Add libpjproject and pjsua2_lib as reference to this new project
Right click on the Header Files>Add>Existing Item...
Add pjsip-apps\src\swig\pjsua2_wrapp.h
Add a "new filter" to the project with name "Generated Code"
Right click on "Generated code" and add new existing item.
Add pjsip-apps\src\swig\pjsua2_wrapp.cxx
Right click on the project and Linker>Input
Add "Ws2_32.Lib" to "Additional Dependencies"
Go to "VC++ Directories"
Add following folder to include path(I have used full path!):
c:\python37\include
pjnath\include
pjsip\include
pjmedia\include
pjlib-util\include
pjlib\include
Add following folder to Library Directories:
C:\Python36\libs
Set at General:
Target Name: _$(ProjectName)
Target Extension: .pyd
Configuration Type: Dynamic Library (.dll)
Go to properties of the solution, and select swig_python_pjsua2 to build
Right click on swig_python_pjsua2 and build
Build should complete successfully
You will need to file to use pjsua2 library in python.
pjsua.py located under pjsip-apps/src/swig/python
x64/Release/_swig_python_pjsua2.pyd (rename this to _pjsua2.pyd)
To test, copy those to file into a folder, start python from same folder and type:
import pjsua2
Thank You very much Krisz for this awesome work!
I just got it working for Python 2.7 / 32bit and some things are slightly different, so I will add them here:
Environment:
Windows 10
SWIG 4.0.1
PJSIP 2.9
Python 2.7.14 (32bit)
Visual Studio Express 2015 (V 14.0.25431.01 Update 3)
Whaddado:
Important: Check if your Python-interpreter is really x64 or win32 like the following:
start a python session and enter:
import platform
platform.architecture()
If you have 32bit, consider this in your choice for target platform in VS.
when you add this %inline%-Snippet to pjsip-apps/src/swig/pjsua2.i, add it at the end of the file!
when starting the swig-command, omit the "-py3"-parameter, if you use Python 2.x
there is a little typo in Krisz' description, at "pjsua.py located under pjsip-apps/src/swig/python" -> of course pjsua2.py is meant. Do not use the pjsua.py.
finally copy _pjsua2.lib and pjsua2.py into \Lib\site-packages\ and the _pjsua2.pyd into \DLLs\ to make them available everywhere.
I am trying to get the Xdebug vim plugin to work which depends on python. Here is my environment: Windows 7 Professional 64bit, Vim 7.3. I got everything set up for this plugin, but when I hit F5 nothing happens. I found some blogs describing some additional steps to get this working on Windows. All of them stressed making sure the correct version of Python is installed correctly. I looked at the plugin code in the debugger.vim file and close to the top it checks to see if python is available and exits if it is not. I inserted an echo command to tell me if python is not installed, and sure enough a message box pops up informing me of such. Here is the modified code:
if !has("python")
echo 'python NOT loaded'
finish
endif
According to this blog http://phphints.wordpress.com/2008/08/20/add-debug-support-to-vim/ I need to install the version of python that includes the dll vim is looking for when I run the version command from vim. Mine reports:
-DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DDYNAMIC_PYTHON3_DLL=\"python31.dll\"
So I installed the 64 bit version of python 2.7.1. Same result even though python27.dll is in the System 32 folder. I also tried adding the location of python.exe to the PATH, but this did not help. I also tried installing the 64 bit version of python 3.1.3 but this did not help. Any ideas?
I made the following changes, and now python is working (The conditional echo statement is never reached). I uninstalled Vim and re-installed it. I uninstalled the 64 bit versions of Python 2.7.1 and 3.1.3. I installed the 32 bit version of python 2.7.1.
I am guessing the change that made the difference is using the 32 bit version of Python 2.7.1 since I am using the 32 bit version of Vim. What do you think(leave a comment)?
This may not be the direct solution to your problem, but you need to make sure the vim executable compiled with Python support.
You can check what options are compiled by running :version in the vim command line.
Also, as far as I know, python3 support only added after vim7.3. If you have vim7.2, your best bet is to get python 2 working.