lsp-ui 问题

最近更新了下lsp相关的包,然后发现光标移动至关键字的时候lsp-ui就会报错,而且仅在lsp-javascript-typescript下会有这个问题,在lsp-python中不会有这个问题。

求教如何解决。

backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("\\(?:[ \011\n\015]+\\)\\'" nil)
  lsp-ui-doc--extract-marked-string(#<hash-table equal 2/65 0x45742c3d>)
  lsp-ui-doc--set-eldoc(#<hash-table equal 2/65 0x45742c3d>)
  lsp-ui-doc--filter-marked-string((#<hash-table equal 2/65 0x45742c3d> "**alias**"))
  lsp-ui-doc--extract((#<hash-table equal 2/65 0x45742c3d> "**alias**"))
  lsp-ui-doc--callback(#<hash-table equal 2/65 0x45742c1d> (249 . 258) #<buffer App.js>)
  #f(compiled-function (hover) #<bytecode 0x6057338d>)(#<hash-table equal 2/65 0x45742c1d>)
  lsp--parser-on-message(#s(lsp--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "" :queued-notifications nil :queued-requests nil :workspace #s(lsp--workspace :parser #1 :file-versions #<hash-table equal 1/65 0x5e9de3dd> :server-capabilities #<hash-table equal 15/65 0x5da0aab5> :registered-server-capabilities nil :root "/Users/tingzhou/Developer/cryptoground/frontend/" :client #s(lsp--client :language-id #f(compiled-function (_) #<bytecode 0x5e9b92e1>) :send-sync nil :send-async nil :type nil :new-connection #f(compiled-function (filter sentinel) #<bytecode 0x5e9b932d>) :stderr "*lsp-javascript-typescript stderr*" :get-root #f(compiled-function () #<bytecode 0x5e9b9111>) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content not available") :notification-handlers #<hash-table equal 0/65 0x5e9b9339> :request-handlers #<hash-table equal 0/65 0x5e9bce2d> :response-handlers #<hash-table eql 224/325 0x5e9bd05d> :string-renderers (("javascript" . lsp-javascript-typescript--render-string) ("typescript" . lsp-javascript-typescript--render-string)) :last-id 235 :enable-function lsp-javascript-typescript-enable :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x5e9bd07d> :action-handlers #<hash-table equal 0/65 0x5e9bd09d>) :change-timer-disabled nil :proc #<process lsp-javascript-typescript> :cmd-proc #<process lsp-javascript-typescript> :buffers (#<buffer App.js>) :highlight-overlays #<hash-table eq 0/65 0x5e9de60d> :extra-client-capabilities nil :status nil :metadata #<hash-table equal 0/65 0x5e9de62d> :watches #<hash-table equal 0/65 0x5e9de64d>)) "{\"jsonrpc\":\"2.0\",\"id\":235,\"result\":{\"contents\":[{\"language\":\"typescript\",\"value\":\"import Component\"},\"**alias**\"],\"range\":{\"start\":{\"line\":7,\"character\":18},\"end\":{\"line\":7,\"character\":27}}}}")
  #f(compiled-function (proc output) #<bytecode 0x5e9df665>)(#<process lsp-javascript-typescript> "Content-Length: 191\015\n\015\n{\"jsonrpc\":\"2.0\",\"id\":235,\"result\":{\"contents\":[{\"language\":\"typescript\",\"value\":\"import Component\"},\"**alias**\"],\"range\":{\"start\":{\"line\":7,\"character\":18},\"end\":{\"line\":7,\"character\":27}}}}")

My packages version:

lsp-mode: 20180518.2223

lsp-ui: 20180526.2113

lsp-javascript-typescript is pulled from Github.

然后我的node的bins是在~/.npm-global/bin下的,我也加到了exec-path里面了

考虑用专门的 Issue Tracker 来需求帮助。

我在lsp-javascript里提了个,然后有两个开发者回答了下,但他们没法重现我的情况~所以来这儿看看有木有跟我一样情况的小伙伴。

lsp-javascript-typescript-enable 现在稳定了吗?

在我这里不工作,看 *Messages* 是启动之后超时退出了:

>>> my/lsp-javascript-typescript-enable
>>> nodenv-mode on
[nodenv] ~/repos/go/gui/gotron/.node-version => 6.0.0
File mode specification error: (lsp-timed-out-error)
~/repos/go/gui/gotron/ui/react/: lsp-javascript-typescript has exited (exited abnormally with code 1)

*Backtrace* 显示初始化无响应:

Debugger entered--Lisp error: (lsp-timed-out-error)
  signal(lsp-timed-out-error nil)
  lsp--send-wait("Content-Length: 590\15\n\15\n{\"jsonrpc\":\"2.0\",\"method\":
  \"initialize\",\"params\":{\"processId\":14391,\"rootPath\":\"....
...
Debugger entered--Lisp error: (lsp-timed-out-error)
  signal(lsp-timed-out-error nil)
  lsp--send-wait("Content-Length: 590\15\n\15\n{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"params\":{\"processId\":14391,\"rootPath\":\"/Volumes/HDD/Users/myth/repos/go/gui/gotron/ui/react/\",\"rootUri\":\"file:///Volumes/HDD/Users/myth/repos/go/gui/gotron/ui/react/\",\"capabilities\":{\"workspace\":{\"applyEdit\":true,\"executeCommand\":{\"dynamicRegistration\":true}},\"textDocument\":{\"synchronization\":{\"willSave\":true,\"didSave\":true,\"willSaveWaitUntil\":true},\"symbol\":{\"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]}},\"completion\":{\"completionItem\":{\"snippetSupport\":true}}}},\"initializationOptions\":null},\"id\":1}" #<process lsp-javascript-typescript> #s(lsp--parser :waiting-for-response t :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received 0 :leftovers nil :queued-notifications nil :queued-requests nil :workspace #s(lsp--workspace :parser #3 :file-versions #<hash-table equal 0/65 0x4222310d> :server-capabilities nil :registered-server-capabilities nil :root "/Volumes/HDD/Users/myth/repos/go/gui/gotron/ui/react/" :client #s(lsp--client :language-id #f(compiled-function (_) #<bytecode 0x41e68cff>) :send-sync nil :send-async nil :type nil :new-connection #f(compiled-function (filter sentinel) #<bytecode 0x428867c1>) :stderr "*lsp-javascript-typescript stderr*" :get-root #f(compiled-function () #<bytecode 0x42c94e49>) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content not available") :notification-handlers #<hash-table equal 0/65 0x428867cd> :request-handlers #<hash-table equal 0/65 0x42d84341> :response-handlers #<hash-table eql 0/65 0x42d84361> :string-renderers (("javascript" . lsp-javascript-typescript--render-string) ("typescript" . lsp-javascript-typescript--render-string)) :last-id 1 :enable-function lsp-javascript-typescript-enable :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x426f6e31> :action-handlers #<hash-table equal 0/65 0x426f6e51> :default-renderer nil) :change-timer-disabled nil :proc #<process lsp-javascript-typescript> :cmd-proc #<process lsp-javascript-typescript> :buffers nil :highlight-overlays #<hash-table eq 0/65 0x426d8a79> :extra-client-capabilities ((company-lsp . company-lsp--client-capabilities)) :status nil :metadata #<hash-table equal 0/65 0x426d8a99> :watches #<hash-table equal 0/65 0x422cab79>)))
  lsp--send-request((:jsonrpc "2.0" :method "initialize" :params (:processId 14391 :rootPath "/Volumes/HDD/Users/myth/repos/go/gui/gotron/ui/react/" :rootUri "file:///Volumes/HDD/Users/myth/repos/go/gui/gotron/ui/react/" :capabilities (:workspace (:applyEdit t :executeCommand (:dynamicRegistration t)) :textDocument (:synchronization (:willSave t :didSave t :willSaveWaitUntil t) :symbol (: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))) :completion (:completionItem (:snippetSupport t)))) :initializationOptions nil) :id 1))
  lsp--start(#s(lsp--client :language-id #f(compiled-function (_) #<bytecode 0x41e68cff>) :send-sync nil :send-async nil :type nil :new-connection #f(compiled-function (filter sentinel) #<bytecode 0x428867c1>) :stderr "*lsp-javascript-typescript stderr*" :get-root #f(compiled-function () #<bytecode 0x42c94e49>) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content not available") :notification-handlers #<hash-table equal 0/65 0x428867cd> :request-handlers #<hash-table equal 0/65 0x42d84341> :response-handlers #<hash-table eql 0/65 0x42d84361> :string-renderers (("javascript" . lsp-javascript-typescript--render-string) ("typescript" . lsp-javascript-typescript--render-string)) :last-id 1 :enable-function lsp-javascript-typescript-enable :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x426f6e31> :action-handlers #<hash-table equal 0/65 0x426f6e51> :default-renderer nil) nil)
  lsp--enable-stdio-client(lsp-javascript-typescript :language-id "javascript" :language-id-fn nil :root-directory-fn #f(compiled-function () #<bytecode 0x42c94e49>) :command nil :command-fn lsp-javascript-typescript--ls-command :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content not available") :extra-init-params nil :initialize-fn lsp-javascript-typescript--initialize-client :enable-function lsp-javascript-typescript-enable :prefix-function nil)
  #f(compiled-function () (interactive nil) #<bytecode 0x42c94f21>)()
  apply(#f(compiled-function () (interactive nil) #<bytecode 0x42c94f21>) nil)
  #f(advice-wrapper :before #f(compiled-function () (interactive nil) #<bytecode 0x42c94f21>) nodenv-mode)()
  apply(#f(advice-wrapper :before #f(compiled-function () (interactive nil) #<bytecode 0x42c94f21>) nodenv-mode) nil)
  lsp-javascript-typescript-enable()
  my/lsp-javascript-typescript-enable()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook js-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook js-mode-hook))
  run-mode-hooks(js-mode-hook)
  javascript-mode()
  set-auto-mode-0(javascript-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer app.js> "~/repos/go/gui/gotron/ui/react/src/app.js" nil nil "/Volumes/HDD/Users/myth/repos/go/gui/gotron/ui/react/src/app.js" (85068241 16777218))
  find-file-noselect("/Users/myth/repos/go/gui/gotron/ui/react/src/app.js" nil nil nil)
  find-file("/Users/myth/repos/go/gui/gotron/ui/react/src/app.js")
  mapc(find-file ("/Users/myth/repos/go/gui/gotron/ui/react/src/app.js"))
  helm-find-many-files("/Users/myth/repos/go/gui/gotron/ui/react/src/app.js")
  helm-execute-selection-action-1()
  helm-execute-selection-action()
  helm-internal((helm-source-buffers-list helm-source-recentf helm-source-buffer-not-found) nil nil nil nil "*helm mini*" nil nil nil)
  apply(helm-internal ((helm-source-buffers-list helm-source-recentf helm-source-buffer-not-found) nil nil nil nil "*helm mini*" nil nil nil))
  helm((helm-source-buffers-list helm-source-recentf helm-source-buffer-not-found) nil nil nil nil "*helm mini*" nil nil nil)
  apply(helm ((helm-source-buffers-list helm-source-recentf helm-source-buffer-not-found) nil nil nil nil "*helm mini*" nil nil nil))
  helm(:sources (helm-source-buffers-list helm-source-recentf helm-source-buffer-not-found) :buffer "*helm mini*" :ff-transformer-show-only-basename nil :truncate-lines t)
  helm-mini()
  funcall-interactively(helm-mini)
  call-interactively(helm-mini nil nil)
  command-execute(helm-mini)

有时候电脑卡壳,运行得比较慢,在 *Messages* 错误信息还没打印出来的时候,可以看到 ls 进程是有创建的:

⋊> pgrep -fl typescript
20433 node ~/.nodenv/versions/6.0.0/bin/javascript-typescript-stdio -t -l ~/lsp-javascript.log

我加了启动参数 -l /path/to/lsp-javascript.log,但似乎日志文件还没来得及创建。

除此之外,我配置里其他 ls 都正常:go、python、php、java、c-c++,甚至 vue-language-server 都可以用了。

我当时的问题是lsp-ui渲染文本的问题,是有些function doc有一些类似markdown的文本,然后就会崩。我现在一直在用javascript-typescript-langserver,单独用这个就行了。感觉挺稳定的,就是还有一些查询问题。