Open mgzenitech opened 1 year ago
I believe this issue represents a limitation of our current syntax checking, which uses Python's built-in compile function, which is tied to the specific Python version that is running jedi-language-server
itself: https://github.com/pappasam/jedi-language-server/pull/242/files
To get around this issue (for now), you'll need to either:
jedi-language-server
with a version of Python that supports the Walrus operator and this specific use of it (3.8+, I'd guess)jedi-language-server
-provided diagnostics syntax checking using the provided initialization option (diagnostics.enable: false
): https://github.com/pappasam/jedi-language-server#configurationI feel like the walrus operator should be supported. This was a feature before 3.10... So I'm a bit confused. This is probably using Python pre-3.8.
I am using Python 3.10.8
Is there a chance that you have a virtualenv or a way of running pre-3.8? Because it might somehow pick up an older environment for some reason.
As I said 3.10.8 in virtualenv (you can see the interpreter in screenshot bottom right corner)
Jedi has a separate subprocess, so there was a possibility that that somehow was broken.
However I was able to reproduce it with a very simple:
>>> import jedi
>>> x = jedi.Script('f(a := 1, b)\n').get_syntax_errors()
>>> x[0].get_message()
'SyntaxError: positional argument follows keyword argument'
>>> jedi.Script('f(a := 1)\n').get_syntax_errors()
[]
Note that Jedi/Parso can deal with walruses, it's just a small parso error. Created https://github.com/davidhalter/parso/issues/212 for it.