lsp-mode icon indicating copy to clipboard operation
lsp-mode copied to clipboard

Error running timer: (void-variable lsp-inline-completion-enable)

Open danielpza opened this issue 1 year ago • 4 comments

Thank you for the bug report

  • [X] I am using the latest version of lsp-mode related packages.
  • [X] I checked FAQ and Troubleshooting sections
  • [ ] You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

After updating to the latest lsp version, lsp-mode stopped working with the following error Error running timer: (void-variable lsp-inline-completion-enable), incidentally this PR was merged recently which I assume caused the issue https://github.com/emacs-lsp/lsp-mode/pull/4633.

Errors don't appear on flycheck either

Steps to reproduce

Open typescript file with mode associated to lsp mode See error in message buffer

Expected behavior

lsp features (completion, linting warning/errors) should work

Which Language Server did you use?

typescript-language-server

OS

Linux (NixOS)

Error callstack

Debugger entered--Lisp error: (void-variable lsp-inline-completion-enable)
  (and lsp-inline-completion-enable (lsp-feature? "textDocument/inlineCompletion"))
  (if (and lsp-inline-completion-enable (lsp-feature? "textDocument/inlineCompletion")) (progn (lsp-inline-completion-mode)))
  (closure (t) nil (if (and lsp-inline-completion-enable (lsp-feature? "textDocument/inlineCompletion")) (progn (lsp-inline-completion-mode))))()
  run-hooks(lsp-configure-hook)
  apply(run-hooks lsp-configure-hook)
  lsp-configure-buffer()
  lsp-managed-mode(1)
  lsp--text-document-did-open()
  lsp--open-in-workspace(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 24/24 0xbad4d35> :registered-server-capabilities nil :root "project" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x3bdc162e0067bf>) :test? #f(compiled-function () #<bytecode 0x180aed28b9722d49>)) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content n...") :notification-handlers #<hash-table equal 0/65 0xa15c6e3> :request-handlers #<hash-table equal 1/65 0xa9909c5> :response-handlers #<hash-table eql 1/65 0xa15c703> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0xa15c723> :action-handlers #<hash-table equal 0/65 0xa22a8bb> :action-filter nil :major-modes nil :activation-fn lsp-typescript-javascript-tsx-jsx-activate-p :priority -2 :server-id ts-ls :multi-root nil :initialization-options #f(compiled-function () #<bytecode -0xac1d30f3c00768e>) :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode -0x12ac8defd62299f6>) :remote? nil :completion-in-comments? t :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 0/65 0xa22a8db> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode 0x8ae18071471054>) :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc #<process ts-ls> :cmd-proc #<process ts-ls> :buffers (#<buffer index.test.ts>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0xb121fc7> :watches #<hash-table equal 0/65 0xb12206b> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 1/65 0xaaeaf2d> :work-done-tokens #<hash-table equal 0/65 0xaaeb379>))
  lsp--find-workspace(#s(lsp-session :folders () :folders-blocklist nil :server-id->folders #<hash-table equal 3/65 0xa7b3179> :folder->servers #<hash-table equal 17/65 0xa7b33a7> :metadata #<hash-table equal 1/65 0xa7b33c7>) #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x3bdc162e0067bf>) :test? #f(compiled-function () #<bytecode 0x180aed28b9722d49>)) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content n...") :notification-handlers #<hash-table equal 0/65 0xa15c6e3> :request-handlers #<hash-table equal 1/65 0xa9909c5> :response-handlers #<hash-table eql 1/65 0xa15c703> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0xa15c723> :action-handlers #<hash-table equal 0/65 0xa22a8bb> :action-filter nil :major-modes nil :activation-fn lsp-typescript-javascript-tsx-jsx-activate-p :priority -2 :server-id ts-ls :multi-root nil :initialization-options #f(compiled-function () #<bytecode -0xac1d30f3c00768e>) :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode -0x12ac8defd62299f6>) :remote? nil :completion-in-comments? t :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 0/65 0xa22a8db> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode 0x8ae18071471054>) :download-in-progress? nil :buffers nil :synchronize-sections nil) "project")
  #f(compiled-function (client) #<bytecode -0x1e0df25abf2aabc0>)(#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x3bdc162e0067bf>) :test? #f(compiled-function () #<bytecode 0x180aed28b9722d49>)) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content n...") :notification-handlers #<hash-table equal 0/65 0xa15c6e3> :request-handlers #<hash-table equal 1/65 0xa9909c5> :response-handlers #<hash-table eql 1/65 0xa15c703> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0xa15c723> :action-handlers #<hash-table equal 0/65 0xa22a8bb> :action-filter nil :major-modes nil :activation-fn lsp-typescript-javascript-tsx-jsx-activate-p :priority -2 :server-id ts-ls :multi-root nil :initialization-options #f(compiled-function () #<bytecode -0xac1d30f3c00768e>) :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode -0x12ac8defd62299f6>) :remote? nil :completion-in-comments? t :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 0/65 0xa22a8db> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode 0x8ae18071471054>) :download-in-progress? nil :buffers nil :synchronize-sections nil))
  -map(#f(compiled-function (client) #<bytecode -0x1e0df25abf2aabc0>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x3bdc162e0067bf>) :test? #f(compiled-function () #<bytecode 0x180aed28b9722d49>)) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content n...") :notification-handlers #<hash-table equal 0/65 0xa15c6e3> :request-handlers #<hash-table equal 1/65 0xa9909c5> :response-handlers #<hash-table eql 1/65 0xa15c703> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0xa15c723> :action-handlers #<hash-table equal 0/65 0xa22a8bb> :action-filter nil :major-modes nil :activation-fn lsp-typescript-javascript-tsx-jsx-activate-p :priority -2 :server-id ts-ls :multi-root nil :initialization-options #f(compiled-function () #<bytecode -0xac1d30f3c00768e>) :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode -0x12ac8defd62299f6>) :remote? nil :completion-in-comments? t :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 0/65 0xa22a8db> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode 0x8ae18071471054>) :download-in-progress? nil :buffers nil :synchronize-sections nil) #s(lsp--client :language-id nil :add-on? t :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x196323903e00679e>) :test? #f(compiled-function () #<bytecode 0x198863261dda>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0xa6966ef> :request-handlers #<hash-table equal 3/65 0xa696793> :response-handlers #<hash-table eql 0/65 0xa6b45ef> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0xa792ecf> :action-handlers #<hash-table equal 0/65 0xa7c2725> :action-filter nil :major-modes nil :activation-fn #f(compiled-function (filename &optional _) #<bytecode -0xc8e7791822cd3ed>) :priority -1 :server-id eslint :multi-root t :initialization-options nil :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode -0x1fb0cb352cf59348>) :remote? nil :completion-in-comments? t :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 1/65 0xa697f79> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode 0x43b2955066713de>) :download-in-progress? nil :buffers nil :synchronize-sections nil)))
  lsp--ensure-lsp-servers(#s(lsp-session :folders () :folders-blocklist nil :server-id->folders #<hash-table equal 3/65 0xa7b3179> :folder->servers #<hash-table equal 17/65 0xa7b33a7> :metadata #<hash-table equal 1/65 0xa7b33c7>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x3bdc162e0067bf>) :test? #f(compiled-function () #<bytecode 0x180aed28b9722d49>)) :ignore-regexps nil :ignore-messages ("readFile .*? requested by TypeScript but content n...") :notification-handlers #<hash-table equal 0/65 0xa15c6e3> :request-handlers #<hash-table equal 1/65 0xa9909c5> :response-handlers #<hash-table eql 1/65 0xa15c703> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0xa15c723> :action-handlers #<hash-table equal 0/65 0xa22a8bb> :action-filter nil :major-modes nil :activation-fn lsp-typescript-javascript-tsx-jsx-activate-p :priority -2 :server-id ts-ls :multi-root nil :initialization-options #f(compiled-function () #<bytecode -0xac1d30f3c00768e>) :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode -0x12ac8defd62299f6>) :remote? nil :completion-in-comments? t :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 0/65 0xa22a8db> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode 0x8ae18071471054>) :download-in-progress? nil :buffers nil :synchronize-sections nil) #s(lsp--client :language-id nil :add-on? t :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x196323903e00679e>) :test? #f(compiled-function () #<bytecode 0x198863261dda>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0xa6966ef> :request-handlers #<hash-table equal 3/65 0xa696793> :response-handlers #<hash-table eql 0/65 0xa6b45ef> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0xa792ecf> :action-handlers #<hash-table equal 0/65 0xa7c2725> :action-filter nil :major-modes nil :activation-fn #f(compiled-function (filename &optional _) #<bytecode -0xc8e7791822cd3ed>) :priority -1 :server-id eslint :multi-root t :initialization-options nil :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode -0x1fb0cb352cf59348>) :remote? nil :completion-in-comments? t :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 1/65 0xa697f79> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode 0x43b2955066713de>) :download-in-progress? nil :buffers nil :synchronize-sections nil)) "project" nil)
  lsp--try-project-root-workspaces(nil nil)
  #<subr lsp>()
  lsp@magit-find-file(#<subr lsp>)
  apply(lsp@magit-find-file #<subr lsp> nil)
  lsp()
  lsp--init-if-visible()
  #f(compiled-function () #<bytecode 0x5b72b1586029f43>)()
  apply(#f(compiled-function () #<bytecode 0x5b72b1586029f43>) nil)
  timer-event-handler([t 0 0 0 nil #f(compiled-function () #<bytecode 0x5b72b1586029f43>) nil idle 0 nil])

Anything else?

(lsp-version)
> LSP :: lsp-mode 20241201.2156, Emacs 29.4, gnu/linux

Couldn't reproduce the issue with lsp-start-plain

danielpza avatar Dec 07 '24 17:12 danielpza

It's working on my side. lsp-inline-completion-enable is already autoloaded. 🤔

jcs090218 avatar Dec 07 '24 17:12 jcs090218

fwiw this is my lsp configuration

(use-package lsp-mode
  :after (yasnippet) ;; https://github.com/emacs-lsp/lsp-mode/discussions/4033
  :commands (lsp lsp-deferred)
  :functions lsp-inlay-hints-mode
  :defines lsp-command-map
  :custom
  (lsp-completion-provider :none)
  (lsp-inlay-hint-enable nil)
  (lsp-javascript-display-enum-member-value-hints t)
  (lsp-javascript-display-parameter-name-hints-when-argument-matches-name t)
  (lsp-javascript-display-parameter-type-hints t)
  (lsp-javascript-display-property-declaration-type-hints t)
  (lsp-javascript-display-return-type-hints nil)
  (lsp-javascript-display-variable-type-hints t)
  (lsp-auto-execute-action nil)
  (lsp-eslint-server-command '("vscode-eslint-language-server" "--stdio"))
  (lsp-eslint-auto-fix-on-save t)
  (lsp-auto-guess-root nil)
  (lsp-enable-suggest-server-download nil) ;; will be managed by home-manager
  (lsp-references-exclude-definition t)
  :bind
  ;; ("M-i" . lsp-inlay-hints-mode)
  ("M-r" . lsp-rename)
  ("M-s" . lsp)
  ("M-W" . lsp-workspace-restart)
  ("M-a" . lsp-execute-code-action)
  ("M-R" . lsp-javascript-rename-file)
  :hook ((
		  mhtml-mode
		  ;; js modes
		  js-ts-mode tsx-ts-mode typescript-ts-mode
		  ;; config files modes
		  json-ts-mode yaml-ts-mode
		  ;; css modes
		  scss-mode css-ts-mode
		  ;; godot
		  gdscript-ts-mode
		  ;; others
		  bash-ts-mode
		  gfm-mode markdown-mode
		  dockerfile-ts-mode terraform-mode
		  lua-mode python-ts-mode nix-mode) . lsp-deferred)
  :config
  (lsp-inlay-hints-mode)
  (keymap-set leader-map "l" lsp-command-map))

danielpza avatar Dec 07 '24 17:12 danielpza

I'm also getting "Error running timer", although it's complaining about package-desc being nil. I would have thought it was a different issue, except that I see the same apply(lsp@magit-find-file #<subr lsp> nil) in my trace.

eamonnsullivan avatar Dec 23 '24 14:12 eamonnsullivan

I'm now running into the same problem after starting Emacs and then invoking desktop-read. When that fails as described above, if I invoke load-library on lsp-completion, I can confirm that the lsp-inline-completion-enable is defined. After that, invoking desktop-read again succeeds.

I think that today is the first time that I've restarted Emacs since the Nix packages picked up version 9 of lsp-mode.

seh avatar Jan 09 '25 23:01 seh