Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

fix: removes code lens for commented main functions#462

Merged
Vexu merged 3 commits into
ziglang:masterfrom
soorya-u:fix/commented-main-code-lens
Oct 12, 2025
Merged

fix: removes code lens for commented main functions#462
Vexu merged 3 commits into
ziglang:masterfrom
soorya-u:fix/commented-main-code-lens

Conversation

@soorya-u
Copy link
Copy Markdown
Contributor

@soorya-u soorya-u commented Oct 8, 2025

What it does?

  • Code Lens is not not visible on top of main function which is commented out

@Vexu
Copy link
Copy Markdown
Member

Vexu commented Oct 8, 2025

This causes the code lens to appear after the last comment instead of before the main function:
image

There is also a similar regex in zigTestRunnerProvider.ts with the same problem if you'd like to fix that as well.

@soorya-u
Copy link
Copy Markdown
Contributor Author

soorya-u commented Oct 9, 2025

I'm new to zig, so does zig support

test foo { }
// or
test @"foo" { }

The Test Explorer regex recognizes this syntax as a valid test, but the ZLS throws an error.

@Vexu
Copy link
Copy Markdown
Member

Vexu commented Oct 10, 2025

Both are valid syntax though the second will be normalized to the first by zig fmt. What error is ZLS giving you?

@soorya-u
Copy link
Copy Markdown
Contributor Author

const foo = "";

// valid
test foo { } 

// invalid: use of undeclared identifier 'bar'
test bar { }

I think the variable should be declared for this syntax. Im not sure though.

As for the PR, I think its working as intended now.

@Vexu
Copy link
Copy Markdown
Member

Vexu commented Oct 12, 2025

I think the variable should be declared for this syntax. Im not sure though.

Yes it has to be declared, it's a Doctest

@Vexu Vexu merged commit ecbd823 into ziglang:master Oct 12, 2025
1 check passed
@Vexu
Copy link
Copy Markdown
Member

Vexu commented Oct 15, 2025

This caused a small regression when there is no empty line before main

before:
image
after:
image

@soorya-u
Copy link
Copy Markdown
Contributor Author

soorya-u commented Oct 19, 2025

This caused a small regression when there is no empty line before main

before:
image
after:
image

Working on it. #464

@soorya-u soorya-u deleted the fix/commented-main-code-lens branch October 20, 2025 15:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants