typescript-language-server vs tide,tls的提示不全啊?

最近在doom-emacs中开启了lsp,发现lsp-mode在鼠标停在关键字上的提示很多时候是空的,然后试了下tide,发现tide是可以的。 以下是同一个位置打印的日志,typescript-language-server的返回结果是null,而tide和vscode都能正常返回:

typescript-language-server

[Trace - 08:55:22 PM] Sending request 'textDocument/signatureHelp - (196)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/jadestrong/Documents/JadeStrong/ts-react-app/src/components/demo/HelloHOC.tsx"
  },
  "position": {
    "line": 16,
    "character": 15
  }
}


[Trace - 08:55:22 PM] Received response 'textDocument/signatureHelp - (196)' in 50ms.
Result: null

tide

Info 208  [20:55:22.744] request:
    {"command":"quickinfo-full","seq":"53","arguments":{"file":"/Users/jadestrong/Documents/JadeStrong/ts-react-app/src/components/demo/HelloHOC.tsx","line":17,"offset":16}}
Perf 209  [20:55:22.748] 53::quickinfo-full: elapsed time (in milliseconds) 4.1162
Info 210  [20:55:22.748] response:
    {"seq":0,"type":"response","command":"quickinfo-full","request_seq":"53","success":true,"body":{"kind":"function","kindModifiers":"","textSpan":{"start":444,"length":8},"displayParts":[{"text":"function","kind":"keyword"},{"text":" ","kind":"space"},{"text":"HelloHOC","kind":"functionName"},{"text":"<","kind":"punctuation"},{"text":"Greeting","kind":"interfaceName"},{"text":">","kind":"punctuation"},{"text":"(","kind":"punctuation"},{"text":"WrappedComponent","kind":"parameterName"},{"text":":","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"React","kind":"aliasName"},{"text":".","kind":"punctuation"},{"text":"ComponentType","kind":"aliasName"},{"text":"<","kind":"punctuation"},{"text":"Greeting","kind":"interfaceName"},{"text":">","kind":"punctuation"},{"text":")","kind":"punctuation"},{"text":":","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"typeof","kind":"keyword"},{"text":" ","kind":"space"},{"text":"(Anonymous class)","kind":"className"}],"documentation":[]}}

vscode

Info 410  [20:56:47.994] request:
    {"seq":77,"type":"request","command":"quickinfo","arguments":{"file":"/Users/jadestrong/Documents/JadeStrong/ts-react-app/src/components/demo/HelloHOC.tsx","line":17,"offset":16}}
Perf 411  [20:56:47.997] 77::quickinfo: elapsed time (in milliseconds) 2.1839
Info 412  [20:56:47.997] response:
    {"seq":0,"type":"response","command":"quickinfo","request_seq":77,"success":true,"body":{"kind":"function","kindModifiers":"","start":{"line":17,"offset":16},"end":{"line":17,"offset":24},"displayString":"function HelloHOC<Greeting>(WrappedComponent: React.ComponentType<Greeting>): typeof (Anonymous class)","documentation":"","tags":[]}

对比了一通发现lsp存在 textDocument/signatureHelptextDocument/hover 两个东西,而doom-emacs禁用了hover:

  :config
  (setq lsp-prefer-flymake nil
        lsp-ui-doc-max-height 8
        lsp-ui-doc-max-width 35
        lsp-ui-sideline-ignore-duplicate t
        ;; lsp-ui-doc is redundant with and more invasive than
        ;; `+lookup/documentation'
        lsp-ui-doc-enable nil
        ;; Don't show symbol definitions in the sideline. They are pretty noisy,
        ;; and there is a bug preventing Flycheck errors from being shown (the
        ;; errors flash briefly and then disappear).
        lsp-ui-sideline-show-hover nil
        ;; `lsp-ui' offers its own eldoc integration, which is redundant with
        ;; lsp-mode's.
        lsp-eldoc-enable-hover nil)

默认使用signatureHelp,但是这个东西好像不大好使,目前禁用signatureHelp并开启hover:

 lsp-eldoc-prefer-signature-help nil
 lsp-eldoc-enable-signature-help nil
 lsp-eldoc-enable-hover t

这样目前可以正常工作

然后特地去查了下+lookup/document,发现当鼠标在某个关键字上时,按shift+k才可以弹出一个mini-buffer来显示提示,感觉有点鸡肋啊

都用emacs了,谁还用鼠标? :joy:

linux发行版公司都没什么人用纯键盘。。。虽然用emacs的不算太多

在vscode下面确实是鼠标hover上去触发,但是emacs下面即使hover上去好像也没啥用,所以这里要的是当光标移动到这个关键字上时能出现vscode的hover提示,lsp-mode和tide也是这么实现的,只是doom-emacs给关掉了。。。。

我感觉你开启这个应该就可以了

应该是,我回头试试,如果可以应该比我上面的改法好

刚试了下发现doom-emacs下只是开启 lsp-ui-doc-enable 也没起作用,连lsp-ui-doc-mode也没给开启,手动开启也没起作用

我没有使用 doom-emacs,可以参考下我的配置:

这个UI看起来挺漂亮的,我回头研究一下

我还真想不到在emacs里有啥需要用鼠标的哈