-
Notifications
You must be signed in to change notification settings - Fork 1.4k
There was an error while trying to initialize pylsp #2515
Copy link
Copy link
Open
Labels
Description
Description
我为我的Python项目配置了pylsp,我想测试一下它是否能在crush中正常工作.
Okay, the user wants to find all references to the `start_workflow` function in their Python project. They mentioned
that they have pylsp installed and it's a Python project, but Crush isn't showing LSP results. Let me recall how LSP
works in Crush.
First, I remember that Crush uses the LSP (Language Server Protocol) to find symbol references. The user provided the
.lsp/config.json configuration, so I need to ensure that pylsp is properly set up and running. If the LSP isn't active,
the references tool won't work.
Next, I need to check if the start_workflow function is correctly recognized by the LSP. The user has a file
交互式创建造数场景.py where start_workflow is defined. Using the lsp_references tool with the symbol name and the
path to the file should give the references. But if the LSP isn't running or isn't configured properly, it might return
no results.
I should also consider that the user might have multiple files in their project. The LSP needs to index all relevant
files to find references. The user's project structure includes src/zhucli/base/ , so the path parameter in
lsp_references should point there.
If the LSP is running and configured correctly, the lsp_references function should return all locations where
start_workflow is referenced. But if there are no external references, maybe the function is only called once or not
used elsewhere. However, the user mentioned "所有引用", implying there might be multiple, so checking the LSP setup is
crucial.
In case the LSP isn't working, the user might need to restart it using lsp_restart or verify the configuration. Once
that's done, calling lsp_references again should work. If issues persist, checking the LSP logs could help diagnose
the problem.
So, the steps are: ensure LSP is running, use lsp_references with the correct symbol and path, handle any potential
errors in LSP configuration.
✓ Find References start_workflow (path=src/zhucli/base/交互式创建造数场景.py)
Found 3 reference(s) in 2 file(s):
\d:\workboo\zhuloong\src\zhucli\base\交互式创建造数场景.py (1 reference(s)):
Line 148, Column 5
\d:\workboo\zhuloong\src\zhutui\screens\scenario.py (2 reference(s)):
Line 13, Column 35
Line 109, Column 17
从控制台的输出来看,它的确正确的找到了符号引用,但是当我查看crush.log,搜索pylsp,发现同一时间有许多重复的ERROR日志,我想请教一下这是怎么回事?
{
"time": "2026-03-28T15:41:01.9275683+08:00",
"level": "ERROR",
"source": {
"function": "github.com/charmbracelet/x/powernap/pkg/lsp.startServerProcess.func1",
"file": "github.com/charmbracelet/x/powernap@v0.1.3/pkg/lsp/client.go",
"line": 650
},
"msg": "Language server stderr",
"command": "pylsp",
"output": "2026-03-28 15:41:01,925 中国标准时间 - WARNING - pylsp.workspace - There was an error while trying to initialize progress reporting.Likely progress reporting was used in a synchronous LSP handler, which is not supported by progress reporting yet. To prevent waiting for the timeout you can set `skip_token_initialization=True`. Not every editor will show progress then, but many will.\r\nTraceback (most recent call last):\r\n File \"D:\\Python\\Python313\\Lib\\site-packages\\pylsp\\workspace.py\", line 262, in _progress_begin\r\n ).result(timeout=1.0)\r\n ~~~~~~^^^^^^^^^^^^^\r\n File \"D:\\Python\\Python313\\Lib\\concurrent\\futures\\_base.py\", line 458, in result\r\n raise TimeoutError()\r\nTimeoutError\r\n"
}Version
v0.53.0
Environment
win11 / wt.exe / pwsh
Reactions are currently unavailable