sublimelsp / LSP-pyright

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

`"analysis.extraPaths"` no longer working? #351

Open munkybutt opened 3 weeks ago

munkybutt commented 3 weeks ago

As of this morning neither Pyright nor BasedPyright can resolve packages in "analysis.extraPaths". Everything was functional last night 😢 I have tried re-installing both as well as LSP and the troubleshoot server shows no issues. I didn't see any update in sublime this morning so not sure what the issue could be?

jfcherng commented 3 weeks ago

so how do you set it? what is its value? what is your working environment, directory structure etc?

and what is the lsp-pyright prompt in the stastus bar? any error message in ST console?

munkybutt commented 3 weeks ago

No errors that I can see. The paths are set in the sublime-project and are hard coded to avoid relative pathing issues:

"settings":
{
    "LSP": {
        "LSP-basedpyright": {
            "settings": {
                "basedpyright.analysis.extraPaths": [
                    "D:/p4/tools/dcc_tools/ayon/stubs",
                    "D:/p4/tools/dcc_tools/ayon/ayon-core/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-launcher/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-version-control/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-dependencies-tool/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-backend",
                    "D:/p4/tools/dcc_tools/ayon/ayon-core/client",
                    "D:/p4/tools/dcc_tools/ayon/ayon-applications/client",
                    "D:/p4/tools/dcc_tools/ayon/ayon-version-control/client",
                ],
            },

            "enabled": true,
        },
        "LSP-pyright": {
            "settings": {
                "python.analysis.extraPaths": [
                    "D:/p4/tools/dcc_tools/ayon/stubs",
                    "D:/p4/tools/dcc_tools/ayon/ayon-core/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-launcher/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-version-control/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-dependencies-tool/.venv/Lib/site-packages",
                    "D:/p4/tools/dcc_tools/ayon/ayon-backend",
                    "D:/p4/tools/dcc_tools/ayon/ayon-core/client",
                    "D:/p4/tools/dcc_tools/ayon/ayon-applications/client",
                    "D:/p4/tools/dcc_tools/ayon/ayon-version-control/client",
                ],
            },

            "enabled": false,
        },
        "LSP-ruff": {
            "initializationOptions": {
                "settings": {
                    "configuration": "D:/p4/tools/dcc_tools/ayon/ayon-core/pyproject.toml",
                    "organizeImports": false,
                },
            },
        },
    }
}

Output of troubleshooting:

Troubleshooting: LSP-basedpyright

Version

## Server Configuration
 - command
```json
[
  "${node_bin}",
  "${server_path}",
  "--stdio"
]

Active view

Project / Workspace

LSP configuration

{
  "diagnostics_additional_delay_auto_complete_ms": 0,
  "diagnostics_delay_ms": 0,
  "diagnostics_gutter_marker": "dot",
  "diagnostics_highlight_style": {
    "error": "squiggly",
    "hint": "underline",
    "info": "underline",
    "warning": "squiggly"
  },
  "diagnostics_panel_include_severity_level": 4,
  "document_highlight_style": "underline",
  "inhibit_snippet_completions": false,
  "inhibit_word_completions": true,
  "log_debug": false,
  "log_max_size": 8192,
  "log_server": [],
  "lsp_code_actions_on_save": {
    "source.organizeImports": true
  },
  "lsp_format_on_save": false,
  "on_save_task_timeout_ms": 2000,
  "popup_max_characters_height": 1250,
  "popup_max_characters_width": 100,
  "semantic_highlighting": false,
  "show_code_actions": "annotation",
  "show_code_actions_in_hover": true,
  "show_code_lens": "annotation",
  "show_diagnostics_count_in_view_status": false,
  "show_diagnostics_in_view_status": true,
  "show_diagnostics_panel_on_save": 0,
  "show_diagnostics_severity_level": 4,
  "show_multiline_diagnostics_highlights": true,
  "show_references_in_quick_panel": false,
  "show_symbol_action_links": true,
  "show_view_status": true
}

System PATH

So ayon_core is in "D:/p4/tools/dcc_tools/ayon/ayon-core/client" but it cannot be resolved even though the path is in "extraPaths"

image

image

jfcherng commented 3 weeks ago

Oops. I thought it's pythonPath, which we have some refactoring recently. We hardly change analysis.extraPaths.

jfcherng commented 3 weeks ago

Wrong repo for filing an issue? since you are using basedpyright.

jfcherng commented 3 weeks ago

Didn't see any "path" mentioned in the pyright changelog. My pylance still works well.

munkybutt commented 3 weeks ago

Wrong repo for filing an issue? since you are using basedpyright.

It is broken for both pyright and basedPyright and as based is a fork of pyright I figured made more sense here?

It is very strange - everything was fine last night before I shut down, this morning it is borked :(

Here is the pyright output:

Troubleshooting: LSP-pyright

Version

## Server Configuration
 - command
```json
[
  "${node_bin}",
  "${server_path}",
  "--stdio"
]

Active view

Project / Workspace

LSP configuration

{
  "diagnostics_additional_delay_auto_complete_ms": 0,
  "diagnostics_delay_ms": 0,
  "diagnostics_gutter_marker": "dot",
  "diagnostics_highlight_style": {
    "error": "squiggly",
    "hint": "underline",
    "info": "underline",
    "warning": "squiggly"
  },
  "diagnostics_panel_include_severity_level": 4,
  "document_highlight_style": "underline",
  "inhibit_snippet_completions": false,
  "inhibit_word_completions": true,
  "log_debug": false,
  "log_max_size": 8192,
  "log_server": [],
  "lsp_code_actions_on_save": {
    "source.organizeImports": true
  },
  "lsp_format_on_save": false,
  "on_save_task_timeout_ms": 2000,
  "popup_max_characters_height": 1250,
  "popup_max_characters_width": 100,
  "semantic_highlighting": false,
  "show_code_actions": "annotation",
  "show_code_actions_in_hover": true,
  "show_code_lens": "annotation",
  "show_diagnostics_count_in_view_status": false,
  "show_diagnostics_in_view_status": true,
  "show_diagnostics_panel_on_save": 0,
  "show_diagnostics_severity_level": 4,
  "show_multiline_diagnostics_highlights": true,
  "show_references_in_quick_panel": false,
  "show_symbol_action_links": true,
  "show_view_status": true
}

System PATH

image

jfcherng commented 3 weeks ago

Do you know how to revert to any LSP-pyright version you want to use? (i.e., that previous one)

munkybutt commented 3 weeks ago

oh no - had no idea that was possible. Is there a command or setting?

jfcherng commented 3 weeks ago

oh no - had no idea that was possible. Is there a command or setting?

Basically you just clone this repository so that it's put like

Packages/
├── LSP-pyright
│   ├── boot.py
│   ├── ...

you can checkout to any commit and restart ST to test.

munkybutt commented 3 weeks ago

ok - rolling back to 1.2.9 gets things working again: https://github.com/sublimelsp/LSP-basedpyright/releases/tag/1.2.9

munkybutt commented 3 weeks ago

I haven't tried pyright - but I expect it will have the same thing

jfcherng commented 3 weeks ago

ok - rolling back to 1.2.9 gets things working again: sublimelsp/LSP-basedpyright@1.2.9 (release)

Can you try v1.2.10? The one you used when you creating this issue is probably v1.2.11 (Package Control doesn't care GitHub Releases but it cares git tags).

munkybutt commented 3 weeks ago

Pyright v1.4.13 is borked BasedPyright v1.2.10 is functional

jfcherng commented 3 weeks ago

my current best guess is that pyright 1.1.376 is broken because

but I don't see any related issue on https://github.com/microsoft/pyright/issues at the first glance.

jfcherng commented 3 weeks ago

hmm... wait, no LSP-pyright pyright 1.1.375

having no idea what's going on at this moment. at the same time your seem to be the only one who is affected by this issue.

munkybutt commented 3 weeks ago

ok - I am happy to pin to a version that is working for me and review in a few more releases to see if I can stick to latest again. And if not will come back to try and debug further? Thanks very much for you help @jfcherng <3