### Why are the changes in this PR needed?
The DAP debugger currently truncates variable values to a hardcoded
limit of 100 characters, with no way for callers to configure it.
Long values cannot be inspected or copied whole from a debugger UI.
### What are the changes in this PR?
- Add a new `SetMaxVariableLength` Debugger option (in both
`v1/debug` and the top-level `debug` package)
- A value of 0 disables truncation; the default stays 100 characters
for backward compatibility
- Plumb the limit through `variableManager` and `namedVar`, so it
applies to top-level and nested (object/array/set) variables alike
- Relax `truncatedString` to return the original string unchanged
when the limit is <= 0
- Add `TestTruncatedString` and `TestVariableValueLengthLimit`
covering the default limit, unlimited (0), negative, custom limits,
and boundary cases
### Notes
- `go build ./...` and `go test ./v1/debug/...` both pass
- Default behavior is unchanged; the new option is opt-in
- This PR was developed with AI assistance (Claude Code)
### Further comments
Refs #8890
---------
Signed-off-by: summy wu <summy.wu81@gmail.com>
All packages, except for `cmd` and `internal`, have been moved into a new `v1` root package.
Old packages are kept for backwards-compatibility reasons. All contained code is replaced with simple type aliases and proxy functions to `v1` implementations.
Old packages default to the Rego v0 syntax, new `v1` packages default to the Rego v1 syntax.
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
This isn't needed anymore, so now we don't.
Also enabled the copyloopvar linter in case we
accidentally do this in the future.
Signed-off-by: Anders Eknert <anders@styra.com>
* Debugger: allow YAML to be used as input
By using the unmarshal function from util instead of the stdlib
Signed-off-by: Anders Eknert <anders@styra.com>
* Adding test
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
---------
Signed-off-by: Anders Eknert <anders@styra.com>
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Co-authored-by: Johan Fylling <johan.dev@fylling.se>
The step-over action would previously skip over any associated partial "sibling" rules if performed on the last statement of a partial rule.
Now, step-over will break on any `enter` operation immediately preceded by an `exit` or `fail` operation; effectively breaking on every visited partial rule sharing a node in the rule-tree.
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
even when there are no explicit `input` and `data` documents.
This makes discoverability of the scopes much better, as users will know to expect them.
Whereas, if it's only enabled/visible when there is an actual document, a user who
has not come across it before might not realize it should appear, and can therefore
be slow to realize scenarios where their setup is expecting an `input` document, but
is missing it for some reason.
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
This three projects (VSCode OPA, nvim-dap-rego, and Regal) building on
this API, I've attempted to update the docs in the right places to
showcase these and their utility to rego authors.
Signed-off-by: Charlie Egan <charlie@styra.com>