Open dekomote opened 2 months ago
thanks for reporting. i've noticed similar behaviour but haven't been able to narrow down anything specific. interesting that it only happens in vscode though
i reproduced the same issue in sublime text, so i don't think it's specific to vscode
Have you enabled workspace instead of open files only?
oh wow, i thought diagnosticMode
was "workspace"
by default. i should change that (#559)
now that i've set mine to "workspace"
, i can't seem to reproduce the issue in vscode or sublime text:
how exactly are you configuring diagnosticMode
in vscode? is it in your workspace or user settings? maybe it's being overwritten or something? also which version of basedpyright are you using?
I use basedpyright.analysis.diagnosticMode, set to workspace.
I use v1.15.2
I tried it again, it doesn't work in vscode. Make sure you haven't opened any files from pack1 prior to opening mod2, even if they are closed now. Once they are read, it works.
weird, i can reproduce the issue on a different machine. will investigate further, thanks
notes to self:
is this an issue in pylance?
No. In pylance, it works, even if you set the diagnostic mode to open files only. I think this is what separates pylance from pyright
ok i think i can reliably reproduce the issue now
No. In pylance, it works, even if you set the diagnostic mode to open files only. I think this is what separates pylance from pyright
it doesn't seem to work for me in pylance at all. instead i get a quick fix to search for additional imports which i think is a recent change. it does end up showing it but i don't know why they'd add an extra step and make it more annoying:
issues with import suggestions are always so hard to debug, because the behavior seems to always change randomly.
You probably have "python.languageServer": "None" set in .vscode/settings.json automatically, so pylance doesn't work. I can reliably get autocomplete with pylance.
nah i have a separate isolated pylance profile with python.languageServer
set to "Default"
The auto-complete via code actions behavior is quite unpredictable for me. It seems to work for most of the stdlib modules like os
, itetools
, subprocess
but not for a few ones like logging
and unittest
(there could be more but I just happened to notice these two).
And for third party modules, it didn't work for me at all, I did try setting extraPaths
to site-packages path, and changing the diagnosticMode
to workspace
but none of these options worked.
Although this is only via code actions, if I start typing, the entries do show up in the auto-completion popup menu.
For reference I am using Neovim with native lsp.
Confirm the same issue on VSCode and vim for me.
Example file: test.py
class Test(BaseModel):
id: str
test: str
t = Test(
id="Hey",
test="yo",
)
Startup: https://pastebin.com/RVYHKwDE Code Action Issue: https://pastebin.com/RcWuYcTf
This happens in vscode. The diagnostic mode is set to "workspace"
"basedpyright.analysis.diagnosticMode": "workspace"
I have an example project with 2 packages and 2 modules inside.
In pack1/mod1.py I have a function
If I open mod2.py, write "some_" and try to get autocomplete one of two things happen:
If I now open pack1/mod1.py, go back to mod2.py and try the same thing, I get an autocomplete.
I have the same setup for sublime and there it works as it should.
Same thing happens with pyright. Hoever, with pylance, the problem doesn't exist.