microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.7k stars 767 forks source link

provide standalone file mode #5932

Open heejaechang opened 4 months ago

heejaechang commented 4 months ago

some users are using vscode as if it is glorified notepad. basically launch vscode as code . whenever they need to take a look at a python file.

problem is when they do (code .), vscode is opened as a folder mode that will provide all workspace wide features such as find all references, rename, workspace symbols, call hierarchy, type hierarchy, pytest and etc.

pylance might consider a way to open it as standalone file mode where we act like files are opened as individual files. this mode we won't support those workspace file features but will use a lot less memory since we only support open files as if those files are opened individually.

user could already do this by opening each file explicitly, but problem is vscode explorer won't show content of folders so it is inconvenience when user wants to see multiple files in the folder.

rchiodo commented 4 months ago

Your hypothesis here is that a user doing code . isn't really opening a workspace, they just want to look at their python file in the same directory?

How would we distinguish the two? (I personally use code . to open a workspace, it's how I open pyrx).

rchiodo commented 4 months ago

Maybe a .git folder? That's probably a workspace.

rchiodo commented 4 months ago

And maybe only do the disabling if the workspace has a lot of files in it.

heejaechang commented 4 months ago

I am not suggesting how we do it, but we could

  1. add an option either true/false, or
  2. specify folder (anything under it is standalone file mode) in machine/user settings and etc.
  3. or we provide new command line option for users if we can detect it in our extension
  4. or something else

and probably show something in status bar to indicate that pylance is in standalone file mode?