Repository navigation
lsp/eval: Implement selection evaluation - #2104
Merged
Merged
Conversation
charlieegan3
force-pushed
the
eval-selection
branch
from
September 30, 2026 12:37
6cff168 to
1fb0a39
Compare
Contributor
|
Is this available to over LSP clients as-is? Or do they need special wrapper code like vscode-opa? |
This makes it possible evaluate an editor selection rather than a rule/pkg. Signed-off-by: Charlie Egan <charlie_egan@apple.com>
charlieegan3
force-pushed
the
eval-selection
branch
from
September 30, 2026 12:41
1fb0a39 to
4e853a8
Compare
Contributor
Author
|
Yeah this needs a special wrapper to run evaluation as a custom command. |
anderseknert
approved these changes
Oct 1, 2026
| // - 1 = x -> 1, resolved from the right-hand side: "=" can bind either side. | ||
| // - [a, b] := [1, 2] -> true, the raw expression value: neither side is a plain | ||
| // variable, so there is no single bound value to return. | ||
| func finalExpressionValue(body ast.Body, result rego.Result) any { |
Member
There was a problem hiding this comment.
Do we not know for certain that the result returned here will be an ast.Value (or possibly *ast.Term)?
I hope our eval machinery prevents the default AST -> Go "JSON" values transform, because if it doesn't, it should 😄 If so it would be nice if we made that type assertion in this function and rather had it return a Value (or again, a term pointer if that's what we get back).
Contributor
Author
There was a problem hiding this comment.
Will look into this and consider a follow on.
Merged
via the queue into
open-policy-agent:main
with commit Oct 1, 2026
d50b317
10 of 11 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes it possible evaluate an editor selection rather than a rule/pkg.
See open-policy-agent/vscode-opa#504 for UI example.