* bug#74334: 29.4; Eglot ignores locally set configuration
@ 2024-11-12 20:49 Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-12 21:34 ` bug#74330: " João Távora
2024-11-13 8:03 ` bug#74334: " Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 6+ messages in thread
From: Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-12 20:49 UTC (permalink / raw)
To: 74334; +Cc: joaotavora
Can be observed on both builtin (1.12.29) and the newest Eglot (1.17). I'm starting Eglot manually, i have no hooks for Rust.
My repo structure:
/
...
|_pkgs/rsblocks/
|_.dir-locals.el
|_Cargo.toml
...
Since my Rust project isn't in the root of the repo, I need to specify its location for rust-analyzer. Using .dir-locals.el with this content:
```lisp
((nil
. ((eglot-workspace-configuration
. (:rust-analyzer (:linkedProjects ["pkgs/rsblocks/Cargo.toml"]))))))
;; thank god it supports relative paths
```
does nothing: I see the variable value is set properly with `C-h v`, but Eglot doesn't seem to recognize it (`eglot-show-workspace-configuration` shows "null").
However, only when I set it globally, Eglot can apply the config to the language server.
Expected behaviour: like described in the manual, Eglot should recognize local values.
Possibly related report: https://github.com/joaotavora/eglot/issues/355 (unresolved)
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#74330: 29.4; Eglot ignores locally set configuration
2024-11-12 20:49 bug#74334: 29.4; Eglot ignores locally set configuration Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-12 21:34 ` João Távora
2024-11-13 8:03 ` bug#74334: " Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 6+ messages in thread
From: João Távora @ 2024-11-12 21:34 UTC (permalink / raw)
To: Acid Bong; +Cc: 74330
On Tue, Nov 12, 2024 at 8:49 PM Acid Bong <acidbong@tilde.club> wrote:
> ```lisp
> ((nil
> . ((eglot-workspace-configuration
> . (:rust-analyzer (:linkedProjects ["pkgs/rsblocks/Cargo.toml"]))))))
> ;; thank god it supports relative paths
> ```
> does nothing: I see the variable value is set properly with `C-h v`,
> but Eglot doesn't seem to recognize it (`eglot-show-workspace-configuration` shows "null").
What is the '...'preceding your excerpt of a structure?
Where are you executing C-h v? What file are you M-x eglot'int in?
Where are you running M-x eglot-show-worspace-configuration ?
What does M-: (project-current) RET show?
All these commands are highly dependent on context, so I think it's best if you
show a full recipe from Emacs -Q to clear these doubts. Only seeing part
of the repo structure isn't enough to really understand what's going on.
I really need to understand what you did (close to what keys you pressed)
until you got to the suprising effect. I have rust-analyzer (though I don't
have any suitable rust projects).
João
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#74334: 29.4; Eglot ignores locally set configuration
2024-11-12 20:49 bug#74334: 29.4; Eglot ignores locally set configuration Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-12 21:34 ` bug#74330: " João Távora
@ 2024-11-13 8:03 ` Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-13 8:39 ` João Távora
1 sibling, 1 reply; 6+ messages in thread
From: Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-13 8:03 UTC (permalink / raw)
To: 74334; +Cc: joaotavora
Ight, Joao, you accidentally created a new report, but i'll answer your questions under the original one.
> What is the '...'preceding your excerpt of a structure?
This is short for "other files that don't matter". Here's my repo
(https://codeberg.org/acidbong/nixos/src/commit/2d0eec312d83db0c685aa6de184d0477b0bf2041),
where I pushed my current state. The Cargo project is under /pkgs/rsblocks,
including .dir-locals.el.
> Where are you executing C-h v? What file are you M-x eglot'int in?
> Where are you running M-x eglot-show-worspace-configuration?
I'll describe all my actions:
1. open Emacs, it's in *scratch* and in ~:
- `eglot-workspace-configuration` is empty
2. `C-x p f ~/.config/nixos/pkgs/rsblocks/src/main.rs`:
- `e-w-c` (i'm abbreviating now, if you don't mind) now follows the content
in .dir-locals.el
3. `M-x eglot` in that exact main.rs:
- rust-analyzer complains that it can't find the workspace:
```
[eglot] Server reports (type=1): Failed to discover workspace.
Consider adding the `Cargo.toml` of the workspace to the [`linkedProjects`](https://rust-analyzer.github.io/manual.html#rust-analyzer.linkedProjects) setting.
Failed to load workspaces.
```
- `eglot-show-w-c` shows "null"
4. Go back to the *scratch*, type in (setq-default eglot-workspace-configuration '(that value))
and evaluate it with `C-x C-e`. Now the config is set globally.
5. Back to main.rs and `M-x eglot` once more:
- it launches and loads successfully
- `eglot-show-w-c` shows the config in JSON, and the config looks correct:
```
{
"rust-analyzer": {
"linkedProjects": [
"pkgs/rsblocks/Cargo.toml"
]
}
}
```
> What does M-: (project-current) RET show?
(vc Git "~/.config/nixos") ;; this is where I store my NixOS config
> All these commands are highly dependent on context, so I think it's best if you
> show a full recipe from Emacs -Q to clear these doubts.
I could replicate it with `emacs -Q`.
Speaking of `project-current`: I tried to follow the advices from
https://github.com/joaotavora/eglot/discussions/687 and add "Cargo.toml"
and "Cargo.lock" to `project-vc-extra-root-markers`, but `M-: (project-current)`
still shows "~/.config/nixos". Looks like project.el can't recognize nested
projects (both 0.9.8 and 0.11.0), but that's a whole different issue I don't care about.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#74334: 29.4; Eglot ignores locally set configuration
2024-11-13 8:03 ` bug#74334: " Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-13 8:39 ` João Távora
2024-11-13 9:45 ` Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 6+ messages in thread
From: João Távora @ 2024-11-13 8:39 UTC (permalink / raw)
To: Acid Bong; +Cc: 74334
On Wed, Nov 13, 2024 at 8:03 AM Acid Bong <acidbong@tilde.club> wrote:
>
> Ight, Joao, you accidentally created a new report, but i'll answer your questions under the original one.
Bug in tracker, likely you weren't vetted yet. Reply all usually
works and fetches the bug report. Who's Ight?
> Speaking of `project-current`: I tried to follow the advices from
> https://github.com/joaotavora/eglot/discussions/687 and add "Cargo.toml"
> and "Cargo.lock" to `project-vc-extra-root-markers`, but `M-: (project-current)`
> still shows "~/.config/nixos". Looks like project.el can't recognize nested
> projects (both 0.9.8 and 0.11.0), but that's a whole different issue I don't care about.
You probably should care because .dir-locals needs to exist in the
project root directory. Read the manual
https://joaotavora.github.io/eglot/#Project_002dspecific-configuration
"The most common way to set eglot-workspace-configuration is using a
.dir-locals.el file in the root of your project."
M-x eglot doesn't much care where inside a given project you start it. For
all it knows you could started it visiting ight.rs in your nixis dir and it'd
be the same.
João
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#74334: 29.4; Eglot ignores locally set configuration
2024-11-13 8:39 ` João Távora
@ 2024-11-13 9:45 ` Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-13 10:10 ` João Távora
0 siblings, 1 reply; 6+ messages in thread
From: Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-13 9:45 UTC (permalink / raw)
To: João Távora; +Cc: 74334
> On Wed, Nov 13, 2024 at 8:03 AM Acid Bong <acidbong@tilde.club> wrote:
>
> >
> > Ight, Joao, you accidentally created a new report, but i'll answer your questions under the original one.
> >
>
> Bug in tracker, likely you weren't vetted yet. Reply all usually
> works and fetches the bug report. Who's Ight?
>
It's short for "alright", sorry for confusing you.
>
> >
> > Speaking of `project-current`: I tried to follow the advices from
> > https://github.com/joaotavora/eglot/discussions/687 and add "Cargo.toml"
> > and "Cargo.lock" to `project-vc-extra-root-markers`, but `M-: (project-current)`
> > still shows "~/.config/nixos". Looks like project.el can't recognize nested
> > projects (both 0.9.8 and 0.11.0), but that's a whole different issue I don't care about.
>
> You probably should care because .dir-locals needs to exist in the
> project root directory. Read the manual
> https://joaotavora.github.io/eglot/#Project_002dspecific-configuration
> "The most common way to set eglot-workspace-configuration is using a
> .dir-locals.el file in the root of your project."
>
> M-x eglot doesn't much care where inside a given project you start it. For
> all it knows you could started it visiting ight.rs in your nixis dir and it'd
> be the same.
>
Woah, it actually works. Kinda weird that it requires .dir-locals.el to be in the
Git root, not in the Cargo root.
Thanks a lot
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#74334: 29.4; Eglot ignores locally set configuration
2024-11-13 9:45 ` Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-13 10:10 ` João Távora
0 siblings, 0 replies; 6+ messages in thread
From: João Távora @ 2024-11-13 10:10 UTC (permalink / raw)
To: Acid Bong; +Cc: 74334, 74334-done
On Wed, Nov 13, 2024 at 9:45 AM Acid Bong <acidbong@tilde.club> wrote:
> Woah, it actually works. Kinda weird that it requires .dir-locals.el to be in the
> Git root, not in the Cargo root.
It's weird, but only because having this particular project very deep inside
the only dir that Emacs knows how to automatically recognize as a
project is weird. Look into teaching project.el about "Cargo.toml" files,
it shouldn't be very hard.
You may or may not need "nested" projects, that's an orthogonal
issue. If you're sure you do need nested or complicated project
setups, look at [1])
João
[1]: https://github.com/joaotavora/eglot/discussions/1337#discussioncomment-8853117
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-13 10:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 20:49 bug#74334: 29.4; Eglot ignores locally set configuration Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-12 21:34 ` bug#74330: " João Távora
2024-11-13 8:03 ` bug#74334: " Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-13 8:39 ` João Távora
2024-11-13 9:45 ` Acid Bong via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-13 10:10 ` João Távora
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.