[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LSP vs Emacs indentation [
From: |
Tassilo Horn |
Subject: |
Re: LSP vs Emacs indentation [ |
Date: |
Fri, 28 Jul 2023 07:28:24 +0200 |
User-agent: |
mu4e 1.11.12; emacs 30.0.50 |
Stephen Leake <stephen_leake@stephe-leake.org> writes:
>> 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.
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.
Bye,
Tassilo