emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LSP vs Emacs indentation [


From: Stephen Leake
Subject: Re: LSP vs Emacs indentation [
Date: Thu, 27 Jul 2023 14:51:59 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (windows-nt)

Theodor Thornhill via "Emacs development discussions."
<emacs-devel@gnu.org> writes:

> Consider (| is the cursor)
>
> ```
> func foo() {|}
> ```
>
> Now if you type RET we'd expect some incantation of
>
> ```
> func foo() {
>   |
> }
> ```
>
> to be the expected output, not the cursor at col 0, which is what
> happens now. That means we'd have to do something like
>
>
> Where the 'eglot-newline-and-indent-according-to-mode' has to calculate
> the expected indentation. I don't understand how we'd expect the
> formatters to do that indentation for us. They only care about code
> already written, not code yet to be written. So if we'd have to
> calculate that offset anyway, do we win much?

Your "newline-and-indent" function could insert some bogus code
(probably "bar;" or "bar();") and ask LSP to format that, then delete
the bogus code.


-- 
-- Stephe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]