-
Notifications
You must be signed in to change notification settings - Fork 202
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
Remove highlight overlay immediately when symbol is edited #626
Conversation
Seems sensible, but do we need a category? It's only really useful when there's more than one usage, right? |
I'm not sure what the pros and cons are in this case. There's one usage, but it occurs in a loop; I though it would be a bit smarter to create a list with a lambda in it only once. Anyway, should I change that? Also, just to make sure: if we delete the overlay after any change, there's no need for the |
Setting two props instead of one is not going to make a difference :-)
Oy, now that I look carefully, that's a nono! just use a normal lambda
Yes, |
Okay, I updated the pull request.
I presume you refer here to creating a closure/unquoting the lambda. If I may ask, for my own benefit, why it that a nono? In the previous version of the PR, where the lambda was created outside |
Quoting If you use I guess if the compiler detects that the lambda doesn't need to capture anything it can skip creating the closure and just create a plain function. I'm not a compiler/Lisp expert. @monnier can probably correct me on this. |
This is why I originally created a category: it allowed moving the lambda outside of the function, so you don't need to be a compiler/Lisp expert to be sure only one function object (and only one closure) is created. Also, note that I originally wrote
Don't BS me! |
When you unquote it should be fine. As long as the compiler gets to "see" the Anyway, don't worry about performance prematurely. Trust the compiler and write straightforward Lisp. Categories are for reusing code, not for performance optimizations. |
|
More or less. I lent myself to be misunderstood :-) Your original version was fine lambda-quoting-wise indeed. I got confused by the double parenthesis and thought you were making a list, as Stefan pointed out. It's in your changed version that the problem I was pointing to actually appeared. |
* eglot.el (eglot--highlight-piggyback): Add `modification-hooks' to the created overlays.
All right, should be good to merge now, and thanks for the free Lisp lesson. |
@joaotavora Friendly ping |
…symbol edited * eglot.el (eglot--highlight-piggyback): Add modification-hooks property to the created overlays. Co-authored-by: João Távora <joaotavora@gmail.com>
…symbol edited * eglot.el (eglot--highlight-piggyback): Add modification-hooks property to the created overlays. Co-authored-by: João Távora <joaotavora@gmail.com>
* eglot.el (eglot--highlight-piggyback): Add modification-hooks property to the created overlays. Co-authored-by: João Távora <joaotavora@gmail.com> #626: joaotavora/eglot#626
* eglot.el (eglot--highlight-piggyback): Add modification-hooks property to the created overlays. Co-authored-by: João Távora <joaotavora@gmail.com> GitHub-reference: fix joaotavora/eglot#626
Currently, the
textDocument/documentHighlight
overlays stay when the highlighted symbol is edited, which is is distracting and arguably incorrect.With this PR, the highlight disappears as soon as the symbol is edited (other highlights stick around, which feels right to me).