syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

LSP documentation minibuffer: recurrent error message term-cursor--immediate #15667

Closed pradyparanjpe closed 1 month ago

pradyparanjpe commented 2 years ago

Description :octocat:

Python mode
  Following error is thrown continuously, this causes emacs to hang.
  ```
  Error processing message (wrong-number-of-arguments #<subr term-cursor--immediate> 2). [14 times]
  ```

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

System Info :computer:

Backtrace :paw_prints:

lebensterben commented 2 years ago

Cannot reproduce.

pradyparanjpe commented 2 years ago

Addition:

(Correction)

The error is thrown upon hovering on a variable. (May be while its docstring is being sought.) The documentation sub-window doesn't appear.

This has started happening since I upgraded to emacs v 28.1.

pradyparanjpe commented 2 years ago

General issue

This appears to be a general issue with display of docstrings; since the same error message appears with R (ess-r-mode) and bash scripts (shell-script-mode) while hovering over documented symbols.

lsp configuration:

     (lsp :variables
          lsp-lens-enable t
          lsp-use-lsp-ui t
          lsp-ui-doc-show-with-cursor t)
lebensterben commented 2 years ago

Not reproducible.

In the last 24 hours I've used LSP in three languages and lsp-ui-doc works fine.

lebensterben commented 2 years ago

You have not mentioned that you are running emacs in a daemon.

I tried it nevertheless and still the problem cannot be reproduced.

Note that term-cursor mode is loaded on when you there's no graphical system. So I also tried daemon + terminal Emacs. Still not reproducible.

derinsh0 commented 2 years ago

Strange. I got this error just a few hours ago when I noticed lsp getting nonresponsive and a symbol was kept selected after moving the cursor away.

