[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LSP vs Emacs indentation [
From: |
Stefan Monnier |
Subject: |
Re: LSP vs Emacs indentation [ |
Date: |
Fri, 28 Jul 2023 09:29:54 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> 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.
>
> I think the problem here is that this function would need to know at
> least some syntactically valid code to insert which depends on the
> language.
It would be easy to let major modes provide such a "syntactically valid
dummy". For some languages it should be very easy (at least as easy as
guessing an offset), but for others the valid dummy that needs to be
used may depend on the context, and so may be just as hard as guessing
an offset.
In any case, leaving it empty may also result in "incorrect" reindentation
of the rest.
Stefan