[求助] eglot-ltex 提示timed out

我用的doom-emacs,eglot-ltex对markup文档的语法检测体验还不错,我在mac端已经用上,不过在ubuntu出现timeout的错误,也没有明显的错误提示,不知道哪里没有配置对。我基本就是抄的eglot-ltex的实例配置。

(use-package eglot-ltex
  :ensure t
  :hook (latex-mode . (lambda ()
                        (require 'eglot-ltex)
                        (eglot-ensure)))
  :init
  (when IS-MAC
    (setq eglot-languagetool-server-path (concat doom-user-dir "config/ltex-ls/mac/")))
  (when IS-LINUX
    (setq eglot-languagetool-server-path (concat doom-user-dir "config/ltex-ls/linux/"))))

不过在latex文档使用的时候提示timeout错误:

[jsonrpc] Server exited with status 9
Error running timer: (error "[eglot] Timed out after 10 seconds")

EGLOT--- events中的内容如下,好像没有明显错误,有一些wanring。


[internal] Thu Apr 20 10:39:25 2023:
(:message "Running language server: /home/username/.doom.d/config/ltex-ls/linux/bin/ltex-ls")
[client-request] (id:1) Thu Apr 20 10:39:25 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 41314 :clientInfo
           (:name "Eglot")
           :rootPath "/home/username/projects/latex/test/" :rootUri "file:///home/username/projects/latex/test" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                                                                                                           ())
           :capabilities
           (:workspace
            (:applyEdit t :executeCommand
             (:dynamicRegistration :json-false)
             :workspaceEdit
             (:documentChanges t)
             :didChangeWatchedFiles
             (:dynamicRegistration t)
             :symbol
             (:dynamicRegistration :json-false)
             :configuration t :workspaceFolders t)
            :textDocument
            (:synchronization
             (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
             :completion
             (:dynamicRegistration :json-false :completionItem
                                   (:snippetSupport t :deprecatedSupport t :resolveSupport
                                    (:properties
                                     ["documentation" "details" "additionalTextEdits"])
                                    :tagSupport
                                    (:valueSet
                                     [1]))
                                   :contextSupport t)
             :hover
             (:dynamicRegistration :json-false :contentFormat
                                   ["markdown" "plaintext"])
             :signatureHelp
             (:dynamicRegistration :json-false :signatureInformation
                                   (:parameterInformation
                                    (:labelOffsetSupport t)
                                    :documentationFormat
                                    ["markdown" "plaintext"]
                                    :activeParameterSupport t))
             :references
             (:dynamicRegistration :json-false)
             :definition
             (:dynamicRegistration :json-false :linkSupport t)
             :declaration
             (:dynamicRegistration :json-false :linkSupport t)
             :implementation
             (:dynamicRegistration :json-false :linkSupport t)
             :typeDefinition
             (:dynamicRegistration :json-false :linkSupport t)
             :documentSymbol
             (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :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 26]))
             :documentHighlight
             (:dynamicRegistration :json-false)
             :codeAction
             (:dynamicRegistration :json-false :codeActionLiteralSupport
              (:codeActionKind
               (:valueSet
                ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
              :isPreferredSupport t)
             :formatting
             (:dynamicRegistration :json-false)
             :rangeFormatting
             (:dynamicRegistration :json-false)
             :rename
             (:dynamicRegistration :json-false)
             :inlayHint
             (:dynamicRegistration :json-false)
             :publishDiagnostics
             (:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
                                  (:valueSet
                                   [1 2])))
            :window
            (:workDoneProgress t)
            :general
            (:positionEncodings
             ["utf-32" "utf-8" "utf-16"])
            :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                        ()))
           :workspaceFolders
           [(:uri "file:///home/username/projects/latex/test" :name "~/projects/latex/test/")]))
[stderr] Apr 20, 2023 10:39:26 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for fa
[stderr] Apr 20, 2023 10:39:26 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for zh
[stderr] Apr 20, 2023 10:39:27 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for ja
[stderr] Apr 20, 2023 10:39:27 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for ta
[stderr] Apr 20, 2023 10:39:27 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for fa
[stderr] Apr 20, 2023 10:39:27 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for zh
[stderr] Apr 20, 2023 10:39:27 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for ja
[stderr] Apr 20, 2023 10:39:27 AM org.languagetool.language.identifier.SimpleLanguageIdentifier <init>
[stderr] WARNING: Could not find default speller rule for ta
[stderr] Apr 20, 2023 10:39:27 AM org.bsplines.ltexls.server.LtexLanguageServer initialize
[stderr] INFO: ltex-ls 16.0.0 - initializing...
[internal] Thu Apr 20 10:39:35 2023:
(:message "Connection state changed" :change "killed\n")

----------b---y---e---b---y---e----------
[stderr]
[stderr]
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (test/(text-mode latex-mode org-mode markdown-mode)) stderr finished

这个 bug 已经在 github 有人反馈了,但是目前没有反馈。建议使用 ltex-15.2,一切正常。

不只是 emacs,helix 也有人反馈有闪退的问题。

谢谢,果然是版本的问题,我mac端配置的早了,用的就是15.2版本。

最近开始用 eglot-ltex,最新的 16.0.1-alpha.1.nightly.2024-10-09 也是还用不了

其实 16.0 版本也不是不能用,我尝试同时执行三次 eglot,有很大概率能让其中一个进程成功,其他两个进程 timeout 后退出

另外发现 ltex-ls 的 add to dictionary action 也用不了 (:success :json-false :errorMessage "Unknown command '_ltex.addToDictionary', ignoring"))

而且似乎也没法通过 eglot-workspace-configuration 或 :initializationOptions 定制 lsp 行为