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", "debug test" and support a hotkey for re-running the last test #57

Closed
wants to merge 21 commits into from

Conversation

Jarred-Sumner
Copy link
Contributor

@Jarred-Sumner Jarred-Sumner commented Dec 24, 2021

This is a continuation of #51

I have been using this locally for months now. Note that the @link mention is outdated, it was removed in a subsequent commit.

This:

  • Adds a "Run test" and a "Debug test" button
  • Adds commands forzig.testArgs, zig.testCmd, zig.beforeDebugCmd

Debugging depends on the VSCode LLDB extension. Note that clicking the re-run arrow button currently does not recompile the test. This is an unfortunate side-effect of the VSCode LLDB integration. But, re-running it with a hotkey does do it

image

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.

Can you add some kind of a README on how to get the debug button to work? I wasn't able to figure it out.

@@ -1,4 +1,7 @@
out
node_modules
.vscode-test/
zig-cache
.DS_Store
Copy link
Member

Choose a reason for hiding this comment

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

.DS_Store belongs in your global .gitignore.

@@ -25,7 +25,7 @@ export function zigBuild(): void {
let extraArgs = config.get<string[]>("buildArgs");;
extraArgs.forEach(element => {
processArg.push(element);
});
});
Copy link
Member

Choose a reason for hiding this comment

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

Accidental whitespace removal?

if (token && token.isCancellationRequested) break;

const previousWord =
possibleTestKeyword > -1
Copy link
Member

Choose a reason for hiding this comment

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

Always true.

continue;
}

switch (text[possibleTestKeyword + 5].trimLeft()) {
Copy link
Member

Choose a reason for hiding this comment

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

Index out of bounds on "test<EOF>".


// test "foo"
// ^
if (text.length > possibleTestKeyword + 4) {
Copy link
Member

Choose a reason for hiding this comment

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

This is better than last time but it still only matches exactly test ".

It seems this would be really easy to correctly implement using Regex, just get the subslice between test and the next { and see if it matches /test\s*"(.+)"\s*{/.

@star-tek-mb
Copy link

star-tek-mb commented Nov 11, 2022

Hello. Any updates? Would be this merged by any chance?

Oh. I see it uses old VSCode API Codelenses i think. I have implemented it another way with vscode.TestController.

@scheibo
Copy link
Sponsor

scheibo commented Mar 10, 2023

@Jarred-Sumner I'd been happily using a version of this you built for me but with the merge of the vscode zls/zig extensions things understandably stopped working. Any chance you've got a version of this that you can share? (it made a big deal productively wise!) 😀

@Vexu
Copy link
Member

Vexu commented Apr 6, 2024

Closing as abandoned.

@Vexu Vexu closed this Apr 6, 2024
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.

None yet

4 participants