Skip to content
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

Update util.rootpath to search all patterns per path => Fixes kotlin-ls root dir on multi-project builds #3321

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paulodiovani
Copy link

The function util.root_path loops first from a list of patterns and then searches for matching files on parent folders.

See https://github.com/paulodiovani/nvim-lspconfig/blob/a9bc587e9ae0cbcb3e90a2e9342f86b3b78c4408/lua/lspconfig/util.lua#L279-L281

This makes the pattern list have precedence over paths, often matching patterns on parent folders before closest ones.

The issue happens with Gradle Multi Project Builds using Kotlin LS as described at fwcd/kotlin-language-server#559.

This PR swaps the loops, making sure all patterns are searched on each dir before moving up the ladder.

⚠️ Since the change is on the util package, this may affect other LSP Servers.
If it breaks any of them I can find a solution for Kotlin LS alone.

@paulodiovani paulodiovani marked this pull request as draft September 27, 2024 23:30
@paulodiovani
Copy link
Author

PR converted to Draft to follow contributing guidelines.

util.root_path used to search each pattern on all parent directories,
  with this change it will look for all patterns on each parent dir,
  thus finding closest matchers first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant