pyls does not work on Python 3.11
Porcupine uses pyls as the default langserver for Python. It does not work at all on Python 3.11. This means that you don't get jump-to-definition or reasonable autocompletions, unless you run Porcupine on an older python version.
I really should consider switching to pyright (#560)
Yup, besides pyls I can say that everything works fine on 3.11, I've been using it for about half a year when Debian unstable got it.
Do we know which tests are expected to fail as a result of this? Can we conditionally xfail and/or skip them for now?
These tests fail for me with python 3.11, but it's possible there are other factors at play:
FAILED tests/test_indent_dedent.py::test_markdown_autoindent - AssertionError: assert '1. Lol and\n...\nEnd of list' == '1. Lol and\n...\nEnd of list' FAILED tests/test_jump_to_definition_plugin.py::test_basic - RuntimeError: timed out waiting FAILED tests/test_jump_to_definition_plugin.py::test_two_definitions - RuntimeError: timed out waiting FAILED tests/test_rstrip_plugin.py::test_rstrip - assert 'print("hello") ' == 'print("hello")\n' FAILED tests/test_tabs.py::test_read_only_file - ValueError: too many values to unpack (expected 1) ERROR tests/test_jump_to_definition_plugin.py::test_basic - ValueError: error in tkinter callback while running test ERROR tests/test_jump_to_definition_plugin.py::test_two_definitions - ValueError: error in tkinter callback while running test
I think only the test_jump_to_definition_plugin.py failures are caused by this. If you xfail them, it would be nice if you made a PR about it, and also add 3.11 to version lists in .github/workflows/ so that CI tests it with the xfails :)
Upstream issue: https://github.com/palantir/python-language-server/issues/959
I think we should consider switching to https://github.com/python-lsp/python-lsp-server
Pyright is not really a replacement for pyls; it is just a static type checker (Mypy replacement). The VSCode/Microsoft LSP that does auto-completion, refactoring, etc is pylance which is not open source (or usable outside of VSCode at all).
I am aware that pyright and pylance are not the same, but pyright also has a langserver that gives autocompletions and such. It is usable without pylance, and probably enough for Porcupine without pylance.
At least this is my understanding of pyright's langserver. Feel free to prove me wrong :)
Huh, you appear to be correct: https://microsoft.github.io/pyright/#/features?id=language-server-support
I do wonder then what Pylance does that Pyright doesn't.
That said, I prefer Mypy to Pylance pretty strongly for type checking specifically, so if possible I would vote that we retain Mypy support regardless of what language server we go with :)
Mypy support would be retained of course, the same way as you can use it now: open the run dialog and run Mypy from there. However, for type checking Porcupine itself we'd like to switch to Pyright.