- Intellisense не работает автоматически VSCode
- 5 ответов
- Unable to use intellisense and code navigation #12353
- Comments
- sourabh2902 commented Jun 15, 2020 •
- Environment data
- Expected behaviour
- Actual behaviour
- Steps to reproduce:
- Python Intellisense not working with Visual Studio 2017 15.2 #2613
- Comments
- nirmalraisoni commented May 31, 2017
- zooba commented May 31, 2017
- chintanp commented Jun 2, 2017
- zooba commented Jun 2, 2017
- chintanp commented Jun 2, 2017
- kacl780tr commented Jun 3, 2017
- xdnzh commented Jun 20, 2017
- zooba commented Jun 20, 2017
- xdnzh commented Jun 21, 2017
- raoraozu commented Jun 25, 2017
- zooba commented Jun 26, 2017
- ErfanEbrahimiBazaz commented Jul 4, 2017
- zooba commented Jul 4, 2017
- Camios commented Aug 5, 2017
- athanhat commented Aug 7, 2017
- zooba commented Aug 7, 2017
- ghost commented Aug 7, 2017 •
- zooba commented Aug 7, 2017
- minaShaker commented Aug 16, 2017
- zooba commented Aug 16, 2017
- iotalambda commented Aug 20, 2017 •
- zooba commented Aug 22, 2017
- miklem commented Sep 1, 2017
- zooba commented Sep 1, 2017
- zooba commented Sep 1, 2017
Intellisense не работает автоматически VSCode
Я только что загрузил код Visual Studio, и мой Intellisense не работает автоматически.
две настройки, которые управляют этим, по-видимому, установлены правильно:
Я получаю меню Intellisense, когда я начинаю печатать и нажимаю «CTRL + Space», но это дает мне список всего, а не вещей специально для моего объекта.
что я делаю не так?
5 ответов
более расширенные функции редактирования кода Visual Studio (IntelliSense,инструменты рефакторинга и т. д.) работает только в файлах c#, если у вас есть project.json файл или что VSCode осознает. Откройте папку (т. е. откройте меню и нажмите Открыть Папку. ) С *.sln файл или project.json и VSCode попытается найти все файлы проекта/решения в папке. Если есть несколько проектов, вам может потребоваться выбрать один из проектов на кнопке справа от строки состояния (внизу окна).
- выбор project.json — файл открывает DNX-проект, и VSCode загрузит этот проект плюс ссылочные проекты
- выбор *.sln — файл открывает MSBuild-проект. Он загрузит ссылку *.csproj -проекты и брат или потомок project.json — файлы, но нет других файлов проекта, на которые ссылаются из решения файл.
- выбор folder сделает сканирование VSCode для *.sln и project.json файлы и VSCode попытаются загрузить их все.
начиная с версии 0.5 я обнаружил, что мне нужно закрыть и снова открыть мои рабочие файлы, чтобы получить новую информацию intellisense, чтобы начать работать для моих собственных файлов. Это обычно происходит после открытия файла, который должен использовать информацию о типе из другого файла, который я только что создал. Пока я не закрою и не открою их (в Редакторе), intellisense не всегда работает.
надеюсь, это то, что будет исправлено по мере созревания приложения.
для того, чтобы интеллект работал, расширение кода Visual Studio OmniSharp должно быть там вместе с Mono. При открытии папки проекта / решения OmniSharp получает зависимости проекта от любого проекта.json или из файла решения dotnet (если проект/решение создано с другими версиями visual studio).
Итак, когда вы смотрите на окно вывода omnisharp после немедленного открытия папки project/ solution, вы можете увидеть следующее линии
опубликуйте это, вы можете увидеть пару строк, как показано ниже,
они означают, что ваши проекты получают признание расширения OmniSharp.
Если вы получаете сообщение об ошибке, информирующее вас о таймауте, перейдите в настройки кода Visual Studio и добавьте переопределение конфигурации, подобное приведенному ниже:
Я знаю, что это слишком долго ждать 200 секунд. Но не волнуйся, это тебя не остановит. работать с файлами проекта. Но помните, что IntelliSense будет автоматически доступен после успешной загрузки всех проектов в папке.
не стесняйтесь расширять настройку тайм-аута, так как это поможет вам получить intellisense, даже если вы не получаете его сразу.
Надеюсь, моя информация поможет ты! Наслаждайтесь VSCode!
Источник
Unable to use intellisense and code navigation #12353
Comments
sourabh2902 commented Jun 15, 2020 •
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=$
I have also defined the following in .vscode/settings.json and .vscode/vscode_workspace.code_workspace files
«python.envFile»: «$
Can I kindly get some help in this matter?
Environment data
- VS Code version: 1.45.1
- Extension version (available under the Extensions sidebar): 2020.5.80290
- OS and version: Linux 3.0.101-108.108-default
- Python version (& distribution if applicable, e.g. Anaconda): 3.5.4 64 bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | . ): N/A
- Relevant/affected Python packages and their versions: N/A
- Jedi or Language Server? (i.e. what is «python.jediEnabled» set to; more info #3977): set to default setting
- Value of the python.languageServer setting: set to the default setting
Expected 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:
Источник
Python Intellisense not working with Visual Studio 2017 15.2 #2613
Comments
nirmalraisoni commented May 31, 2017
Hi I tried all possible options to enable Intellisense but not working
I am using Visual Studio Enterprise 2017 Version 15.2 (26430.6) IDE
The text was updated successfully, but these errors were encountered:
zooba commented May 31, 2017
Thanks for the report.
Would you be able to provide some more information about what you’ve tried? For example:
- have you created a Python project?
- have you looked in the Python Environments window to see whether the database needs refreshing?
- have you tried a Python Interactive Window to see if Intellisense works there?
chintanp commented Jun 2, 2017
I would like to report the same problem. I am using VS Community 2017, 15.2 (26430.12), fresh install. I installed all the python environments during install 2.7, 3.6 (32, 64-bit). I also refreshed the db. Also, the intellisense works in the interactive window, just not in the text editor when I create a python project.
zooba commented Jun 2, 2017
Can you show an example of what you are typing? There are some places where we can’t provide Intellisense, but it’s not obvious why not (well, it’s obvious to me because I’ve debugged it often in the past 🙂 ).
chintanp commented Jun 2, 2017
When I type «print( ..» in the text editor. I am not including (no statements) import anything yet. I saw this in one of the quickstart tutorials.
kacl780tr commented Jun 3, 2017
It’s not working for me either.
If I have a text editor with «import numpy as np» at the top, typing «np.» gets exactly nothing, other than a red squiggle.
I cannot get any completions from a python class in the same file.
Meanwhile, the intellisense database for the Anaconda environment I’m using is up to date, and the package list looks accurate.
I get intellisense in the interactive window, but in the text editor immediately above, nothing.
At one point I tried to add «.» to the search paths, and intellisense in the editor worked intermittently for a brief period, but it has ceased to function again.
- Version info:
- Microsoft Visual Studio Community 2017
- Version 15.2 (26430.12) Release
- VisualStudio.15.Release/15.2.0+26430.12
- Microsoft .NET Framework
- Version 4.7.02046
- Installed Version: Community
- Visual Basic 2017 00369-60000-00001-AA081
- Visual C# 2017 00369-60000-00001-AA081
- Visual C++ 2017 00369-60000-00001-AA081
- ASP.NET and Web Tools 2017 15.0.30503.0
- Azure App Service Tools v3.0.0 15.0.30209.0
- Common Azure Tools 1.9
- Cookiecutter 3.0.17114.1
- JavaScript Language Service 2.0
- Microsoft Azure Tools for Microsoft Visual Studio 2017 — v2.9.50131.1
- Microsoft Visual Studio VC Package 1.0
- NuGet Package Manager 4.2.0
- Python 3.0.17114.1
- Python — Django support 3.0.17114.1
- Python — IronPython support 3.0.17114.1
- Python — Profiling support 3.0.17114.1
- TypeScript 2.2.2.0
- Visual Studio tools for CMake 1.0
xdnzh commented Jun 20, 2017
I would like to report the same issue.
Everything worked perfectly until today afternoon. The Intellisense was working, I could send selected code to Interactive console by ctrl + Enter.
However, now the Intellisense is not working, and the option «send to Interactive» is missing.
zooba commented Jun 20, 2017
@shldngzh Did you do something this afternoon? Maybe install an update?
xdnzh commented Jun 21, 2017
@zooba Thanks for your replying! I had a quick check and the only change I can recall/find is the most recent update (15.2 26430.13) was installed on last Friday/Monday. However, this morning, with nothing changed after work, everything is back to normal. Intellisense and send to Interactive are both working now. I’m confused but I’m thinking maybe some «hidden» problem is there.
raoraozu commented Jun 25, 2017
I want to report the same issue that was posted before:
If I have a text editor with «import numpy as np» at the top, typing «np.» gets exactly nothing, other than a red squiggle.
I cannot get any completions from a python class in the same file.
Meanwhile, the intellisense database for the Anaconda environment I’m using is up to date, and the package list looks accurate.
I get intellisense in the interactive window, but in the text editor immediately above, nothing.
zooba commented Jun 26, 2017
@shldngzh Glad it resolved itself. I would guess that one of the install caches had a problem, and it cleaned itself up automatically.
@raoraozu We have seen some issues where an editor window may not be associated with the correct environment. Can you try closing/reopening the file? (Also, so you’re aware, the import name as . and from name import . cases are expected to show «» right now, and we are aware of limitations in pandas’s factory functions. But the np. issue sounds unexpected.)
ErfanEbrahimiBazaz commented Jul 4, 2017
I would like to report the same problem. I am using VS 2017, for python applications it is not working. For instance when I import cv2 or numpy as np, then when I put a dot after cv2. nothing comes, as in cv2.Laplacian(). When I hit ctrl+space, it doesn’t help either.
zooba commented Jul 4, 2017
Hi, @ErfanEbrahimiBazaz, thanks for the report! Can you check the following things:
- Do you see any suggestions at all for anything else? Keywords?
- Your project has the correct environment selected under «Python Environments»
- That environment has the packages installed (right-click from Solution Explorer and select «Install Package» to jump to the packages list)
- The database is up to date (you’ll see a message on the completion popup if it is not)
- Please try restarting Visual Studio and closing/opening the editor window (I recently fixed a bug around this area but it hasn’t been released yet)
Camios commented Aug 5, 2017
Same issue. Also, the combo boxes for class and method selection at the top of the editor are empty
athanhat commented Aug 7, 2017
Hi, I managed to reproduce a bug with Intellisense in Visual Studio 2017 15.2 and I also found a way to bypass this error. You may find my report and related issues in #2889 post
zooba commented Aug 7, 2017
@ErfanEbrahimiBazaz It looks like you don’t have any versions of Python installed, or at least any that have been detected by Visual Studio (we should normally show at least one item below «Python Environments», even if you haven’t explicitly selected it yourself).
Could you open Tools, Python, Diagnostic Info and either post the contents as a gist and link it here, or email as an attachment to ptvshelp@microsoft.com?
ghost commented Aug 7, 2017 •
Hi, I would like to report the same issue. I installed Python 3.6 and Visual Studio Python extensions today and try to play with it. When I typed import sth as sth.short , the Intellisense won’t help and cannot detect anything inside the package (just like the ‘import numpy as np’ issue above). But if I type from sth import . , all the functions inside the package can be shown up. Plus, the Python Interactive window have the same problem.
I’m using Visual Studio Community 2017 Version 15.2(26430.16) and the installed Python Plugin is 3.0.17114.1
zooba commented Aug 7, 2017
@NaruNanao import sth as sth.short is invalid syntax — you probably just want to type import sth here and then reference sth.short later.
minaShaker commented Aug 16, 2017
it’s not working for me either , i need to refresh the database every 10 secs (literally) so i would be able to use it !!
zooba commented Aug 16, 2017
We just released 15.3 this week — please update to the latest version and try again. We fixed a number of IntelliSense issues, which hopefully includes the ones reported here.
iotalambda commented Aug 20, 2017 •
Hi, I have the latest Visual Studio Community 2017 15.3.0 an Python workload 3.0.17208.1.
Using Python 3.6 64bit with the following imports
pd. gives suggestions in both Visual Studio’s Code area and Python interactive. np. gives suggestions in Python interactive only.
zooba commented Aug 22, 2017
@chartjunk Unfortunately, many of the issues around numpy aren’t fixed yet (still working on them), but if you could attach the output of Tools, Python, Diagnostic Info then I may be able to give you some more specific advice. Your issue is probably not the same as any of the others in this thread.
miklem commented Sep 1, 2017
Hi!
I’m also have a problem with auto completion.
f = open(«C:\\test.txt»)
text = f.readlines()
#text = «test»
f.close()
for line in text:
line.
There is no autocomplete for line after dot. But here it works:
f = open(«C:\\test.txt»)
text = f.readlines()
text = «test»
f.close()
for line in text:
line.
Looks like readlines() not tell to VS properly about what type of data it returns. Same issue in VS code. But this code works in PyCharm.
zooba commented Sep 1, 2017
@miklem Same deal as above — this is an ongoing limitation of the way we do static analysis. I believe PyCharm currently relies on manually entered information to get this right, while we do not do that (yet). There’s no bug here.
zooba commented Sep 1, 2017
Apologies to the OP, but since everyone keeps trying to hijack this thread for unrelated feature requests, I’m going to close and lock it.
If you encounter a bug that prevents all IntelliSense, or you see crashes or extremely high memory usage, please report it. Otherwise, we are working on long-term projects to improve the overall quality, and reporting individual issues does not help us.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник