-
Notifications
You must be signed in to change notification settings - Fork 199
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
Use filter-buffer-substring to get buffer text #482
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, sorry. Eglot should not be the receptacle of improvements that belong in other parts of Emacs or other packages, even if it's a kind of "soft depedency" such as Markdown. This is especially important as Eglot moves closer to the core of Emacs.
eglot.el
Outdated
(ignore-errors (delay-mode-hooks (funcall mode))) | ||
(font-lock-ensure) | ||
(buffer-string)))) | ||
(when (eq major-mode 'gfm-view-mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too much for eglot.el
, @muffinmad, sorry. IT's clearly something that is to be done in the server, in gfm-view-mode
, or maybe in a user hook. But I think you should contribute this to gfm-view-mode
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Would it be fine for eglot
to use filter-buffer-substring
instead of buffer-string
here? In this case gfm-view-mode
(among other modes) can provide own filter-buffer-substring-function
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about that function, but that sounds very good in principle, yes.
This way modes used to represent hover info text can e.g. filter out invisible text by providing own `filter-buffer-substring-function'. * eglot.el (eglot--format-markup): Use `filter-buffer-substring'.
4f02e4b
to
7de813b
Compare
This PR allows major modes, used to format the hover info text, to filter the text. |
I think this PR now makes sense. However, it is too soon to merge it, probably. I'll make the most sense when |
OK, no problem.
Not yet.
Something like this (defun test/filter (start end &optional delete)
(replace-regexp-in-string "^```.*\n*?" ""
(buffer-substring start end)))
(add-hook 'gfm-view-mode-hook
(lambda ()
(setq-local filter-buffer-substring-function
#'test/filter))) But this will not work because of |
You lost me :-) |
Sorry :) My local Here is another way to make it solely in (let ((filter-buffer-substring-function eglot-filter-help-buffer-function))
(filter-buffer-substring (point-min) (point-max))) Then the |
Too bad there are no something like |
bah.
But smart old me forgot to include a reference to the issue that would have explained why |
Got it, it's #327. The |
I'm mostly use Call of |
Absolutely agree. Thanks for the tips! |
Yeah, but that annotates the whole buffer. I like |
|
Nice, but what does that mean for us? |
That means to us that this PR must be merged immediately ;-) And make eglot respect |
Andrii Kolomoiets <[email protected]> writes:
filter-buffer-substring-function is now implemented in both
markdown-view-mode and gfm-view-mode
Nice, but what does that mean for us?
That means to us that this PR must be merged immediately ;-) And make
eglot respect filter-buffer-substring-function provided by the major
mode used to present the hover info to happy eglot users!
Doh. Sorry, I got confused. Merged.
|
This was introduced in joaotavora#482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Fixes joaotavora#865. * eglot.el (eglot--format-markup): Don't use 'filter-buffer-substring'; instead, keep invisible text.
This was introduced in joaotavora#482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Fixes joaotavora#865. * eglot.el (eglot--format-markup): Don't use 'filter-buffer-substring'; instead, keep invisible text.
This was introduced in #482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Per #866 * eglot.el (eglot--format-markup): Use buffer-string instead of filter-buffer-substring
… text This way modes used to represent hover info text, such as gfm-view-mode can e.g. filter out invisible text by providing own `filter-buffer-substring-function'. * eglot.el (eglot--format-markup): Use `filter-buffer-substring'.
…hover string This was introduced in joaotavora/eglot#482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Per joaotavora/eglot#866 * eglot.el (eglot--format-markup): Use buffer-string instead of filter-buffer-substring
… text This way modes used to represent hover info text, such as gfm-view-mode can e.g. filter out invisible text by providing own `filter-buffer-substring-function'. * eglot.el (eglot--format-markup): Use `filter-buffer-substring'.
…hover string This was introduced in joaotavora/eglot#482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Per joaotavora/eglot#866 * eglot.el (eglot--format-markup): Use buffer-string instead of filter-buffer-substring
This way modes used to represent hover info text, such as gfm-view-mode can e.g. filter out invisible text by providing own `filter-buffer-substring-function'. * eglot.el (eglot--format-markup): Use `filter-buffer-substring'. #482: joaotavora/eglot#482
This was introduced in #482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Per #866 * eglot.el (eglot--format-markup): Use buffer-string instead of filter-buffer-substring #865: joaotavora/eglot#865 #482: joaotavora/eglot#482 #866: joaotavora/eglot#866
This way modes used to represent hover info text, such as gfm-view-mode can e.g. filter out invisible text by providing own `filter-buffer-substring-function'. * eglot.el (eglot--format-markup): Use `filter-buffer-substring'. GitHub-reference: close joaotavora/eglot#482
This was introduced in joaotavora/eglot#482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Per joaotavora/eglot#866 * eglot.el (eglot--format-markup): Use buffer-string instead of filter-buffer-substring GitHub-reference: fix joaotavora/eglot#865
This was introduced in joaotavora/eglot#482 due to a bad interaction with a specific server. But this solution makes hyperlinks in Eldoc buffers unclickable, because the markdown-mode function that visits a link relies on the invisible text. Per joaotavora/eglot#866 * eglot.el (eglot--format-markup): Use buffer-string instead of filter-buffer-substring GitHub-reference: fix joaotavora/eglot#865
Python file:
int
textDocument/hover
response:With default eglot settings the following message is shown in the echo area:
Codeblock markers are invisible in
gfm-view-mode
and mostly useless after font faces are applied to the text.This PR removes codeblock markers from the hover info.