From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#58790: Eglot URI parsing bug when using clojure-lsp server Date: Sat, 29 Oct 2022 04:22:43 +0300 Message-ID: References: <8cf8ba5d-c604-b2dc-274a-7597b19fb73f@dfreeman.email> <87ilk5xq01.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14598"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Cc: 58790@debbugs.gnu.org, Stefan Kangas To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Danny Freeman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 29 03:23:17 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ooaZA-0003dg-E8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Oct 2022 03:23:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooaYz-0001Tg-4a; Fri, 28 Oct 2022 21:23:05 -0400 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 1ooaYx-0001JI-0c for bug-gnu-emacs@gnu.org; Fri, 28 Oct 2022 21:23:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ooaYw-0005KH-FP for bug-gnu-emacs@gnu.org; Fri, 28 Oct 2022 21:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ooaYw-0000mh-5x for bug-gnu-emacs@gnu.org; Fri, 28 Oct 2022 21:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Oct 2022 01:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58790 X-GNU-PR-Package: emacs Original-Received: via spool by 58790-submit@debbugs.gnu.org id=B58790.16670065762991 (code B ref 58790); Sat, 29 Oct 2022 01:23:02 +0000 Original-Received: (at 58790) by debbugs.gnu.org; 29 Oct 2022 01:22:56 +0000 Original-Received: from localhost ([127.0.0.1]:34599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ooaYq-0000mA-3x for submit@debbugs.gnu.org; Fri, 28 Oct 2022 21:22:56 -0400 Original-Received: from mail-wr1-f42.google.com ([209.85.221.42]:39588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ooaYl-0000lt-7b for 58790@debbugs.gnu.org; Fri, 28 Oct 2022 21:22:54 -0400 Original-Received: by mail-wr1-f42.google.com with SMTP id o4so8634590wrq.6 for <58790@debbugs.gnu.org>; Fri, 28 Oct 2022 18:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=YfpS1nR10Bfg6bgojWmVAj6D5e6eali6KRv8GD47aEA=; b=Sa2r8KUt4OPc99Tdt9qbhnI92ieSO/bEDYRtqubyN2E8HwahBRTxpH9nxjHXw2lv/a 2DVVsQC7xhz7sNoN+k/NAy1JbluU1AJMr2XLD4gqD9goDSWZxZZRDcIuYT56gqObcNPs +RcNVkbphKhGXt50SsUdZq8SaqVF9MvzMdPJ6o4ShAMtdMZsx7f0kFbT+kEDTzyv2xeX wUDnd2rnNClmgAMEG7EDYV2DezTFznLAnh3id4tvM8uiXvjysp8laboxHUI6vmi+PcXZ SbgsykK/mm2sx4tiwiZ56En7qY7iihRP1E21ewq0JXBz/RrSGoWsqYzRMWWM4b1PeYqd Cm0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YfpS1nR10Bfg6bgojWmVAj6D5e6eali6KRv8GD47aEA=; b=U9zOzQRXW5I79zvimNk/vx8LIS5TSnduzkdtulX8uCfEJ4BfRIPmSDsSKM8grg1tyy 2tYW8rHOLzf8tW+JP2utMWVJ9xysT7Dq0LL+0jzkk1VAe+MFGT2GPW7/xP4i7y59vvIR uSjeFRS//kqF0QT6KQqzlsKPjAAdxvjprL9m4rYBW8TFhJtFd+Ruk3AtnMUSTg3T2VBC oHxkCAnNg/YuU2FbIy1QmczHJLG/cc0g6WirkC6YAYnHpgA+0XQrQvZiH60Yq9sZBsjb dLhkSOY7AEHe8sEgTNoFAEu+0gZ/7W1TY+P5XR+HUbWOItjqMsFMP8ixmb1s6Lc1ZbMm u4jg== X-Gm-Message-State: ACrzQf1jntMUfHxusNWuJfMc723iYnb7MVD8hj8n4Wy4X/plx3+jL/ox yj7tC8QV1yfxFrPuv6QuE+I= X-Google-Smtp-Source: AMsMyM6hngVFBoN3v8IfPVtUAfJZp6/wrf2opymtVjRWQAFFu/KOtVhN9YmoExKL++AejmCfVjtrCA== X-Received: by 2002:adf:dc12:0:b0:236:6569:fccc with SMTP id t18-20020adfdc12000000b002366569fcccmr1029132wri.80.1667006565343; Fri, 28 Oct 2022 18:22:45 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id f16-20020a05600c155000b003b47e75b401sm134171wmg.37.2022.10.28.18.22.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 18:22:45 -0700 (PDT) Content-Language: en-US In-Reply-To: <87ilk5xq01.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246472 Archived-At: On 27.10.2022 18:09, João Távora wrote: > 4. B2 can be setup in a way so that project-current returns the same > object which is returned in B. If this is true, > eglot--current-server discovers the same connection which also > manages B1 and Eglot adds buffer B2 to the list of managed buffers in > that connection. > > However, if eglot-extend-to-xref is non-nil, eglot--current-server > should also discover the correct connection. This is less ideal than > making project-current know that the buffers of source code inside > the jar are also in the same project, but it works. I can explain > the downsides, but it's not very relevant right now. This point seems to be key, to be able to continue 'M-.' from inside the jar. > 5. Upon findin the "file", Eglot transmits a :textDocument/didOpen > notification to the server. This requires eglot--path-to-uri, the > reciprocal of eglot--uri-to-path to convert the path Y to URI X > again. Again, maybe this conversion is just #'identity. > > Eventually, the LSP server knows that the client is now working on a > textDocument whose relationship to other opened documents in the > workspace it understands (which may or may not be read-only). > > 6. xref-find-definition on any part of the B2 should now work similarly > to this whole flow. > >> Dmitry: Sounds like you want to advise project-vc-external-roots-function. Or >> Dmitry: change its whole value. FWIW, project-external-roots might be a red herring for this discussion. I just saw somebody mention project-external-roots, and the above would be a way to add to that list. > I don't understand that "vc" has to do with this. The above > implementation should work with any project backend, not just VC. Okay... > To be clear, my suggestion was to add the ability to add a jar file to > project-external-roots. Currently a root is a string representing a > directory, per its docstring. But it could be generalized to a string > representing any container of files. Container or not, the return value of project-external-roots, just like that of project-root, is determined by the project backend, its internal structures, and how it is customized by the user. We don't provide a setter for 'project-root', so I don't understand the expectation of being able to modify project-external-roots for an arbitrary project type either. >> Dmitry: Or create an Eglot-specific project backend. > > I don't understand this suggestion either. Normally Eglot is a client > of project information maintained by other project.el backends. Very > commonly VC projects, but not always necessarily so. That clashes with > the idea of making Eglot simultaneously a supplier of this information. There is indeed certain tension, but if Eglot wants to decide stuff about the project (which, as I said in the past, could be a reasonable idea), then it could provide its own project backend. We're not necessarily at that point, though, because... > Please read the summary of the outlined above. Maybe there's nothing to > be done in project.el if eglot-extend-to-xref is to be used. ...indeed you could stop at that. Having the jars in project-external-roots could enable the users (after certain integration work) to search across their contents with project-or-external-find-regexp, or jump to files inside with project-or-external-find-file. But as for xref-find-definitions, item 4 in your list should be enough (with either of the alternatives as underlying implementation).