brotzeit / rustic

Rust development environment for Emacs
Apache License 2.0
719 stars 101 forks source link

Crates Excluded from Workspace Ignored by LSP #399

Open fredfortier opened 2 years ago

fredfortier commented 2 years ago

I have this Cargo.toml configuration:

[workspace]
members = [
    "a",
    "b",
]

exclude = ["c", "d"]

With this setting:

(setq rustic-compile-directory-method 'rustic-buffer-workspace)

Crates a and b work fine, the LSP finds the workspace as the project root. Crates c and d are excluded from the workspace. I'd expect the LSP to find their directory as the project root. However, running rust-analyzer-status on any of their sources suggests they are not being indexed.

Workspaces:
Loaded 486 packages across 1 workspace.

Analysis:
105mb of files
0b of index symbols (0)
7352 trees, 128 preserved
62030 trees, 128 preserved (Macros)
1549mb in total

File info:
Does not belong to any crate

Is this a know issue? Or the expected behavior? Can I override rustic-compile-directory-method per directory in.dir-locals.el`?

appetrosyan commented 2 years ago

+1

brotzeit commented 2 years ago

rustic-compile-directory-method is not related to lsp functionality, but makes use of code in compile.el.

lsp-rust-analyzer-status is a lsp-mode function and therefore provides rust-analyzer features. If lsp-rust-analyzer-status doesn't work the way you would expect, it's almost certainly a rust-analyzer issue.