Open linette-zyy opened 2 years ago
https://github.com/microsoft/PTVS/issues/6713 today's build is vs 2022 Preview 4, but it doesn't be fixed
I think the recent comments on the closed issue https://github.com/microsoft/PTVS/issues/6713 also relate to this. Something seems to break once projects use flask which causes quite annoying erroneous knock-on warnings and falsely flagging modules and variables as being unused. The latter problem seems to go away once VS is restarted.
I am also getting the same issues - and I'm not even using flask. Be good to get this fixed as its annoying to keep seeing:
This was in version of 17.4.1 of Visual Studio Professional
Still a problem at 17.4.3 of Visual Studio Pro.
I agree the problem is not limited to projects using flask. Probably related to https://github.com/microsoft/PTVS/issues/7274 as the "X could not be resolved" warnings are not reported when the CLI-version of pyright is run on the project.
Still a problem at 17.4.4 of Visual Studio
Whats the betting that it won't be fixed in the next version.
Still having issue on Version 17.5.3.
An issue on a fresh environment and newest VS-2022 (17.5.5). Works well in VS-2019; works in Version 17.6.0 Preview 6.0.
@bschnurr This seems to still repro in the recent versions, shall we re-open it?
We are still getting reports of this issue
I see this fixed in latest. it should be in the newest dogfood build
What do you mean with the newest dogfood build? When I tried with an updated version I got redirected here instead of my venv (for a few packages that was in pylance, for the other I get no redirect/help but the missing import underline is gone :)):
Could it be some issue with my .pyproj file?
(All python files are in the first ItemGroup
and there are no "python interpreter paths" defined in that ItemGroup)
Microsoft Visual Studio Community 2022 Version 17.8.5 VisualStudio.17.Release/17.8.5+34511.84 Microsoft .NET Framework Version 4.8.04084
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA553 Microsoft Visual C++ 2022
ASP.NET and Web Tools 17.8.358.6298 ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.8.358.6298 Azure App Service Tools v3.0.0
C# Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Cookiecutter 17.0.23262.1 Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
NuGet Package Manager 6.8.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Python - Profiling support 17.0.23262.1 Profiling support for Python projects.
Python - VC Project Support 17.0.23055.1 Provides support for launching C++ projects with Python debugging enabled.
Python with Pylance 17.0.23262.1 Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Visual Basic Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.
Preview 1 build
Still the same problem for me with Pylance 17.0.24026.1: I think that the problem is related to paths in the .pyproj file.
I've played around and created a new project, which works great.
This is basically the folder structure that I'm working with:
my_project
- code
- - pythoncode
- - - folder_a
- - - - file_a.py
- msvc
- - python_proj
- - - python_proj.pyproj
- venv
Very complicated but it has it reasons...
In the python_proj.pyproj I have (among a lot of others):
....
<ProjectHome>..\..\code\</ProjectHome>
<SearchPath>..\</SearchPath>
...
<InterpreterId>MSBuild|venv|$(MSBuildProjectFullPath)</InterpreterId>
<ItemGroup>
<Content Include="pythoncode\folder_a\file_a.py" />
</ItemGroup>
<ItemGroup>
<Interpreter Include="..\venv\">
<Id>venv</Id>
<Version>3.11.1</Version>
<Description>venv (Python 3.11.1) my_project</Description>
<InterpreterPath>Scripts\python.exe</InterpreterPath>
<WindowsInterpreterPath>Scripts\pythonw.exe</WindowsInterpreterPath>
<LibraryPath>Lib\</LibraryPath>
<PathEnvironmentVariable>PYTHONPATH</PathEnvironmentVariable>
<Architecture>x64</Architecture>
</Interpreter>
</ItemGroup>
The code works and I can run it, debug it etc. etc. but pylance doesn't find the venv with this structure, where does it search or how can I specify where it should search for a venv?
@bschnurr Looks like it still repros, so I just reopened the issue.
Anything I can do to help fix this issue? (Or change paths in my .pyproj file to help the Intellisense?)
I just installed Microsoft Visual Studio Professional 2022 update to Version 17.8.7 and it resolve the issue Python - Django support 17.0.23262.1 Python - Profiling support 17.0.23262.1 Python - VC Project Support 17.0.23055.1 Python with Pylance 17.0.23262.1 Visual Studio IntelliCode 2.2
Any news while working with a complex folder structure?
Is there any possibility to tell the intellisense where to look for the venv?
appears to be fixed
I tried to get the latest preview version, however still the same issue. @bschnurr can you try to set up a project with the folder structure like I described in the post from 14 feb and see if that works for you?
I've pinpointed that I can't get the intellisense to work in VisualStudio due to my folder structure, is there any way to help the intellisense to find the correct Python environment? The VisualStudio runtime understand it but not the intellisense.
Environment
Steps to Reproduce 1.Create a Flask Web Project. 2.Click Create virtual environment( Make sure Flask was successfully installed ). 3.Reload the Project.
Expected behavior After Flask is successfully installed, no errors or warnings will be displayed.
Actual behavior
Pylance Output info