Skip to content

Changed default Project Root when build.zig not found#5090

Open
coffeebe4code wants to merge 6 commits intodense-analysis:masterfrom
coffeebe4code:master
Open

Changed default Project Root when build.zig not found#5090
coffeebe4code wants to merge 6 commits intodense-analysis:masterfrom
coffeebe4code:master

Conversation

@coffeebe4code
Copy link
Copy Markdown

Zig does not need a project root, but when viewing the std library, there is no build.zig. The current directory is fine for these purposes. zls remains quick on my linux machine.

Addresses this issue

@hsanson
Copy link
Copy Markdown
Contributor

hsanson commented Jan 25, 2026

There are linter issues that need fixing:

========================================
Running custom linting rules
========================================
Custom warnings/errors follow:

ale_linters/zig/zls.vim:10 Trailing whitespace
ale_linters/zig/zls.vim:11 Trailing whitespace
./ale_linters/zig/zls.vim:11 Line continuation should match previous indentation
./ale_linters/zig/zls.vim:11 Indentation should be 4 spaces
./ale_linters/zig/zls.vim:13 Indentation should be 4 spaces

return !empty(l:build_rs) ? fnamemodify(l:build_rs, ':h') : ''
return !empty(l:build_rs)
\ ? fnamemodify(l:build_rs, ':h')
\ : expand('#' . a:buffer . ':p:h')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with doing this is that ALE will launch an instance of the language server per project root, so you could end up with a lot of duplicate instances being launched. Is there some other project file we can look for to find the root of a Zig project, possibly including the .git directory?

#4993 I'll also mention this idea I pitched. I'll come back to that and finish it eventually in the future if others don't. I would like if if we always used the ale_root` option for setting the root of a project and skipping all filesystem searching so the project root is always configurable, including for the Python project root.

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.

3 participants