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

Implement "inline value" #675

Open
anderseknert opened this issue Apr 23, 2024 · 0 comments
Open

Implement "inline value" #675

anderseknert opened this issue Apr 23, 2024 · 0 comments

Comments

@anderseknert
Copy link
Member

As per spec: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlineValue

This feature allows the language server to return a list of values that should be presented to the right of a line in the editor, presumably from evaluation results. It is not entirely clear to me what events in the client may trigger this request to be sent. I guess it's related to evaluation / debugging, but LSP doesn't do that on it's own... so first thing to figure out here is how to work with this.

Next step is of course to provide some actual values. @johanfylling is looking into having values provided in test assertion failures, which would potentially allow us to piggyback on this in Regal, should bindings be provided in the trace output of evaluation. If that was the case, we could trigger an evaluation from the client (given the input.json file in the workspace or whatever) and have each value(s) from the eval displayed on the line of the binding.

While this requires changes to OPA, there's an interesting intermediate step we could explore, where we don't yet provide values per line but per rule. This could be accomplished today already by simply evaluating the whole data document and see what comes back. For each rule evaluated, we'd display the result to the right of the rule, or undefined if it wasn't present in the result. There are a few caveates here, like not being able to differentiate the result of rules defined incrementally, etc... but I believe this already could provide a massive boost to the Rego debugging experience in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: TODO
Development

No branches or pull requests

1 participant