-
Notifications
You must be signed in to change notification settings - Fork 35
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 Debug
Code Lens
#1103
Add Debug
Code Lens
#1103
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
.vscode/settings.json
Outdated
@@ -4,6 +4,7 @@ | |||
"OPA_EVAL_CAPABILITIES": "${workspacePath}/build/capabilities.json" | |||
}, | |||
"opa.roots": [ | |||
"${workspaceFolder}/lab", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related to the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, thanks! Removed. Although it is rather tricky to get it right with the "checkOnSave" feature when you want it outside of the main bundle but not the whole workspace... I'll guess I'll have to do some git magic to make sure this line remains unseen. I've removed it from the change now anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 😃
break | ||
} | ||
|
||
if len(params.Arguments) != 3 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see us reading arg 2
anywhere. Looks like it's the line number for regal.eval
, which I suppose we don't need for debug. Do we still need to assert its presence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you're right, we don't need to assert this here, but we're using the same outputs for both code lenses... and we'll want to check this to avoid getting out of bounds errors in case there aren't at least 2 args.
_debug_lenses contains { | ||
"range": location.to_range(result.ranged_location_from_text(input["package"]).location), | ||
"command": { | ||
"title": "Debug", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does vscode support emojis? If it does, we could prefix this with a '🪲' 😄.
There's probably plenty of setups where that would break, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking something like ►Evaluate
|🪲Debug
_debug_lenses contains _rule_lens(rule, "regal.debug", "Debug") if { | ||
some rule in ast.rules | ||
|
||
# no need to add a debug lens for a rule like `pi := 3.14`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Following the excellent work on debugger support by @johanfylling, this PR introduces a code lens for debugging, which triggers a command that simply returns a launch configuration where the package or rule clicked is set as the entrypoint. The code lens provider is now also rewritten in Rego. Signed-off-by: Anders Eknert <anders@styra.com>
d3f1164
to
822caf9
Compare
Following the excellent work on debugger support by @johanfylling, this PR introduces a code lens for debugging, which triggers a command that simply returns a launch configuration where the package or rule clicked is set as the entrypoint. The code lens provider is now also rewritten in Rego. Signed-off-by: Anders Eknert <anders@styra.com>
Following the excellent work on debugger support by @johanfylling, this PR introduces a code lens for debugging, which triggers a command that simply returns a launch configuration where the package or rule clicked is set as the entrypoint.
The code lens provider is now also rewritten in Rego.