sublimelsp / LSP-pyright

Python support for Sublime's LSP plugin provided through microsoft/pyright.
MIT License
131 stars 13 forks source link

Crashes in ST3 #284

Closed rchl closed 1 year ago

rchl commented 1 year ago

It might be happening only with PC4 but not entirely sure. This code crashes:

https://github.com/sublimelsp/LSP-pyright/blob/8eb42312621efce4efabd421845ed56369422d33/plugin.py#L164-L182

with:

Traceback (most recent call last):
  File "/Applications/Sublime Text 3.app/Contents/MacOS/sublime_plugin.py", line 298, in on_api_ready
    plc()
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP.sublime-package/plugin/core/main.py", line 26, in plugin_loaded
    load_handlers()
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP.sublime-package/plugin/core/registry.py", line 59, in load_handlers
    register_language_handler(handler)
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP.sublime-package/plugin/core/registry.py", line 65, in register_language_handler
    config = handler.config
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Lib/python3.3/lsp_utils/_client_handler/language_handler.py", line 94, in config
    self.on_settings_changed(client_config.settings)
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP-pyright.sublime-package/plugin.py", line 61, in on_settings_changed
    extraPaths.extend(self.find_package_dependency_dirs(py_ver))
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP-pyright.sublime-package/plugin.py", line 175, in find_package_dependency_dirs
    dep_dirs.remove(ST_PACKAGES_PATH)
ValueError: list.remove(x): x not in list
rchl commented 1 year ago

Should mention that that was with "pyright.dev_environment": "sublime_text_33" set.

With "pyright.dev_environment": "sublime_text" there is another error:

Traceback (most recent call last):
  File "/Applications/Sublime Text 3.app/Contents/MacOS/sublime_plugin.py", line 298, in on_api_ready
    plc()
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP.sublime-package/plugin/core/main.py", line 26, in plugin_loaded
    load_handlers()
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP.sublime-package/plugin/core/registry.py", line 59, in load_handlers
    register_language_handler(handler)
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP.sublime-package/plugin/core/registry.py", line 65, in register_language_handler
    config = handler.config
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Lib/python3.3/lsp_utils/_client_handler/language_handler.py", line 94, in config
    self.on_settings_changed(client_config.settings)
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP-pyright.sublime-package/plugin.py", line 59, in on_settings_changed
    py_ver = self.detect_st_py_ver(dev_environment)
  File "/Users/rafal/Library/Application Support/Sublime Text 3/Installed Packages/LSP-pyright.sublime-package/plugin.py", line 142, in detect_st_py_ver
    session = self.weaksession()
AttributeError: 'LspPyrightPlugin' object has no attribute 'weaksession'
jfcherng commented 1 year ago

Hmm... what's the way to get workspace folders (or window) of the session if there is no weaksession for ST 3 LSP?

jfcherng commented 1 year ago

Or maybe just remove sublime_text (and sublime_text_38) since it makes less sense that a user uses ST 3 to edit a py38 ST 4 plugin.

jfcherng commented 1 year ago

Or maybe just remove sublime_text (and sublime_text_38) since it makes less sense that a user uses ST 3 to edit a py38 ST 4 plugin.

Fixed in st3-1.2.42.