Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add the current project path to "python.analysis.extraPaths", currently using version 1.3.1 #324

Open
maryjeck opened this issue Apr 27, 2024 · 41 comments
Labels
help wanted Extra attention is needed

Comments

@maryjeck
Copy link

before the version 1.3.1,it's auto include it

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 27, 2024

We do have some logics for python.analysis.extraPaths but I don't think LSP-pyright have ever included the current project path. What we do for python.analysis.extraPaths is to find Sublime Text API stubs and installed Python libraries for Sublime Text plugin hosts and that only happens when the user sets pyright.dev_environment. That's totally unrelated to your description.

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 27, 2024

Since your description is pretty specific, how do you find LSP-pyright adds the current project path to python.analysis.extraPaths? Or, maybe, what you are actually trying to achieve?

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 28, 2024

Didn't see Path (plaintext search) in pyright's recent changelog either 🤔

@maryjeck
Copy link
Author

maryjeck commented Apr 29, 2024

In the previous version, my custom module could be imported normally, but in this latest version, my project's custom module cannot be recognized.
So I want to ask if there is any special parameter indicating the current project path

@jfcherng
Copy link
Collaborator

In the previous version, my custom module could be imported normally, but in this latest version, my project's custom module cannot be recognized. So I want to ask if there is any special parameter indicating the current project path

Could you provide a minimal reproducer repository (or uploading a .zip file) for test?

@maryjeck
Copy link
Author

In the previous version, my custom module could be imported normally, but in this latest version, my project's custom module cannot be recognized. So I want to ask if there is any special parameter indicating the current project path在以前的版本中,我的自定义模块可以正常导入,但在这个最新版本中,我无法识别我的项目的自定义模块。所以我想问一下是否有任何特殊参数指示当前项目路径

Could you provide a minimal reproducer repository (or uploading a .zip file) for test?你能提供一个最小的复制器存储库(或上传 .zip 文件)进行测试吗?

ok,I'll pack it up

@maryjeck
Copy link
Author

test.zip
This is a test file

图片
显示这个错误

@maryjeck
Copy link
Author

It will be recognized in previous versions

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 29, 2024

image

I am not able to reproduce this with the latest released LSP-pyright. Could you share your LSP-pyright's settings?


Could your issue be reproduced in Sublime Text's safe mode without changing any LSP-pyright's settings?

@maryjeck
Copy link
Author

maryjeck commented Apr 29, 2024

// Settings in here override those in "LSP-pyright/LSP-pyright.sublime-settings"
{
    "settings": {
        "python.analysis.extraPaths": [
            "F:\\miniconda3\\Lib",
            "F:\\miniconda3\\Lib\\site-packages",
            "./"
        ],
        "python.analysis.autoSearchPaths": true,
        "python.analysis.stubPath": "./typings",
        "python.analysis.diagnosticMode": "workspace",
        "python.analysis.diagnosticSeverityOverrides": {
            "reportUnboundVariable": "none",
            "reportGeneralTypeIssues": "information",
            "reportOptionalMemberAccess": "none",
            "reportUnusedImport": "warning"
        },
        "python.analysis.typeshedPaths": [
            "."
        ],
        "python.analysis.typeCheckingMode": "off",
        "pyright.disableOrganizeImports": true,
        "python.pythonPath": "F:\\miniconda3\\python.exe",
        "python.venvPath": ".",
    }
}

@maryjeck
Copy link
Author

图片
here

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 29, 2024

Still can't reproduce, even with the exact plugin settings.

image

