Skip to content

fix(showMessage): use on_message handler#1103

Open
tris203 wants to merge 1 commit intofolke:mainfrom
tris203:on_message
Open

fix(showMessage): use on_message handler#1103
tris203 wants to merge 1 commit intofolke:mainfrom
tris203:on_message

Conversation

@tris203
Copy link
Copy Markdown
Contributor

@tris203 tris203 commented Apr 24, 2025

Replace typo _on_message with on_message in the LSP message handler.

Description

Related Issue(s)

Closes #1074

Screenshots

Replace typo _on_message with on_message in the LSP message handler.
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the stale This issue or PR has been inactive for a while label May 25, 2025
@tris203
Copy link
Copy Markdown
Contributor Author

tris203 commented May 25, 2025

Not stale

@github-actions github-actions bot removed the stale This issue or PR has been inactive for a while label May 26, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the stale This issue or PR has been inactive for a while label Jun 25, 2025
@tris203
Copy link
Copy Markdown
Contributor Author

tris203 commented Jun 25, 2025

Still pending

@github-actions github-actions bot removed the stale This issue or PR has been inactive for a while label Jun 26, 2025
@fennecdjay
Copy link
Copy Markdown

this is actually pretty helpful!
I'm making a LSP for my own language, showMessage can be super useful for debugging it and i couldn't find why it didn't work

@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the stale This issue or PR has been inactive for a while label Aug 22, 2025
@tris203
Copy link
Copy Markdown
Contributor Author

tris203 commented Aug 22, 2025

No

@github-actions github-actions bot removed the stale This issue or PR has been inactive for a while label Aug 23, 2025
@matthee
Copy link
Copy Markdown

matthee commented Dec 18, 2025

I've also run into this bug. This PR seems to fix this error.


function M.setup()
vim.lsp.handlers["window/showMessage"] = M._on_message
vim.lsp.handlers["window/showMessage"] = M.on_message
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking though git blame. You might want to use Util.protect(M.on_message) to restore the previous behavior.

See 0f5f8c93

Suggested change
vim.lsp.handlers["window/showMessage"] = M.on_message
vim.lsp.handlers["window/showMessage"] = Util.protect(M.on_message)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, but I'm not sure, since @folke explicitly removed the Util.protect call in the same commit changing M.on_message to M._on_message. Might be a typo, though.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the Util.protect call gives me the following error upon LazyVim startup:

   Error  09:35:36 AM notify.error noice.nvim `vim.lsp.handlers["window/showMessage"]` has been overwritten by another plugin?

Either disable the other plugin or set `config.lsp.message.enabled = false` in your **Noice** config.
  - plugin: noice.nvim
  - file: /home/lian/.local/share/nvim/lazy/noice.nvim/lua/noice/util/call.lua
  - line: 51

@liancheng
Copy link
Copy Markdown

Hit the same issue and same fix while debugging my own language server using LazyVim.

@liancheng
Copy link
Copy Markdown

A non-intrusive workaround: #1074 (comment)

njhoffman added a commit to njhoffman/noice.nvim that referenced this pull request Mar 28, 2026
Fixes typo where M._on_message (undefined) was assigned as the LSP
handler instead of M.on_message. LSP window/showMessage was silently broken.

From upstream PR folke/noice.nvim#1103

Co-Authored-By: tris203 <tris203@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

bug: window/showMessage handler not attached

4 participants