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

lsp: Provide data ref completions in rules #769

Merged
merged 1 commit into from
May 29, 2024

Conversation

charlieegan3
Copy link
Member

@charlieegan3 charlieegan3 commented May 29, 2024

Fixes: #753

Screen.Recording.2024-05-29.at.12.17.08.mov

Fixes: StyraInc#753

Signed-off-by: Charlie Egan <charlie@styra.com>
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! 👏

// we are not interested in packages here, only the rules
for uri, refs := range c.GetAllFileRefs() {
for _, ref := range refs {
// we are not interested in packages here, only rules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there are a few cases where you might want to refer to a package even in a rule body, like when doing dynamic policy composition:

some policy
some decision in data.policies[policy].deny

and so on... but I guess that's uncommon enough that it's still better to only suggest rules as a default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that is a thought. I guess this provide is called rulers and is already quite complex. I'd like to consider that for a new provider.

Issue here: #771

symbol = completion.Function
detail = "Function"
case ref.Description == "Partial":
detail = "Partial path suggestion, continue typing for more suggestions."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

@charlieegan3 charlieegan3 merged commit 48aa1db into StyraInc:main May 29, 2024
3 checks passed
srenatus pushed a commit to srenatus/regal that referenced this pull request Oct 1, 2024
Fixes: StyraInc#753

Signed-off-by: Charlie Egan <charlie@styra.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Completions: provide suggestions for data paths
2 participants