The only change I did was in layers html to (html :variable css-enable-lsp t less-enable-lsp t scss-enable-lsp t html-enable-lsp t web-fmt-tool 'web-beautify) Disabling term-cursor-mode made the issue go away. Those layer variables set global-term-cursor-mode to 1.

pradyparanjpe commented 2 years ago

Narrowed down

As you said,

But,

System info

Apology for not having mentioned that I am running emacs in a daemon. Following is my system info.

System Info :computer:

Not immediately actionable.

I plan not to use the graphical daemon mode. So you may mark this issue and close it as not-planned.

lebensterben commented 2 years ago

I will check html layer.

derinsh0 commented 2 years ago

Maybe I was wrong about the html layer, it doesn't make sense for it to affect any cursors.

Another layer I added recently, but not sure if it was days ago or yesterday, was spacemacs-editing-visual which has this in packages.el:

(term-cursor :location (recipe :fetcher github :repo "h0d/term-cursor.el"))

lebensterben commented 2 years ago

term-cursor is only turned on in terminal. It is installed by default unless you use spacemacs-base.

derinsh0 commented 2 years ago

Alright, I admit I'm not knowledgable enough. All I know is that it's loaded at GUI start Loading term-cursor (native compiled elisp)...done and when I checked customize, it said global-term-cursor-mode was changed outside customize. What I don't know is whether it was always enabled and just the error is recent, but I haven't upgraded any packages in a while.

lebensterben commented 2 years ago

@psisis

https://github.com/syl20bnr/spacemacs/blob/ba33309327e278a5fe7c12e095ed3a314523484f/layers/%2Bspacemacs/spacemacs-editing-visual/packages.el#L160

Impossible. It never loads in GUI Emacs.

derinsh0 commented 2 years ago

Well I don't know. That layer, by rgrep, is the only one that uses package term-cursor. Commenting out that func in packages.el will uninstall term-cursor. Even disabling the layer but keeping the files original, will insist on installing (and for me) loading it.

I just saw that it's a recent commit, made by you. I did git pull a few days ago, so it must be responsible.

On the record: 99933b1fb37a51a41656a6c3d8cdbdbb02449bfc

derinsh0 commented 2 years ago

Checking out the layer pre-commit will uninstall term-cursor, install evil-terminal-cursor-changer and solve this specific issue.

lebensterben commented 2 years ago

@psisis

deleting that line won't uninstall it. It just never gets loaded.

removing spacemaca-editing won't have any effect unless you use spacemacs-base as I explained before.

So there's no bug.

derinsh0 commented 2 years ago

@psisis

deleting that line won't uninstall it. It just never gets loaded.

removing spacemaca-editing won't have any effect unless you use spacemacs-base as I explained before.

So there's no bug.

What are you talking about. I just said that undoing your commits from 17 days ago will solve this issue.

lebensterben commented 2 years ago

@psisis

Commenting out that func in packages.el will uninstall term-cursor. Even disabling the layer but keeping the files original, will insist on installing (and for me) loading it.

These two sentences are both false.

derinsh0 commented 2 years ago

Fact A: your commit caused this. What more is there to say.

derinsh0 commented 2 years ago

@pradyparanjpe

If you want a solution. Cd to .emacs.d and run git checkout 77ba076f697d270b011586944004ce8dfb6f61a4 -- .\layers\+spacemacs\spacemacs-editing-visual\* in shell.

lebensterben commented 2 years ago

@psisis I cannot reproduce this issue.

derinsh0 commented 2 years ago

@lebensterben I know, you've stated that already. That doesn't mean your commit is blameless. If OP didn't have the same issue I wouldn't have known this, but your arrogance really astounds me.

Let's wait for OP, if checking out pre-commit will solve it for him then at the very least I'll always know to check your commits next time I get a bug.

lebensterben commented 2 years ago

Read that commit carefully, you will see the only change is that term-cursor would not be installed if you use evil, but after the commit it's always installed.

Installing the package won't get it loaded automatically. It takes two more steps to have it loaded.

First it must be declared in a layer's xxx-packages list and that layer must be enabled. In this case it's in spacemaca-editing-packages, and spacemaca-editing layer is always enabled unless you use spacemacs-base which requires manual enabling.

Second there must be a package init function, in which the package is loaded via a use-package call. And in this case the :if argument makes sure it won't be loaded in GUI Emacs.

Why do you say I am arrogant? I'm walking over these facts again and again with you without making any judgement on you.

lebensterben commented 2 years ago

Also note that reverting that commit IS NOT A FIX, it's not even a workaround.

term-cursor would still be installed for non-evil users.

derinsh0 commented 2 years ago

So if I understand this correctly. There are two commits, d48bc8d90bb834fee2140499fee3b3f43f170320 and 99933b1fb37a51a41656a6c3d8cdbdbb02449bfc. Before these we had

(term-cursor :location (recipe :fetcher github :repo "h0d/term-cursor.el")
                  :toggle (not (configuration-layer/package-used-p 'evil)))

now we have

(term-cursor :location (recipe :fetcher github :repo "h0d/term-cursor.el"))

There is no toggle anymore to install the package (since I used evil, it wouldn't install before). Meaning it will always be installed now but not necessarily loaded. So the main issue is, why is it loaded.

Since spacemacs-editing-visual/init-term-cursor wasn't changed at all, the problem is not here (it probably would have thrown an error if package was not found). Something else is loading term-cursor. I even added (setq graphicp (display-graphic-p)) to that func to debug, and it was accurately t.

The only files I have that ever mention the phrase "term-cursor" are:

"term-cursor/*" , "spacemacs-editing-visual/packages.el" and dotspacemacs/custom-settings/'(package-selected-packages ...term-cursor)

Nothing else in .emacs.d/ I have wants to remotely enable term-cursor. I even searched for non-.el files.

This is the only information I can give to this issue. I don't know what's responsible, but when editing-visual installs term-cursor, it gets loaded for me. I think you're arrogant because even if you didn't mean for it to be loaded your commit was a big change for evil users and highly relevant and you could have mentioned it.

derinsh0 commented 2 years ago

@psisis

Commenting out that func in packages.el will uninstall term-cursor. Even disabling the layer but keeping the files original, will insist on installing (and for me) loading it.

These two sentences are both false.

How are they false. So you think I'm lying. In the second sentence I stated (for me). In the first I said commenting out use-package will uninstall it, which it still does. This is arrogance.

(Spacemacs) Warning: package term-cursor not initialized in layer spacemacs-editing-visual, you may consider removing this package from the package list or use the :toggle keyword instead of a `when' form.
(Spacemacs) --> deleting term-cursor... [1/1]
Package ‘term-cursor-20190515.41’ deleted.
pradyparanjpe commented 2 years ago

@pradyparanjpe

If you want a solution. Cd to .emacs.d and run git checkout 77ba076f697d270b011586944004ce8dfb6f61a4 -- .\layers\+spacemacs\spacemacs-editing-visual\* in shell.

@psisis,

I may be late

I'm travelling to my hometown this weekend, so I'll be on and off my computer(s) sporadically. I'll try that solution and get back as soon as I can.

Thanks for the prospective solution. :thumbsup:

I'm Irritated

By the attitude. (And that's a parliamentary word)

While in my hometown, I'll evaluate a prospective switch to doom-emacs, crafted-emacs or even vanila-emacs. But even if I do switch, I'll try your solution and confirm if it solves the problem.

pradyparanjpe commented 2 years ago

@pradyparanjpe

If you want a solution. Cd to .emacs.d and run git checkout 77ba076f697d270b011586944004ce8dfb6f61a4 -- .\layers\+spacemacs\spacemacs-editing-visual\* in shell.

:+1:

Verified the workaround solution

I could reproduce that.

Close

I'm closing the issue, If anyone wants to repoen it, they are welcome; I am dropping out from the discussion.

jpathy commented 2 years ago

This issue is still present, should be reproducible with daemon + gui frame(i use pgtk). I changed the condition to (unless (or (daemonp) (display-graphic-p)) (global-term-cursor-mode)) as a workaround.

As to why: See: https://stackoverflow.com/a/5801740 . display-graphics-p is nil in daemon mode, so checking that alone is not ideal.

real-or-random commented 1 year ago

This issue is still present, should be reproducible with daemon + gui frame(i use pgtk).

I can confirm this. A more user-friendly workaround is to add term-cursor to dotspacemacs-excluded-packages.

Wouldn't be a proper fix be to change term-cursor such that it is only active in GUI frames?

By the way, this issue me figure out that my spacemacs is so much snappier after disabling term-cursor-mode (also in GUI, where the mode was active but not effective). Maybe it's just my config, but if others have the same experience, it could make sense to get rid of it entirely.

viviicat commented 1 year ago

I also have this issue. Seems the fix that StreakyCobra has done in their fork might be a good way to resolve the issue. Though, for now I may blacklist term-cursor as that seems the simplest fix.

chaos95 commented 1 year ago

I have been having this issue with LSP lens in rust-mode (running 29.0.91 daemon + gui frame on darwin); I can confirm that applying the change from StreakyCobra's fork has fixed it.

niklas commented 5 months ago

I have been having that issue too (only in client mode), in particular purescript lsp-ui-doc not showing up the popup window, but showing the above error message. Adding term-cursor to the dotspacemacs-excluded-packages fixes that for me.

xu-shawn commented 2 months ago

Got the same error, freezes emacs on daemon mode

fnussbaum commented 2 months ago

I've also added term-cursor to excluded packages a long time ago, but I think it would be nice to fix this, and in particular have term-cursor-mode disabled by default if there is no terminal frame. I'm working on it.