-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LSP workspaces #5748
LSP workspaces #5748
Conversation
One thing I would like feedback on: Right now the The reason is that the global and the local configuration are not saved seperatly and therefore can only be reloaded together (so essentially calling |
e0aea89
to
ee0e2b2
Compare
rebased on master to resolve conflicts, the changes from #5420 actually make this PR a bit smaller/more elegant as the config can be accessed trough the document now. |
2d9c938
to
18e6239
Compare
5083fd1
to
8428f73
Compare
I expanded this PR to also fix #5852. The fundamental issue there was that the workspace root and the lsp root lookup were unified when these are really two separate functions. The LSP lookup always starts at the document while the workspace lookup should always start at the CWD. The LSP lookup should not look for the workspace root ( With the changes here the workspace lookup and the LSP root lookup are now separate. The workspace lookup just scans up the directory tree from The LSP root lookup searches for the topmost root_marker from the document. The file picker (and |
7a727f3
to
9a1fd78
Compare
While testing this further I noticed that the new solution wasn't working well because we just used the first root we encountered as the LSP workspace/root. The right solution here is to use one LSP workspace for each separate resolved root. This not just makes my new solution here viable but also fixes existing issues. Consider the following directory structure with two separate Cargo workspaces in the same git repo (not two crates, two seperate workspaces, there is no Cargo.toml in the repo root) :
If you open With this PR the workspaces are both added as an
Here the same problem as above would occur if the newly introduced config option was used. Whatever workspace gets opened first gets used and the other one doesn't work. With the latest commit the problem is fixed. While further testing this PR I noticed that RA was indexing a new workspace whenever I opened up a This is not desirable as dependencies are obviously not supposed to be part of the workspace.
While working on this I ran across #4436. Fixing that issue was easy by creating a special case if the current workspace resolved to the CWD because there is no Footnotes
|
fcc445a crashes on me with:
Steps:
|
Hi. Silly question. These commits are in the main branch yes ? To test, I simply have to pull ? |
git fetch origin pull/5748/head
git checkout FETCH_HEAD
cargo install --locked --path helix-term You will be in 'detached head' mode. You can also pull into a new branch with:
|
that's odd it works well with RA and shouldn't really be happening. Which LS are you using? |
Intelephense. I tried to verify by reproducing #5852 Edit: The situation you described at #5852 (comment) Update: Happens if I open a file within the nested I had previously changed php root markers to only Update: Still crashes with the following addition to [[language]]
name = "php"
roots = ["composer.lock"] I'll try to bisect (3b5bdbc) Update: Still crashing when reverted to 3b5bdbc (this time
|
c206e46
to
772e161
Compare
a6f6a26
to
b0dc708
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been running this for a while and it works great! I have some minor comments
7d57019
to
e3ce1a2
Compare
e3ce1a2
to
d437878
Compare
fixup documentation Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> fixup typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
fix typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
d437878
to
603e63d
Compare
@pascalkuthe is this still the behavior?
|
Supersedes #4439 and (mostly) #3207
Fixes: #3993
Fixes: #4436
fixes #5852
Closes #5919
The aim of this PR is primarily to address the problem from #4439 as described in #4439 (comment). As the solution described there uses a workspace config I ended up implementing support for that as well. The syntax I proposed in #4439 (comment) didn't quite work out as adding a new top-level header (that can be accessed in
helix-view
) like[workspace]
would have required more changes that didn't seem worth the effort here. Furthermore, the language specialization I proposed in my comment is incompatible with the toml standard (sadly). I ended up with the following solution:To force LSP to stop searching for roots in the
fuzz
folder you canadd the following
.helix/config.toml
file:To only apply this setting only to
rust
(but not other languages where this might cause problems) you can add the following.helix/languages.toml
file instead:To handle local config I originally wanted to pull in #3207, but when I started reviewing the changes there I quickly found many things that required changes so that I decided to reimplement the functionality here instead. Compared to #3207 this PR does not implement the security setting for workspace config. It's disabled by default anyway so that feature can be added as a separate followup PR (or #3207 could be rebased on this)
Furthermore, this PR correctly handles:
:config-reload
and:set
(would require larger refactor with feat: load local config #3207)helix-term/src/main.rs
and during config-reload/setFinally, this PR contains on breaking change: How
.helix
is treated. Currently, we simply merge all.helix/langauges.toml
from the CWD to the workspace root. This PR changes the workspace lookup so.helix
acts just like.git
. It's not intended for marking LSP roots (that's whatworkspace-roots
is for) but rather for cases where:git
As the workspace root search always stops at the first
.helix
directory, there is only a single.helix/config.toml
and.helix/languages.toml
, so the merging behavior is removed (breaking change I was talking about). In addition to the use-cases listed above this also ensure that it's always clear what theworkspace-roots
setting is referring to: A path relative to the parent of.helix
. When multiple configs are merged it can be quite confusing what these directories refer to otherwise. Finally, this behavior is also more inline with other editors (like.vscode
for VSCode).