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

Add run test button #51

Closed

Conversation

Jarred-Sumner
Copy link
Contributor

This adds a "Run test" button above the test keyword.

  • It also enables the problem matcher to highlight any lines that caused semantic analysis to fail when building the test.
  • It adds a flag zig.testArgs to let you pass additional arguments to tests
  • It adds a flag zig.disableProblemMatcherForTest if you don't want the problem matcher to be enabled for tests
Screen.Recording.2021-05-23.at.6.03.58.PM.mov

Screenshot incase the video doesn't load:
image

It would be better to implement this via LSP, but I'm less familiar with that.

@Jarred-Sumner
Copy link
Contributor Author

@Vexu can you review

Copy link
Member

@Vexu Vexu left a comment

Choose a reason for hiding this comment

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

Even after fixing the type error, setting zig.disableProblemMatcherForTest to true doesn't seem to do anything.

Otherwise this works great!

"description": "Additional flags to pass \"zig test\""
},
"zig.disableProblemMatcherForTest": {
"type": "bool",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"type": "bool",
"type": "boolean",

This fixes the Incorrect type. Expected "bool". error when trying to use this setting.

Comment on lines +31 to +39
if (
was_newline &&
text.length > i + 4 &&
text[i] === "t" &&
text[i + 1] === "e" &&
text[i + 2] === "s" &&
text[i + 3] === "t" &&
(text[i + 4] === " " || text[i + 4] === "\n")
) {
Copy link
Member

Choose a reason for hiding this comment

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

This hardly seems like the best solution and breaks easily with badly formatted code:

test"foo" {}

test
"foo" {}

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.

2 participants