// Settings in here override those in "LSP-pyright/LSP-pyright.sublime-settings"
{
    "settings": {
        "python.analysis.extraPaths": [
            "C:\\Users\\jfcherng\\AppData\\Local\\Programs\\Python\\Python38\\Lib",
            "C:\\Users\\jfcherng\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages",
            "./"
        ],
        "python.analysis.autoSearchPaths": true,
        "python.analysis.stubPath": "./typings",
        "python.analysis.diagnosticMode": "workspace",
        "python.analysis.diagnosticSeverityOverrides": {
            "reportUnboundVariable": "none",
            "reportGeneralTypeIssues": "information",
            "reportOptionalMemberAccess": "none",
            "reportUnusedImport": "warning"
        },
        "python.analysis.typeshedPaths": [
            "."
        ],
        "python.analysis.typeCheckingMode": "off",
        "pyright.disableOrganizeImports": true,
        "python.pythonPath": "C:\\Users\\jfcherng\\AppData\\Local\\Programs\\Python\\Python38\\python.exe",
        "python.venvPath": ".",
    }
}

@jfcherng
Copy link
Collaborator

Could your issue be reproduced in Sublime Text's safe mode without changing any LSP-pyright's settings?

This hasn't been answered yet.

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 29, 2024

Someone probably has the same issue: microsoft/pyright#7016 (comment)
But it's claimed fixed in pyright 1.1.360, which is LSP-pyright 1.3.1 🤔

@maryjeck
Copy link
Author

maryjeck commented Apr 29, 2024

Someone probably has the same issue: microsoft/pyright#7016 (comment) But it's claimed fixed in pyright 1.1.360, which is LSP-pyright 1.3.1 🤔

What I use is LSP-pyright 1.3.1

@maryjeck
Copy link
Author

@jfcherng How to roll back to the previous version or a specific version

@jfcherng
Copy link
Collaborator

jfcherng commented Apr 30, 2024

@jfcherng How to roll back to the previous version or a specific version

I guess basically you want Package Control to not manage it.

	"unmanaged_packages_ignore": [],

Or just overwrite language-server to an old version.

@maryjeck
Copy link
Author

maryjeck commented May 4, 2024

The status of version 1.3.2 is the same, and the reconfiguration is also the same, o(╥﹏╥)o

@jfcherng
Copy link
Collaborator

jfcherng commented May 4, 2024

Have you found a working old version yet?

@maryjeck
Copy link
Author

maryjeck commented May 4, 2024

I don’t know how to roll back. After setting it up according to your method, it didn’t roll back to the previous version.

@jfcherng
Copy link
Collaborator

jfcherng commented May 4, 2024

I don’t know how to roll back. After setting it up according to your method, it didn’t roll back to the previous version.

It prevents package control from managing (updating) it. It won't do rollback. It's you who have to do the rollback.

@jfcherng
Copy link
Collaborator

jfcherng commented May 4, 2024

I don’t know how to roll back.

  1. Download the version you want. E.g., https://github.com/sublimelsp/LSP-pyright/archive/refs/tags/1.3.2.zip
  2. Decompress and put it like
Packages
└── LSP-pyright
    ├── commands.py
    ├── dependencies.json
    ├── language-server
    │   ├── package.json
    │   └── package-lock.json
    ├── ...

If you decompress it, it's LSP-pyright-1.3.2, you have to rename it as LSP-pyright and put it under Packages.

  1. Restart ST.

And if you are familiar with git, you will know you can do this with git and quickly switch among versions.

@maryjeck
Copy link
Author

maryjeck commented May 4, 2024

图片
This version works very well, and can be retired as long as the upstream version is not resolved.

@maryjeck
Copy link
Author

maryjeck commented May 4, 2024

Say something else
图片
Except for one package, lsp-basedpyright is also limited to this version. Is it because lsp is not set up properly or is it an upstream problem?

@jfcherng
Copy link
Collaborator

jfcherng commented May 4, 2024

Just to confirm. LSP-pyright 1.3.0 and LSP LSP-basedpyright 1.1.0 both work for you and their next version failed, right?

@maryjeck
Copy link
Author

maryjeck commented May 4, 2024

Just to confirm. LSP-pyright 1.3.0 and LSP LSP-basedpyright 1.1.0 both work for you and their next version failed, right?

yes。The latter two versions of these two plug-ins do not work normal, whether it is a clean system or a safe mode

@maryjeck
Copy link
Author

maryjeck commented May 5, 2024

LSP-basedpyright

By the way, I replaced package.json and package-lock.json in LSP-basedpyright 1.1.0 with the same files in 1.1.2, and the result is that it runs perfectly. It seems that it is not an upstream problem. Please help to see if there is a setting problem

@jfcherng
Copy link
Collaborator

jfcherng commented May 6, 2024

Could you try this: https://github.com/sublimelsp/LSP-pyright/archive/refs/heads/fix/import-not-found.zip

I doubt it may be fixed by 273a22c. This is the only behavior change that I notice between v1.3.0 and v1.3.1: 1.3.0...1.3.1

@maryjeck
Copy link
Author

maryjeck commented May 7, 2024

Could you try this: https://github.com/sublimelsp/LSP-pyright/archive/refs/heads/fix/import-not-found.zip

I doubt it may be fixed by 273a22c. This is the only behavior change that I notice between v1.3.0 and v1.3.1: 1.3.0...1.3.1

sorry,Still not working

@jfcherng
Copy link
Collaborator

jfcherng commented May 7, 2024

Unfortunately, I still can't spot other behavior different between 1.3.0...1.3.1.

@jfcherng jfcherng added the help wanted Extra attention is needed label May 7, 2024
@jfcherng
Copy link
Collaborator

jfcherng commented May 7, 2024

Could you provide LSP-pyright's initialization logs (in LSP's log panel) for both v1.3.0 and v1.3.1 on your side?

@maryjeck
Copy link
Author

maryjeck commented May 9, 2024

log panel

How to view lsp logs?
image

Like this?

@jfcherng
Copy link
Collaborator

jfcherng commented May 9, 2024

log panel

How to view lsp logs? image

Like this?

yes, but a screenshot won't help. you can save them into files, zip them and upload here.

@maryjeck
Copy link
Author

maryjeck commented May 9, 2024

I will create a new clean version and send it to you.

@jfcherng
Copy link
Collaborator

jfcherng commented May 9, 2024

I will create a new clean version and send it to you.

Appreciated.

@maryjeck
Copy link
Author

lsp-pyright-logs.zip
Sorry, I've been away on a business trip recently and haven't had the time to test it. I'm uploading it for you now.

@maryjeck
Copy link
Author

I have determined that in my case, it is a problem with the upstream language-server. I still use 1.3.0

@jfcherng
Copy link
Collaborator

jfcherng commented May 17, 2024

I have determined that in my case, it is a problem with the upstream language-server. I still use 1.3.0

You mean this is a pyright issue rather than lsp-pyright's?

@jfcherng
Copy link
Collaborator

jfcherng commented May 17, 2024

lsp-pyright-logs.zip Sorry, I've been away on a business trip recently and haven't had the time to test it. I'm uploading it for you now.

Thanks for providing these information. But I need logs both when working and when not working, so we can find the difference.

@maryjeck
Copy link
Author

diff.zip
This is the log for 1.10 and 1.15.

@jfcherng
Copy link
Collaborator

jfcherng commented May 21, 2024

OK (1.1.0?)

'diagnosticMode': 'workspace', 'extraPaths': ['F:\\miniconda3\\Lib', 'F:\\miniconda3\\Lib\\site-packages', '.\\', './', '', '.'],

FAILED (1.1.5?)

'diagnosticMode': 'openFilesOnly', 'extraPaths': [],

Expected to be failed but I doubt they are run under the exact same setup.


I think they have some fundamental differences so that I don't think they are run under the same setup. Hence diff.zip is probably useless.

I would expect the only environment difference when running for logs is the version number of LSP-basedpyright or LSP-pyright. Same ST workspace, plugin settings, project settings, same opened file etc... except that one uses LSP-basedpyright v1.1.0 and the other uses v1.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants