Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid params for initialize ":codeAction/resolve" #1255

Closed
archer-n opened this issue Jul 12, 2023 · 1 comment
Closed

Invalid params for initialize ":codeAction/resolve" #1255

archer-n opened this issue Jul 12, 2023 · 1 comment

Comments

@archer-n
Copy link

archer-n commented Jul 12, 2023

I tried the solution and it worked, write at the end

  • Server used: dart language-server
  • Emacs version: GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-07-12 (commit: 04710bd01b2)
  • Operating system: Arch Linux
  • Eglot version: 3b7273f4ae3 Eglot: add support for :codeAction/resolve
  • Eglot installation method: build-in
  • Using Doom: No

LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)

(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 71964 :clientInfo (:name "Eglot") :rootPath
                      "/home/archer/workspace/android/foo/"
                      :rootUri
                      "file:///home/archer/workspace/android/foo"
                      :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
                                              :resolveSupport t
                                              :dataSupport t
                                              :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
                       (:showDocument (:support t) :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/archer/workspace/android/foo"
                        :name "~/workspace/android/foo/")]))

(:id 1 :jsonrpc "2.0" :error
     (:code -32602 :message
            "Invalid params for initialize:\nparams.capabilities.textDocument.codeAction.resolveSupport must be of type CodeActionClientCapabilitiesResolveSupport"))

Backtrace (mandatory, unless no error message seen or heard):

Not possible to provide

Minimum Reproducible Example (mandatory)

  1. I start Emacs GUI
  2. I downloaded the latest dart sdk(Dart SDK version: 2.19.6 (stable) (Tue Mar 28 13:41:04 2023 +0000) on "linux_x64") executable
  3. I can reproduce on any Dart file or repository

Tried the solution, it's worked

  1. After reading the lsp document, I found that the data format is incorrect

  2. After modifying the source code, rebuild emacs, Below is my modification:

              :codeAction         (list
                                   :dynamicRegistration :json-false
-                                  :resolveSupport t :dataSupport t
+                                  :resolveSupport `(:properties ["edit"])
+                                  :dataSupport t
                                   :codeActionLiteralSupport
@joaotavora
Copy link
Owner

dickmao pushed a commit to commercial-emacs/commercial-emacs that referenced this issue Jul 12, 2023
See joaotavora/eglot#1255.

* lisp/progmodes/eglot.el (eglot-client-capabilities):
Use correct format for textDocument.codeAction.resolveSupport.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants