Skip to content

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

Open
coffeebe4code wants to merge 1 commit into
dense-analysis:masterfrom
coffeebe4code:master
Open

Changed default Project Root when build.zig not found#5090
coffeebe4code wants to merge 1 commit into
dense-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

hsanson commented Jan 25, 2026

Copy link
Copy Markdown
Contributor

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

Comment thread ale_linters/zig/zls.vim
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.

@coffeebe4code

Copy link
Copy Markdown
Author

I implemented the suggested change and rebased.

I am going to need to understand how to run these lints myself if I get blocked by the linter again.

@hsanson

hsanson commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

@coffeebe4code ALE comes with the custom linter so just enable it in your configuration and ALE will tell you about the linter errors:

linters = {
     vim = { "vint", "ale_custom_linting_rules" },
}

@w0rp

w0rp commented May 12, 2026

Copy link
Copy Markdown
Member

I'll sort this out and get it merged soonish as I have recently become a Zig-Zagger myself. 😃

@w0rp w0rp self-assigned this May 12, 2026
@w0rp

w0rp commented May 12, 2026

Copy link
Copy Markdown
Member

I'll paste this in every open PR: We finally managed to migrate CI checks for Windows from AppVeyor to GitHub Actions, and we've updated the minimum supported Vim version to 8.2. (Thought Vim 8.0 might happen to work for some.) In order to get checks to run again for a PR you'll need to rebase or merge.

@w0rp w0rp self-requested a review May 14, 2026 20:10
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