Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in after-change-function can break lsp's error display #1704

Closed
aaronjensen opened this issue May 19, 2020 · 4 comments
Closed

Changes in after-change-function can break lsp's error display #1704

aaronjensen opened this issue May 19, 2020 · 4 comments

Comments

@aaronjensen
Copy link
Contributor

Describe the bug
When a change is made in an after-change-function, lsp's error checking does not properly respect that change which leaves errors that are not errors visible. These don't go away until the buffer is saved.

It's certainly possible that this is a flycheck issue.

Downstream report: emacs-vs/auto-rename-tag#9

To Reproduce

Clone and follow instructions: https://github.com/aaronjensen/lsp-auto-rename-repro

Expected behavior
The error should disappear when there is no longer an error

Which Language Server did you use
typescript

OS
macOS

Error callstack
No error

@yyoncho
Copy link
Member

yyoncho commented May 19, 2020

https://github.com/aaronjensen/lsp-auto-rename-repro

This link is dead.

@aaronjensen
Copy link
Contributor Author

@yyoncho sorry, forgot to make it public, please try again

@yyoncho
Copy link
Member

yyoncho commented May 19, 2020

As per docs

Buffer changes made while executing the before-change-functions' don't call any before-change or after-change functions. That's because inhibit-modification-hooks' is temporarily set non-nil.

This means that there is no way for lsp-mode to detect the change and send it to the server. The fix for that is auto-rename-tag to avoid doing any changes in after/before change hooks and execute then after the hooks have finished. One way to do that is to stash the changes and execute them in post-command hook.

@yyoncho yyoncho closed this as completed May 19, 2020
@aaronjensen
Copy link
Contributor Author

@yyoncho thanks! I just read that as well and got it working by firing the change in a timer afterwards, but a post-command hook seems to make even more sense.

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

No branches or pull requests

2 participants