大家好,我最近在尝试使用lsp来写python,但是在使它工作在virtualenv下的时候遇到一些问题,我的配置
(use-package pyvenv
:ensure t
:config
(setenv "WORKON_HOME" (expand-file-name "~/anaconda3/envs/"))
)
(use-package lsp-python
:ensure t
:config
(setq lsp-print-io t)
(add-hook 'python-mode-hook (lambda ()
(pyvenv-mode t)
(lsp-python-enable)))
)
但是报了以下错误
lsp--stdio-wait: Content-Length: 1365
{
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"processId": 7451,
"rootPath": "/Users/xxx/xxxx/xxxx/",
"rootUri": "file:///Users/xxx/xxxx/xxxx/",
"capabilities": {
"workspace": {
"applyEdit": true,
"executeCommand": {
"dynamicRegistration": true
},
"workspaceFolders": true
},
"textDocument": {
"synchronization": {
"willSave": true,
"didSave": true,
"willSaveWaitUntil": true
},
"documentSymbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
},
"hierarchicalDocumentSymbolSupport": true
},
"formatting": {
"dynamicRegistration": true
},
"codeAction": {
"dynamicRegistration": true
}
}
},
"initializationOptions": null
},
"id": 1
}
lsp-python has exited (exited abnormally with code 1)
File mode specification error: (lsp-timed-out-error)
lsp-python-stderr
ImportError: cannot import name 'JsonRpcException'
更详细的可以见我在github上的issue#458,希望得到你们的帮助。