* bug#64608: 29.0.90; Eglot: reuse server when visiting external files @ 2023-07-14 5:51 Filippo Argiolas 2023-07-14 10:38 ` Eli Zaretskii 0 siblings, 1 reply; 6+ messages in thread From: Filippo Argiolas @ 2023-07-14 5:51 UTC (permalink / raw) To: 64608 Hi, I'm working on a couple of projects each with their main root and all sharing some common code in an external root dir. Each project has a compile_commands.json that knows how to compile the external shared code. External root has no compile db and doesn't know how to compile itself. Eglot currently allows me to jump to external files using xref while keeping the current active running server by setting eglot-extend-to-xref. Project.el allows me to visit external files using project-or-external- functions by defining project-external-roots on my custom backend or project-vc-external-roots-functions with the default backend. It would be great if I configure Eglot to not switch to a new server when visiting an external file in a similar way it does with xref. Any pointer to achieve something like this with current project.el and eglot code would also be great. Maybe with a custom project backend? Best regards, Filippo ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#64608: 29.0.90; Eglot: reuse server when visiting external files 2023-07-14 5:51 bug#64608: 29.0.90; Eglot: reuse server when visiting external files Filippo Argiolas @ 2023-07-14 10:38 ` Eli Zaretskii 2023-07-14 13:55 ` Filippo Argiolas 2023-07-14 14:00 ` João Távora 0 siblings, 2 replies; 6+ messages in thread From: Eli Zaretskii @ 2023-07-14 10:38 UTC (permalink / raw) To: Filippo Argiolas, João Távora; +Cc: 64608 > From: Filippo Argiolas <filippo.argiolas@gmail.com> > Date: Fri, 14 Jul 2023 07:51:28 +0200 > > Hi, > > I'm working on a couple of projects each with their main root and all > sharing some common code in an external root dir. > > Each project has a compile_commands.json that knows how to compile the > external shared code. External root has no compile db and doesn't know > how to compile itself. > > Eglot currently allows me to jump to external files using xref while > keeping the current active running server by setting > eglot-extend-to-xref. > > Project.el allows me to visit external files using project-or-external- > functions by defining project-external-roots on my custom backend or > project-vc-external-roots-functions with the default backend. > > It would be great if I configure Eglot to not switch to a new server > when visiting an external file in a similar way it does with xref. > > Any pointer to achieve something like this with current project.el and > eglot code would also be great. Maybe with a custom project backend? Sorry, I don't understand: AFAIU Eglot reuses the same server for all the buffers under the same major-mode, so you should already have what you want? Or what am I missing? Adding João to this discussion. ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#64608: 29.0.90; Eglot: reuse server when visiting external files 2023-07-14 10:38 ` Eli Zaretskii @ 2023-07-14 13:55 ` Filippo Argiolas 2023-07-14 14:00 ` João Távora 1 sibling, 0 replies; 6+ messages in thread From: Filippo Argiolas @ 2023-07-14 13:55 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 64608, João Távora [-- Attachment #1: Type: text/plain, Size: 2115 bytes --] Il ven 14 lug 2023, 12:38 Eli Zaretskii <eliz@gnu.org> ha scritto: > > From: Filippo Argiolas <filippo.argiolas@gmail.com> > > Date: Fri, 14 Jul 2023 07:51:28 +0200 > > > > Hi, > > > > I'm working on a couple of projects each with their main root and all > > sharing some common code in an external root dir. > > > > Each project has a compile_commands.json that knows how to compile the > > external shared code. External root has no compile db and doesn't know > > how to compile itself. > > > > Eglot currently allows me to jump to external files using xref while > > keeping the current active running server by setting > > eglot-extend-to-xref. > > > > Project.el allows me to visit external files using project-or-external- > > functions by defining project-external-roots on my custom backend or > > project-vc-external-roots-functions with the default backend. > > > > It would be great if I configure Eglot to not switch to a new server > > when visiting an external file in a similar way it does with xref. > > > > Any pointer to achieve something like this with current project.el and > > eglot code would also be great. Maybe with a custom project backend? > > Sorry, I don't understand: AFAIU Eglot reuses the same server for all > the buffers under the same major-mode, so you should already have what > you want? Or what am I missing? > > Adding João to this discussion. > I could be misusing the word server here, what I'm seeing is a clangd instance for each project. Each with its own hidden stdout/stderr buffer. Not sure if they're actually different processes, far from the laptop at the moment and cannot check, but I guess so. When I visit a file in a new project it starts a new clangd instance associated to its root dir and its compile db if it exists. All buffers from the same project share the same instance. Not sure what happens with different major modes as I'm using c-mode only. What I'd like is to reuse the same instance and the same compile db if I'm visiting an external file from project-or-external- functions. Filippo [-- Attachment #2: Type: text/html, Size: 3080 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#64608: 29.0.90; Eglot: reuse server when visiting external files 2023-07-14 10:38 ` Eli Zaretskii 2023-07-14 13:55 ` Filippo Argiolas @ 2023-07-14 14:00 ` João Távora 2023-07-15 7:30 ` Filippo Argiolas 1 sibling, 1 reply; 6+ messages in thread From: João Távora @ 2023-07-14 14:00 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 64608, Filippo Argiolas [-- Attachment #1: Type: text/plain, Size: 1396 bytes --] On Fri, Jul 14, 2023, 11:38 Eli Zaretskii <eliz@gnu.org> wrote: > > > > Any pointer to achieve something like this with current project.el and > > eglot code would also be great. Maybe with a custom project backend? > > Sorry, I don't understand: AFAIU Eglot reuses the same server for all > the buffers under the same major-mode, so you should already have what > you want? Or what am I missing? > Not really like that Eli. Within the set of all the buffers in the major mode, subsets are defined for every project, i.e. return value of project-current. Broadly, that pair {major-mode , project} is the discriminator that determines Eglot's choice of server instance to manage a given buffer. The exception is buffers visited by eglot-extend-to-xref. I believe this is explained in the manual. If it's not clear, we should improve it. Fillipo, to fully understand your use case and what's missing I need you to create a structural example of those related projects, closely representative of the real one, pack it as a zip or a reference to a Git repository, in a way that I can experience the same limitation you are experiencing myself. Is the server you are using Clangd? If so, say the version. In summary, please follow the seven steps outlined in https://joaotavora.github.io/eglot/#Troubleshooting-Eglot, else it's going to be hard to help you. João [-- Attachment #2: Type: text/html, Size: 2000 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#64608: 29.0.90; Eglot: reuse server when visiting external files 2023-07-14 14:00 ` João Távora @ 2023-07-15 7:30 ` Filippo Argiolas 2023-07-15 7:32 ` Filippo Argiolas 0 siblings, 1 reply; 6+ messages in thread From: Filippo Argiolas @ 2023-07-15 7:30 UTC (permalink / raw) To: João Távora; +Cc: Eli Zaretskii, 64608 Il giorno ven 14 lug 2023 alle ore 16:00 João Távora <joaotavora@gmail.com> ha scritto: > Fillipo, to fully understand your use case and what's missing I need you to create a structural example of those related projects, closely representative of the real one, pack it as a zip or a reference to a Git repository, in a way that I can experience the same limitation you are experiencing myself. Is the server you are using Clangd? If so, say the version. I tried to setup a minimal work dir to show you what I'd like to obtain. https://people.freedesktop.org/~fargiolas/eglot-external-test-case.tar.gz It's configured (compile db and dir locals) to be unpacked inside /tmp/ Inside you will find three dirs: - foo and bar are normal projects - ext contains shared code that can be compiled only when paired with one or the other project. ext is is added as an external root to each of the projects with .dir-locals.el foo and bar include compile_commands.json that build both the project and the external code. Each project builds the external code differently (e.g. by setting different defines). Only relevant settings in init.el are: (add-hook 'c-mode-hook 'eglot-ensure) (setq eglot-extend-to-xref t) emacs 29.0.90 clangd 6.0.6 With eglot-extend-to-xref I can jump from foo/main.c into ext functions while keeping the same active clangd server (eglot:foo in the modeline). If I open foo/main.c and then visit ext/ext.c with project-or-external-find-file or project-or-external-find-regexp it switches to a new clangd instance (eglot:ext in the modeline) as it detects ext/ as its own project. What I'd like is to keep the same clangd instance if I'm visiting and external file in a similar way that xref does. Is it something achievable in current eglot? may be something I should configure about workspaces? Thanks! Filippo ^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#64608: 29.0.90; Eglot: reuse server when visiting external files 2023-07-15 7:30 ` Filippo Argiolas @ 2023-07-15 7:32 ` Filippo Argiolas 0 siblings, 0 replies; 6+ messages in thread From: Filippo Argiolas @ 2023-07-15 7:32 UTC (permalink / raw) To: João Távora; +Cc: Eli Zaretskii, 64608 Il giorno sab 15 lug 2023 alle ore 09:30 Filippo Argiolas <filippo.argiolas@gmail.com> ha scritto: > emacs 29.0.90 > clangd 6.0.6 clangd 16.0.6, sorry for the typo ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-15 7:32 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-07-14 5:51 bug#64608: 29.0.90; Eglot: reuse server when visiting external files Filippo Argiolas 2023-07-14 10:38 ` Eli Zaretskii 2023-07-14 13:55 ` Filippo Argiolas 2023-07-14 14:00 ` João Távora 2023-07-15 7:30 ` Filippo Argiolas 2023-07-15 7:32 ` Filippo Argiolas
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).