MatthewZMD / .emacs.d

M-EMACS, a full-featured GNU Emacs configuration distribution
GNU General Public License v3.0
674 stars 77 forks source link

Issue with lsp #55

Closed brrgrl closed 11 months ago

brrgrl commented 11 months ago

Describe the bug When I try to run lsp on a file, I get the following message "lsp-execute-command is already defined as something else than a generic function"

and lsp doesn't start.

To Reproduce Steps to reproduce the behavior:

  1. Open emacs
  2. Visit a python file
  3. lsp-mode doesn't active so try M-x lsp
  4. See error

Expected behavior Should automagically start lsp-mode in buffer

Screenshots

Screenshot 2023-11-30 at 4 09 33 PM

Versions (please complete the following information):

Additional context I am able to get the expected behavior when I delete lsp and lsp-ui (along with its dependencies) and then reinstall via melpa. However, on startup, I return to the same error above.

debug

Debugger entered--Lisp error: (error "lsp-execute-command is already defined as somethin...")
  error("%s is already defined as something else than a gen..." lsp-execute-command)
  cl-generic-ensure-function(lsp-execute-command)
  cl-generic-define-method(lsp-execute-command nil ((_server (eql ccls)) (command (eql ccls.xref)) arguments) nil #f(compiled-function (server command arguments) #<bytecode 0x75bd15be488389a>))
  byte-code("\301\302\303\304\303\305%\210\306\307\310\311#\210\312\313\314\315\316!\317\320\321\322\323\324$\325\326\327\303\330\331\332\333\"\334\335\336\3#\210\334\337\340\3#\210\211\262..." [ccls-library-folders-fn cl-generic-define-method lsp-execute-command nil ((_server (eql ccls)) (command (eql ccls.xref)) arguments) #f(compiled-function (server command arguments) #<bytecode 0x75bd15be488389a>) advice-add lsp--suggest-project-root :before-until ccls--suggest-project-root lsp-register-client make-lsp-client :new-connection lsp-stdio-connection #f(compiled-function () #<bytecode 0x23cc92d22f17de>) :activation-fn lsp-activate-on "c" "cpp" "objective-c" "cuda" :server-id ccls :multi-root :notification-handlers make-hash-table :test equal puthash "$ccls/publishSkippedRanges" ccls--publish-skipped-ranges "$ccls/publishSemanticHighlight" ccls--publish-semantic-highlight :initialization-options #f(compiled-function () #<bytecode 0x1f9e757d98675>) :library-folders-fn provide] 16)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_346>(ccls)
  mapc(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_346> (ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-awk lsp-astro lsp-bash lsp-beancount lsp-bufls lsp-clangd lsp-clojure lsp-cmake lsp-credo lsp-crystal lsp-csharp lsp-css lsp-cypher lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir lsp-emmet lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go lsp-golangci-lint lsp-gleam lsp-glsl lsp-graphql lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json lsp-kotlin lsp-latex lsp-ltex lsp-lua lsp-markdown ...))
  seq-do(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_346> (ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-awk lsp-astro lsp-bash lsp-beancount lsp-bufls lsp-clangd lsp-clojure lsp-cmake lsp-credo lsp-crystal lsp-csharp lsp-css lsp-cypher lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir lsp-emmet lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go lsp-golangci-lint lsp-gleam lsp-glsl lsp-graphql lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json lsp-kotlin lsp-latex lsp-ltex lsp-lua lsp-markdown ...))
  lsp--require-packages()
  lsp(nil)
  funcall-interactively(lsp nil)
  command-execute(lsp record)
  counsel-M-x-action("lsp")
  ivy-call()
  ivy-read("M-x " ("toggle-debug-on-error" "load-file" "lsp" "emacs-version" "lsp-restart-workspace" "lsp-ui-mode" "lsp-doctor" "package-delete" "lsp-mode" "shell" "setenv" "package-install" "lsp-install-server" "find-function" "lsp-execute-code-action" "exec-path-from-shell-initialize" "calendar" "pyvenv-mode" "comment-region" "terraform-mode" "pyvenv-activate" "uncomment-region" "nerd-icons-install-fonts" "all-the-icons-install-fonts" "company-tabnine-install-binary" "R" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  command-execute(counsel-M-x)
brrgrl commented 11 months ago

Nevermind, I saw that it's due to not following the prerequisite for ccls

MatthewZMD commented 10 months ago

Feel free to try the experimental branch that uses lsp-bridge and tree-sitter :)