sublimelsp / LSP-pyright

Python support for Sublime's LSP plugin provided through microsoft/pyright.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple folders autocomplete problem.

milkpuff opened this issue · comments

If 2 or more folders added to project, autocomplete project seems to fail.
屏幕截图 2022-09-18 143127
(test.py is outside of the project.)

If only one folder added to project, autocomplete runs perfect.

屏幕截图 2022-09-18 143213
屏幕截图 2022-09-18 143255

setting:

{
	"settings": {
		"python.pythonPath": "G:/miniconda3/envs/py310/python.exe",
	}
}

Only the first folder will be considered as the project folder iirc, from LSP's point of view.

It's up to the server rather. If it supports multiple workspace folders than it should work regardless. And i think pyright does support multiple workspace folders.
Have to be analysed more to see where the issue is exactly.

The payload sent to the server seems good.

'rootUri': 'file:///E:/Repo/ST-Fanhuaji', 
'workspaceFolders': [
    {'name': 'ST-Fanhuaji', 'uri': 'file:///E:/Repo/ST-Fanhuaji'}, 
    {'name': 'ST-Emoji', 'uri': 'file:///E:/Repo/ST-Emoji'}
], 
'rootPath': 'E:\\Repo\\ST-Fanhuaji'}

I've missed the fact that the test.py is outside of any of those projects. In that case I can indeed see that the behavior is different depending on if there is one folder or more but LSP doesn't seem to be treating those cases differently otherwise so I think this is pyright's bug or feature.

I suggest reporting it at https://github.com/microsoft/pyright and you'll get clarification, if nothing else.