public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Arsen Arsenović" <arsen@aarsen.me>
To: David Malcolm <dmalcolm@redhat.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	"Frank Ch. Eigler" <fche@elastic.org>,
	gcc@gcc.gnu.org, Alexandre Oliva <oliva@adacore.com>
Subject: Re: LSP based on GCC
Date: Wed, 17 May 2023 23:18:45 +0200	[thread overview]
Message-ID: <86mt22sheq.fsf@aarsen.me> (raw)
In-Reply-To: <febba5c2bb6b9f45b50b7f0f4b2a2c8ddceefa4f.camel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]


David Malcolm <dmalcolm@redhat.com> writes:

> [...snip...]
> I wrote that prototype, but I haven't touched it since 2017, and I
> already have more than enough other work, alas.  I'm happy to help if
> someone wants to pick up the work and finish it.
>
> That patch kit did several things:
> (a) adds a new "on the side" representation of source code locations
> (b) adds a JSON implementation to gcc
> (c) implements an LSP server on a port, implementing only the
> "textDocument/definition" method.
>
> Not having quite enough source code location is a pet peeve of mine
> within GCC's intermediate representation, as we lose a fair bit of
> location information as we go from frontends to the tree/generic
> representation (e.g. "exactly where was each brace?").

You mentioned 'cousin' tools in your original post, and I largely agree
with your sentiment.  Many parts of the job of an FE can be reused for
many other purposes, evidently.  Even beyond an LSP implementation.

> Unfortunately the particular approach I came up with in (a) was
> rejected by frontend maintainers, so I abandoned that part of the
> work.

I couldn't find the relevant messages.  Mind sharing a message-id or
archive link?

> The part of (b) for storing JSON trees in memory and writing them out
> is in GCC's source tree; the JSON-parsing code isn't yet, but I have a
> relatively up-to-date refreshed version of that code in one of my
> working copies which I can post to the list if it will be helpful.
>
> As for (c), doing it on a port is probably wrong, and working with
> stdin/stdout seems a much better approach.

AIUI, many editors (including Emacs' Eglot) also expect this (but I
suspect many can leverage other methods of connecting too).


ISTR Alexandre Oliva (CC added) mentioning leveraging GDB to implement
various bits of LSP functionality, such as handling multiple TUs.  This
sounds like a good idea to me (at least at a high level), as it could
lead to the hypothetical GNU toolchain LSP implementation being
partially language-agnostic (naturally, some things like candidate lists
would still need language support, as well as documentation parsing,
...), which would be quite handy.

Do you happen to have any memory of that?

Thanks in advance, have a lovely evening.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

  parent reply	other threads:[~2023-05-17 22:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 14:28 Eli Zaretskii
2023-05-17 15:46 ` David Malcolm
2023-05-17 17:10   ` Eli Zaretskii
2023-05-17 21:18   ` Arsen Arsenović [this message]
2023-05-29 20:16     ` Alexandre Oliva
2023-05-30 14:33       ` Paul Smith
2023-06-01  1:57         ` Alexandre Oliva
2023-05-18 14:28   ` Jason Merrill
2023-05-17 19:48 ` Paul Smith
2023-05-17 22:38   ` Ben Boeckel
2023-05-18 13:25     ` Paul Smith
2023-05-18 14:52       ` Ben Boeckel
2023-05-18 15:42         ` Paul Smith

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

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

  git send-email \
    --in-reply-to=86mt22sheq.fsf@aarsen.me \
    --to=arsen@aarsen.me \
    --cc=dmalcolm@redhat.com \
    --cc=eliz@gnu.org \
    --cc=fche@elastic.org \
    --cc=gcc@gcc.gnu.org \
    --cc=oliva@adacore.com \
    /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.
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).