{"action":"created","issue":{"url":"https://api.github.com/repos/joaotavora/eglot/issues/164","repository_url":"https://api.github.com/repos/joaotavora/eglot","labels_url":"https://api.github.com/repos/joaotavora/eglot/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/joaotavora/eglot/issues/164/comments","events_url":"https://api.github.com/repos/joaotavora/eglot/issues/164/events","html_url":"https://github.com/joaotavora/eglot/issues/164","id":383561738,"node_id":"MDU6SXNzdWUzODM1NjE3Mzg=","number":164,"title":"Command in CodeAction can be a string or a Command object","user":{"login":"mkcms","id":10572727,"node_id":"MDQ6VXNlcjEwNTcyNzI3","avatar_url":"https://avatars2.githubusercontent.com/u/10572727?v=4","gravatar_id":"","url":"https://api.github.com/users/mkcms","html_url":"https://github.com/mkcms","followers_url":"https://api.github.com/users/mkcms/followers","following_url":"https://api.github.com/users/mkcms/following{/other_user}","gists_url":"https://api.github.com/users/mkcms/gists{/gist_id}","starred_url":"https://api.github.com/users/mkcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkcms/subscriptions","organizations_url":"https://api.github.com/users/mkcms/orgs","repos_url":"https://api.github.com/users/mkcms/repos","events_url":"https://api.github.com/users/mkcms/events{/privacy}","received_events_url":"https://api.github.com/users/mkcms/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-11-22T14:36:25Z","updated_at":"2018-12-03T23:01:12Z","closed_at":"2018-12-03T23:00:29Z","author_association":"COLLABORATOR","body":"According to the spec, return value of `textDocument/codeAction` request can be `(Command | CodeAction)[] | null`. These two objects share a `:command` field. In `Command`, it is a string, in `CodeAction` it's a `Command`. Right now we're assuming it's always a string.\r\nThis leads to the following error when using the eclipse.jdt.ls server:\r\n\r\n```\r\nDebugger entered--Lisp error: (wrong-type-argument stringp (:title \"Add throws declaration\" :command \"java.apply.workspaceEdit\" :arguments [(:changes (:file:///tmp/guava/guava-tests/test/com/google/common/net/HostAndPortTest\\.java [(:range (:start ... :end ...) :newText \" throws \") (:range (:start ... :end ...) :newText \"IOException\")]))]))\r\n  intern((:title \"Add throws declaration\" :command \"java.apply.workspaceEdit\" :arguments [(:changes (:file:///tmp/guava/guava-tests/test/com/google/common/net/HostAndPortTest\\.java [(:range (:start ... :end ...) :newText \" throws \") (:range (:start ... :end ...) :newText \"IOException\")]))]))\r\n  (eglot-execute-command server (intern command) arguments)\r\n  (progn (eglot-execute-command server (intern command) arguments))\r\n  (if command (progn (eglot-execute-command server (intern command) arguments)))\r\n  (when command (eglot-execute-command server (intern command) arguments))\r\n  (progn (when edit (eglot--apply-workspace-edit edit)) (when command (eglot-execute-command server (intern command) arguments)))\r\n  (let* ((#:--cl-rest-- action) (command (car (cdr (plist-member #:--cl-rest-- ':command)))) (arguments (car (cdr (plist-member #:--cl-rest-- ':arguments)))) (edit (car (cdr (plist-member #:--cl-rest-- ':edit))))) (progn (when edit (eglot--apply-workspace-edit edit)) (when command (eglot-execute-command server (intern command) arguments))))\r\n  (cl-destructuring-bind (&key command arguments edit &allow-other-keys) action (when edit (eglot--apply-workspace-edit edit)) (when command (eglot-execute-command server (intern command) arguments)))\r\n  (eglot--destructuring-bind (&key command arguments edit) action (when edit (eglot--apply-workspace-edit edit)) (when command (eglot-execute-command server (intern command) arguments)))\r\n  (let* ((server (eglot--current-server-or-lose)) (actions (jsonrpc-request server :textDocument/codeAction (list :textDocument (eglot--TextDocumentIdentifier) :range (list :start (eglot--pos-to-lsp-position beg) :end (eglot--pos-to-lsp-position end)) :context `(:diagnostics [...])))) (menu-items (or (mapcar (jsonrpc-lambda (&key title command arguments edit _kind _diagnostics) `(... :command ... :arguments ... :edit ...)) actions) (eglot--error \"No code actions here\"))) (menu `(\"Eglot code actions:\" (\"dummy\" ,@menu-items))) (action (if (listp last-nonmenu-event) (x-popup-menu last-nonmenu-event menu) (let ((never-mind (gensym)) retval) (setcdr (cadr menu) (cons `... (cdadr menu))) (if (eq (setq retval ...) never-mind) (keyboard-quit) retval))))) (eglot--destructuring-bind (&key command arguments edit) action (when edit (eglot--apply-workspace-edit edit)) (when command (eglot-execute-command server (intern command) arguments))))\r\n  eglot-code-actions(4177 4201)\r\n  funcall-interactively(eglot-code-actions 4177 4201)\r\n  call-interactively(eglot-code-actions)\r\n  #f(compiled-function (event) (interactive \"e\") #<bytecode 0x18bae45>)((mouse-1 (#<window 141 on *Backtrace*> 4188 (153 . 568) 20446247 nil 4188 (17 . 31) nil (0 . 10) (9 . 18))))\r\n  funcall-interactively(#f(compiled-function (event) (interactive \"e\") #<bytecode 0x18bae45>) (mouse-1 (#<window 141 on *Backtrace*> 4188 (153 . 568) 20446247 nil 4188 (17 . 31) nil (0 . 10) (9 . 18))))\r\n  call-interactively(#f(compiled-function (event) (interactive \"e\") #<bytecode 0x18bae45>) nil nil)\r\n  command-execute(#f(compiled-function (event) (interactive \"e\") #<bytecode 0x18bae45>))\r\n```"},"comment":{"url":"https://api.github.com/repos/joaotavora/eglot/issues/comments/443903713","html_url":"https://github.com/joaotavora/eglot/issues/164#issuecomment-443903713","issue_url":"https://api.github.com/repos/joaotavora/eglot/issues/164","id":443903713,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzkwMzcxMw==","user":{"login":"joaotavora","id":387011,"node_id":"MDQ6VXNlcjM4NzAxMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/387011?v=4","gravatar_id":"","url":"https://api.github.com/users/joaotavora","html_url":"https://github.com/joaotavora","followers_url":"https://api.github.com/users/joaotavora/followers","following_url":"https://api.github.com/users/joaotavora/following{/other_user}","gists_url":"https://api.github.com/users/joaotavora/gists{/gist_id}","starred_url":"https://api.github.com/users/joaotavora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaotavora/subscriptions","organizations_url":"https://api.github.com/users/joaotavora/orgs","repos_url":"https://api.github.com/users/joaotavora/repos","events_url":"https://api.github.com/users/joaotavora/events{/privacy}","received_events_url":"https://api.github.com/users/joaotavora/received_events","type":"User","site_admin":false},"created_at":"2018-12-03T23:01:12Z","updated_at":"2018-12-03T23:01:12Z","author_association":"OWNER","body":"Damn, I pushed the wrong commit."}}
{"actor":{"display_login":"joaotavora"}}