Re: [GNU ELPA] New package: flymake-harper

João Távora <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
Juri Linkov <[email protected]> writes:

>>> 'harper-ls' has a code action for quick fixes that
>>> suggests fixes for the selected error.  But integration
>>> with eglot is more uncertain.
>>
>> What do you mean?  Have you ever tried this particular one?
>
> I meant trying to implement the same UI as flyspell-mode
> for spell-checking by harper.

Oh.  I haven't used Flyspell in ages.  Not sure it should be a reference
these days.

>> I use tons of LS's (unfortunately, for debugging Eglot) and they
>> largely work consistently with `eglot-code-actions`.
>
> I use Eglot code actions all the time, and they work nicely.

Good to know.

>> Do you really mean that?  For auto-correction specifically, the
>> denominator is usually, if not always, the 'codeActionProvider'
>> capability.  Code actions, to be precise, are how LSP associates
>> arbitrary changes to regions in a document.  It's a fairly narrow and
>> well understodd part of LSP (and Eglot).
> I know.  What I meant is trying to implement flyspell-like UI
> specifically for autocorrection that e.g. displays a list
> of suggested replacements, and after selecting a candidate
> replaces a misspelled word with the selected candidate.
> I don't know how easy is to customize Eglot actions
> to implement a different UI for selecting an action
> with some parameters (e.g. a list of corrected words),
> and performing the action.

Who do you envision doing this customization?  The
server/provider/backend, right?  Well
https://github.com/blopker/codebook provides a number of code actions.
If if you mistype 'murging' it suggests:

Replace with 'urging'
Replace with 'merging'
Replace with 'surging'
Add 'murging' to dictionary
Add 'murging' to global dictionary

As to interactively querying the user for a replacement, LSP has no such
capability sadly . According to [1] some servers are abusing the
"textDocument/rename" entry point for this.

>>> For example, some use "textDocument/formatting" with 'eglot-format'
>>> for auto-corrections,
>> Who?  What LS?  That entry point is strictly for non-semantic whitespace
>> changes.
> I have looked at this, but didn't finish testing:
> https://docs.rubocop.org/rubocop/latest/usage/lsp.html#autocorrection

Ugh.  That's... wrong.   Hopefully it's an exception.

João

[1]: https://github.com/joaotavora/eglot/issues/1554#issue-3638928220
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.