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/hover: Show example links #906

Merged
merged 9 commits into from
Jul 11, 2024
Merged

Conversation

charlieegan3
Copy link
Member

Where examples to https://docs.styra.com/opa/rego-by-example are available, then show the links to these pages.

Screen.Recording.2024-07-09.at.14.10.08.mov

@charlieegan3 charlieegan3 force-pushed the hover-help branch 2 times, most recently from c9d34e4 to 2becf0f Compare July 9, 2024 14:29
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.

Good work here! It's late and I'm OOO, lol, but I left some comments to consider

bundle/regal/ast/keywords.rego Outdated Show resolved Hide resolved
bundle/regal/ast/keywords.rego Show resolved Hide resolved
bundle/regal/ast/keywords.rego Outdated Show resolved Hide resolved
bundle/regal/ast/keywords_test.rego Show resolved Hide resolved
internal/lsp/examples/index.json Show resolved Hide resolved
bundle/regal/ast/keywords.rego Outdated Show resolved Hide resolved
@charlieegan3
Copy link
Member Author

I think I've addressed everything here, I'll aim to merge tomorrow.

@charlieegan3
Copy link
Member Author

3a599f1 contains some fixes for head keywords.

Where examples to https://docs.styra.com/opa/rego-by-example
are available, then show the links to these pages.

Signed-off-by: Charlie Egan <[email protected]>
Signed-off-by: Charlie Egan <[email protected]>
Signed-off-by: Charlie Egan <[email protected]>
Results of benchmarking:

old median	28.986063
old mean	99.36704471
new median	20.632625
new mean	84.75417271

new	old
170.351834	165.913458
15.080667	18.174667
722.364416	14.838167
144.308166	40.304292
24.4045	22.223417
61.691458	548.937375
171.228291	349.011583
14.812834	19.470125
14.869208	18.471875
46.716167	78.956167
16.760459	15.528125
14.35275	15.014083
14.8865	35.748709
20.632625	48.546583
14.898875
25.510542
15.363084
70.541459
168.860167
17.247625
14.956

These results were tested by disabling all other keyword
rule heads and measuring the total time to get the list of
keywords in go.

Signed-off-by: Charlie Egan <[email protected]>
This is to be used when a list of expressions is needed in rules and for
keyword operations.

Signed-off-by: Charlie Egan <[email protected]>
@charlieegan3
Copy link
Member Author

I'm merging this in order to allow others to test all the new stuff ahead of a release next week.

@charlieegan3 charlieegan3 merged commit 1efd82c into StyraInc:main Jul 11, 2024
3 checks passed
@charlieegan3 charlieegan3 deleted the hover-help branch July 11, 2024 10:27
srenatus pushed a commit to srenatus/regal that referenced this pull request Oct 1, 2024
* lsp/hover: Show example links

Where examples to https://docs.styra.com/opa/rego-by-example
are available, then show the links to these pages.

Signed-off-by: Charlie Egan <[email protected]>

* Improve keyword performance

Signed-off-by: Charlie Egan <[email protected]>

* Remove comment

Signed-off-by: Charlie Egan <[email protected]>

* Tidy _determine_keywords for every

Signed-off-by: Charlie Egan <[email protected]>

* inst

* Improve if keyword performance

Results of benchmarking:

old median	28.986063
old mean	99.36704471
new median	20.632625
new mean	84.75417271

new	old
170.351834	165.913458
15.080667	18.174667
722.364416	14.838167
144.308166	40.304292
24.4045	22.223417
61.691458	548.937375
171.228291	349.011583
14.812834	19.470125
14.869208	18.471875
46.716167	78.956167
16.760459	15.528125
14.35275	15.014083
14.8865	35.748709
20.632625	48.546583
14.898875
25.510542
15.363084
70.541459
168.860167
17.247625
14.956

These results were tested by disabling all other keyword
rule heads and measuring the total time to get the list of
keywords in go.

Signed-off-by: Charlie Egan <[email protected]>

* Remove time stmt

* Add exprs rule to ast package

This is to be used when a list of expressions is needed in rules and for
keyword operations.

Signed-off-by: Charlie Egan <[email protected]>

* Handle values in heads

---------

Signed-off-by: Charlie Egan <[email protected]>
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.

2 participants