StyraInc / regal

Regal is a linter and language server for Rego, bringing your policy development experience to the next level!
https://docs.styra.com/regal
Apache License 2.0
248 stars 34 forks source link

lsp/completions: Snippets for built-in functions #916

Open charlieegan3 opened 1 month ago

charlieegan3 commented 1 month ago

Provide snippet completions for OPA built-in functions.

Similar to what we are providing for some, and every:

screenshot_2024-07-12_at_11 29 56.

Perhaps these could even be generated snippets?

anderseknert commented 1 month ago

While I'm not against this, I think it could be made somewhat moot once we implement signature help.

With that flow enabled, a user would first type a few letters to see completion suggestions for functions, then once they've picked one see a tooltip for each argument after ( and each , until they'd reach )... suggesting the name and type of the argument, and whatever else we might want to display there.

OTOH, snippets are nice in how you can tab between the args, and then finally tab to the next location. But since signature help is a "standard feature" of the language server protocol, I think I'd prefer to have us implement that first, and then see if we still think snippets add value on top of that 🙂