-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use intellisense and code navigation #12353
Comments
|
I got similar problem. The intellisense stops working on my linux server, but it works on my local pc. |
|
I have the similar issue. I think its a bug in this version 2020.5.86806. Intellisense autocomplete is very slow and not working properly. In some cases it is not even suggesting the variable I used in the previous line. See the attached screenshot. It works completely fine if I disable the python extension!! |
|
Unfortunately, this workaround doesn't work for me. Our project code base is IP protected and hence from Linux remote machines(where MS VS CODE is installed )access to internet is not allowed. |
You can ask them here how u can download and install the offline version for python-language-server here: https://github.com/Microsoft/python-language-server |
|
@karrtikr |
@sourabh2902 That syntax is used to references variables defined in the file. Try this to reference system environment variables. |
|
In order to make sure the environment variables are correctly set, you can create a python file with following contents and then debug it, and print the environment variables. |
|
@karrtikr Thanks for the reply! let me try this and update you |
|
@karrtikr the contents of the .env file are : In my python code I append the path to sys like the following : The tool still is not able to find the definition I tried to run my python script I see the environment variable value correctly and script output being generated correctly as well. If I replace the code from 3rd picture to absolute path then the code navigation and IntelliSense work as expected. But as I mentioned that is not desirable in large projects. |
|
I see.
That's actually different. Can you please try printing the environment variable by debugging the python file instead? From your screenshot, I would need you to print |
|
@karrtikr Yes , as I mentioned that the script runs normally and produces the right outputs. So it was also decoding the os.environ part correctly. |
|
Unfortunately, the issue happened again both on my pc and linux server. The python extention version is 2020.6.89148 |
|
@plus5170 Please open up a new issue, and I will transfer it up to language server. @sourabh2902 I will get back to you when I get the chance |
Oh I just find it works after the command "Analyzing in background..." completed. It is OK to wait for a while. Thanks for your reply! |
|
@sourabh2902 Note Jedi doesn't pick changes from If it still doesn't work our for you, please give me small reproducible example with file directory structure, file contents,
|
|
thanks for the help ! now it is working |










Hi
I am working on the project which has a huge code base involving many many python source code files. I am using python extension and vscode for the first time and I am running into the following issue.
I have a python file located in path : a/b/c/d/e/legacy/file_reader.py
This is imported in the second python file using the following method :
import os
import sys
sys.path.append("a/b/c/d/e/legacy")
import file_reader_legacy
In this usage, I observe that the IntelliSense and code navigation work normally
However, in our project we define many environment variables which point to paths that can be used in python to import. For example :
import os
import sys
sys.path.append(os.environ['PATH_TO_FILE_READER'] + "/legacy") ==> PATH_TO_FILE_READER is an environment variable which points to a/b/c/d/e/
import file_reader_legacy
In this usage, I observe that the IntelliSense and code navigation don't work at all. That is when I select Go to definition option, the extension is not able to navigate to the definition of the method
Using absolute paths in our project is not suitable since our codebase has to support many variations and hence we try our best to abstract this as much as possible.
Please note I have created a file called: python_env.env in my ./vscode directory. This file has the definition of environment variables inside it.
for example,
.vscode/python_env.env
PATH_TO_FILE_READER=${PATH_TO_FILE_READER}
I have also defined the following in .vscode/settings.json and .vscode/vscode_workspace.code_workspace files
"python.envFile": "${workspaceFolder}/python_env.env"
Can I kindly get some help in this matter?
Environment data
"python.jediEnabled"set to; more info How to update the language server to the latest stable version #3977): set to default settingpython.languageServersetting: set to the default settingExpected behaviour
Please see the description above
Actual behaviour
Please see the description above
Steps to reproduce:
Please see the description above
The text was updated successfully, but these errors were encountered: