From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Adding support for xref jumping to headers/interfaces Date: Mon, 6 Mar 2023 13:38:20 +0000 Message-ID: References: <1587ddb6-f631-0890-965a-c7acb5729fa6@yandex.ru> <87r0u2ax26.fsf@betli.tmit.bme.hu> <253cdcdd-863e-e8e3-a783-62ce1c570cfb@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5251"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Felician Nemeth , John Yates , Helmut Eller , emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 06 14:39:29 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZB3p-0001Dt-Cp for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Mar 2023 14:39:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZB3L-0002Kc-N3; Mon, 06 Mar 2023 08:38:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZB2x-0001hF-Mw for emacs-devel@gnu.org; Mon, 06 Mar 2023 08:38:37 -0500 Original-Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZB2u-0000jJ-J1 for emacs-devel@gnu.org; Mon, 06 Mar 2023 08:38:34 -0500 Original-Received: by mail-oi1-x22b.google.com with SMTP id bp19so7016986oib.4 for ; Mon, 06 Mar 2023 05:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678109911; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/AwjJF0YlrgG+b5OxzJMrVkekrQQa5PLfKbkjoBk4tA=; b=VkyJvw8za0PCDQs3HNF5nuy26Dv8kSOOANZxp6YTQEe40ELBaZb5irZv/u56DlUueC jBlD5X159vGo6oftygHZJqsJzdhXMENKXmcvEsuYJGNdDGAWjrgIqSVTKyBh+aMoDUTx pphVNs2M+huGy00yJZnpMAqD/trj2u/Y7H1hLoDf4LnaAYJbFk1t8lOmqL3gVdXBtGPU uMeUOlpBxQSEJkrB9sQxQO1GCXLCAy+xNMbp4IrpEmgViaa1pN2wc/SIJ3MZTUi802Mb f6yPJZlJgdi85UfRn7KS/YiikPqBZiINKADaCOR938+qNFMCa42/CaTW+UCqNQpwD3pZ Tcmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678109911; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/AwjJF0YlrgG+b5OxzJMrVkekrQQa5PLfKbkjoBk4tA=; b=BhG4aS10+ovg9lsomMkEb68W/hju9kWmQ6YT0XOOFwxfs7kwJK4VgLEaLoyPIrFM8W VFGEw78Q/Ci7pMadcFrX/4pqRtjfz3jbnKFQ5Th60u+vy3dYOgv7BEaM+fcy8vIF2S3d PzWK9KSndCaduxj9I7RBEABBhJJFRColv8GstNVb7yJ+9bbUANxzKgFIb2DpwGfD7CQY eVQGHt4aQ5U/j/l13d5JPNWkcA7sEtk7Wv90xJ0V6FWvhWYNfUtKqRuO2Qw2gU4dfQ1s fjuL3ltdR44ckM+i6ylAszLQXr9TAbyZ6AqAGXUOMkmennBKh0y3i6soSwJBeMcU9A69 0skw== X-Gm-Message-State: AO0yUKXaxOEyWpf4i3jX6ygej05BzSouB/Fl2uaLeAABTKleYS2Nl64T WkMeXyIMw27dhKG6kT7TV95jTR7iVrjusB5nnXM= X-Google-Smtp-Source: AK7set9qij/aM7jpU2Pgx1ChGgLKsn67XkID6FT5xSfT3XrFvF0pHDXbiszhhD7yDJdVuwWMy9U41hHk7IXftOccV14= X-Received: by 2002:aca:240d:0:b0:384:22aa:f4cf with SMTP id n13-20020aca240d000000b0038422aaf4cfmr2986219oic.8.1678109911019; Mon, 06 Mar 2023 05:38:31 -0800 (PST) In-Reply-To: <253cdcdd-863e-e8e3-a783-62ce1c570cfb@yandex.ru> Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=joaotavora@gmail.com; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304043 Archived-At: On Mon, Mar 6, 2023 at 1:24=E2=80=AFPM Dmitry Gutov wrot= e: > > On 06/03/2023 15:15, Jo=C3=A3o T=C3=A1vora wrote: > > On Mon, Mar 6, 2023 at 12:23=E2=80=AFPM Felician Nemeth > > wrote: > >> Can you, please, consider adding more than just one new xref command? > >> The Language Server Protocol defines jump-to-declaration, > >> jump-to-implementation, and jump-to-typeDefinition commands as well. > >> > >> ---- > >> > >> I can image a new xref-find-extra command that provides a > >> `tmm-menubar'-like single key selection for the specific jump type. T= he > >> list of jump-types could be filled up by Eglot or major-modes (ada-mod= e > >> would add "specifications", ocaml-mode would add "interface"). If C-M= -? > >> is bound to this new xref-find-extra, then "C-M-? i" would jump to the > >> interface definition in ada-mode, and "C-M-? d" would ask the LSP serv= er > >> for declarations in case of Eglot. > >> > >> (Users who find "C-M-?" awkward can rebind xref-find-extra to "s-.") > >> > >> What do you think? > > To me, the "find extra" trampoline idea sounds nice too. It doesn't > > suffer from the drawback of adding "interface", "implementation", > > "typeDefinition", "superSpecificLanguageConstruct" concepts to xref.el > > in poorly-scalable fashion. > > Could Eglot dynamically report on which of these operations are > supported in the current buffer? I think that is doable, yes. The question is whether to use the LSP names for them or our "own" names. I think I prefer the former, to avoid concept creep. So M-x xref-find-extra would offer "textDocument/findImplementation", "textDocument/findDeclaration", etc when backend reports these operation names (which in turn it does if the server has the associated LSP capability). Other non-Eglot backends would report other operation names, but that's fine as long as whoever reports them also knows how to handle them. The consistency would be in the single xref-find-extra binding. The LSP names are clear enough and we can even decamelify them automatically to be nicer to the camelically disinclined like myself. Jo=C3=A3o