emacs-grammarly / eglot-grammarly

Eglot Clients for Grammarly
GNU General Public License v3.0
29 stars 6 forks source link

"Unhandled method textDocument/d\ ocumentSymbol" #9

Open swarnendubiswas opened 1 year ago

swarnendubiswas commented 1 year ago

I get the following error with imenu when using say markdown or org files.

progn: jsonrpc-error: "request id=2 failed:", (jsonrpc-error-code . -32601), (jsonrpc-error-message . "Unhandled method textDocument/d\
ocumentSymbol"), (jsonrpc-error-data)

Here is an MWE to help reproduce the error. I have Emacs 28.2 and server version 0.2.1

(setq straight-build-dir (format "build/%d%s%d"
                                 emacs-major-version
                                 version-separator
                                 emacs-minor-version)
      straight-use-package-by-default t)

(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq use-package-hook-name-suffix nil)
(straight-use-package 'use-package)

(use-package eglot
  :config
  (setq eglot-ignored-server-capabilities
    '
    (:codeLensProvider
      :executeCommandProvider
      :hoverProvider ; Automatic documentation popups can be distracting
      :foldingRangeProvider
      :documentOnTypeFormattingProvider
      :documentLinkProvider
      :documentHighlightProvider
      ;; Inlay hints are distracting
      :inlayHintProvider)))

(use-package eglot-grammarly
  :straight (:host github :repo "emacs-grammarly/eglot-grammarly")
  :hook
  (text-mode-hook . (lambda ()
      (require 'eglot-grammarly)
      (eglot-ensure))))
jcs090218 commented 1 year ago

I don' think the language server supports textDocument/documentSymbol. 🤔

swarnendubiswas commented 1 year ago

Right. Can we not default to regular imenu in such cases? That would still work with Org and Markdown files.

jcs090218 commented 1 year ago

Right. Can we not default to regular imenu in such cases? That would still work with Org and Markdown files.

I think this should report to eglot, and not here. 🤔

swarnendubiswas commented 1 year ago

Okay, but the eglot package so far does not need to deal with such servers. That is why I reported this here. I do not get this error with eglot-ltex.

jcs090218 commented 1 year ago

Okay, but the eglot package so far does not need to deal with such servers. That is why I reported this here.

We're in a dilemma. One is upstream language server doesn't want to deal with it (I don't think it's their responsibility). The other one is the client implementation doesn't want to deal with it (eglot). Then there is no solution from my end (eglot-ltex). 🤔 In addition, the author of eglot has a strong opinion of his own taste. If he doesn't want to support this package or grammarly-language-server (this includes all language servers that do the same thing), we are out of luck.

Another solution is lsp-grammarly; and I never had this issue with lsp-mode.

I do not get this error with eglot-ltex.

Yes, cuz the upstream doesn't use that protocol.