Skip to content

Improve backwards compat for async RPC callback#810

Open
mmrwoods wants to merge 5 commits into
yegappan:mainfrom
mmrwoods:better-rpc_a-backwards-compat
Open

Improve backwards compat for async RPC callback#810
mmrwoods wants to merge 5 commits into
yegappan:mainfrom
mmrwoods:better-rpc_a-backwards-compat

Conversation

@mmrwoods
Copy link
Copy Markdown
Contributor

@mmrwoods mmrwoods commented May 28, 2026

📌 Summary

Use v:stacktrace if available to check call site when handling "Too many arguments" error and support previously async RPC callback function signature.


🔍 Related Issues


🧪 What This PR Improves

More reliably checks that the "Too many arguments" error occurred within the LSP server code rather than in the callback code itself when falling back to using the old function signature.


🛠️ Changes Made

  • If v:stacktrace exists, confirm that the current script path matches the last filepath in the stacktrace before falling back to the old callback function signature
  • If v:stacktrace does not exist, continue to pattern match on v:throwpoint, as before

🧪 Testing

Manually tested locally with fuzzbox-lsp.vim using Vim 9.0.0000 and 9.2.0421


📦 Breaking Changes

Does this PR introduce any breaking changes?

  • Yes
  • No

📚 Documentation

Does this PR require documentation updates?

  • Yes
  • No

✔️ Checklist

  • I have tested this with a minimal Vim9script configuration.
  • I have run the plugin against the relevant LSP server(s).
  • I have updated documentation if needed.
  • I have followed the project’s coding style and conventions.
  • I have added tests or examples where appropriate.

Use v:stacktrace to check call site if available, added in Vim 9.1.0984

Presumably more reliable than pattern matching on v:throwpoint

Note: this only checks the filepath, not the function name, which should
be fine, the fallback is for external calling code, not lsp plugin code
@mmrwoods
Copy link
Copy Markdown
Contributor Author

@yegappan I decided to re-open this (well, create a new issue as I don't have permission to re-open) after having a second look this morning. The code does add complexity, so I am not fully convinced it is worth it for the likely small number of users or collaborating plugins affected, but I'll let you be the judge.

@mmrwoods mmrwoods force-pushed the better-rpc_a-backwards-compat branch from d8cdd4e to 0f00edd Compare May 29, 2026 15:21
Comment thread autoload/lsp/lspserver.vim Outdated
Comment thread autoload/lsp/lspserver.vim Outdated
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.

2 participants