PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

No IntelliSense when import folder under the workspace.

Open linette-zyy opened this issue 3 years ago • 12 comments
trafficstars

Environment image

Steps to Reproduce

  1. Open folder in SE.
  2. Add new python file in SE named WholsRunningMe.py
  3. Add folder named TestMethod under current workspace
  4. Add init.py file in Folder
  5. Type code in init.py
def FOLDER1_MSG():
    print("hello world!")
  1. Type code in WholsRunningMe.py
import TestMethod
TestMethod.FOLDER1_MSG()

Expected behavior Make sure IntelliSense should show when import statement

Additional context and screenshots No IntelliSense when import folder image

linette-zyy avatar Apr 25 '22 08:04 linette-zyy

The dropdown for import completions doesn't show up in general, not even for standard modules. However, once the import is typed, using the module works, and completions appear for its members.

It doesn't seem to matter whether it's a folder or a project, though. Imports just aren't there.

int19h avatar Jun 08 '22 07:06 int19h

Likely caused by LSP protocol incompatibilities. It works in 17.3.0 Preview 3.0 [32607.526.main], where the LSP client is updated. Can you please re-check on that version?

int19h avatar Jun 08 '22 19:06 int19h

image In today's build , i can repro this when import module under the solution image

linette-zyy avatar Jun 09 '22 06:06 linette-zyy

I can reproduce it only with the following steps:

  1. Ensure that employee.pyi doesn't exist.
  2. Create employee.pyi.
  3. Try triggering Intellisense.

With those, the module doesn't show up in import completions regardless of how near a match it is. However, if I close and reload the project, completions show up. Deleting .pyi and starting from the first step repros again.

Can you confirm whether this also holds true for your repro? Or does it happen independently of .pyi file presence?

int19h avatar Jun 09 '22 17:06 int19h

image I can repro it without .pyi file. After restart VS, i still got no IntelliSense under——solution

I can also repro it when import folder under the workspace under——workspace

linette-zyy avatar Jun 10 '22 02:06 linette-zyy

image In today's build ,I can repro it when import folder outside the workspace image image image

linette-zyy avatar Jun 10 '22 07:06 linette-zyy

I still cannot reproduce. Is there anything special about the Python environment that is selected (even if it's global)?

int19h avatar Jun 14 '22 20:06 int19h

@int19h image In today's build ,I can repro it when import folder outside the workspace image The Python environment is global default(install from VS) image

linette-zyy avatar Jul 05 '22 09:07 linette-zyy

Is PythonSettings.json (and specifically "SearchPaths") the same as on the earlier screenshot? Also, can you share the filesystem tree showing where the folder being imported is actually located relative to the opened folder, as well as any .py files inside the imported folder?

int19h avatar Jul 12 '22 17:07 int19h

@int19h PythonSettings.json (and specifically "SearchPaths") is the same as on the earlier screenshot

imported folder's location: image there is one "init.py" file in the imported folder image current workspace's location: image image

linette-zyy avatar Jul 13 '22 02:07 linette-zyy

image In today's build , the IntelliSense is missing after restarting VS

linette-zyy avatar Feb 06 '23 07:02 linette-zyy