unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Tassilo Horn <tsdh@gnu.org>
Cc: "Stephen Leake" <stephen_leake@stephe-leake.org>,
	"João Távora" <joaotavora@gmail.com>,
	"Theodor Thornhill" <theo@thornhill.no>,
	"Eli Zaretskii" <eliz@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: LSP vs Emacs indentation [
Date: Fri, 28 Jul 2023 09:29:54 -0400	[thread overview]
Message-ID: <jwvy1j0dv60.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87fs58txgq.fsf@gnu.org> (Tassilo Horn's message of "Fri, 28 Jul 2023 07:28:24 +0200")

>> 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




      reply	other threads:[~2023-07-28 13:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87bkg4bkfu.fsf@fastmail.fm>
     [not found] ` <83a5voa328.fsf@gnu.org>
     [not found]   ` <87h6pw9tpa.fsf@gmail.com>
     [not found]     ` <875y6bm5ut.fsf@fastmail.fm>
2023-07-23 10:20       ` bug#64784: LSP vs Emacs indentation [Was: bug#64784: 30.0.50; Eglot: Lisp error: (wrong-type-argument number-or-marker-p return) in eglot--post-self-insert-hook] João Távora
2023-07-23 15:13         ` Theodor Thornhill
2023-07-23 16:42           ` João Távora
2023-07-24 17:03         ` Tassilo Horn
2023-07-24 18:13           ` Theodor Thornhill via Emacs development discussions.
2023-07-27 21:51             ` LSP vs Emacs indentation [ Stephen Leake
2023-07-28  5:28               ` Tassilo Horn
2023-07-28 13:29                 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvy1j0dv60.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=stephen_leake@stephe-leake.org \
    --cc=theo@thornhill.no \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).