我在 Emacs 中使用 lsp-mode(https://github.com/emacs-lsp/lsp-mode),除 html-languageserver 自动完成外,其他一切都运行正常(https://github.com/vscode-langservers/vscode-html-languageserver-bin)。
在 Emacs 中,我可以通过“lsp”命令启动服务器。但是当我尝试调用自动完成时,我的 lsp 日志中打印了以下错误消息:
<<<< html-ls:30540
{
"jsonrpc": "2.0",
"method": "window/logMessage",
"params": {
"type": 1,
"message": "Error while computing completions for file:///home/janko/tmp22/asfasdf.html: Cannot read property '0' of null\nTypeError: Cannot read property '0' of null\n at /home/janko/.config/yarn/global/node_modules/vscode-html-languageserver-bin/htmlServerMain.js:92:153"
}
}
Error while computing completions for file:///home/janko/tmp22/asfasdf.html: Cannot read property '0' of null
TypeError: Cannot read property '0' of null
at /home/janko/.config/yarn/global/node_modules/vscode-html-languageserver-bin/htmlServerMain.js:92:153
除了自动完成功能外,html 服务器似乎运行良好。lsp-describe-session 给了我以下树:
[-] /home/janko/tmp22/
`-[-] html-ls:30540
|-[-] Buffers
| `-[+] asfasdf.html
`-[-] Capabilities
|-[X] foldingRangeProvider: t
|-[X] colorProvider:
|-[X] referencesProvider: t
|-[-] signatureHelpProvider:
| `-[X] triggerCharacters: [(]
|-[X] definitionProvider: t
|-[X] documentSymbolProvider: t
|-[-] documentLinkProvider:
| `-[X] resolveProvider: nil
|-[X] documentRangeFormattingProvider: nil
|-[X] documentHighlightProvider: t
|-[X] hoverProvider: t
|-[-] completionProvider:
| |-[X] triggerCharacters: [. : < " = /]
| `-[X] resolveProvider: t
`-[X] textDocumentSync: 1
我可以使用任何新创建的 html 服务器和任何新的根文件重现该错误。
目前我尝试过的 css-server 和 typescript-server 都没有出现类似的问题。
如果您就如何进一步调查此问题提出任何建议,我们将非常感激!
答案1
原来是一个错误,问题已经修复: https://github.com/emacs-lsp/lsp-mode/issues/752