-
Notifications
You must be signed in to change notification settings - Fork 37
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/server: Cache AllRegoVersions at config load #1325
lsp/server: Cache AllRegoVersions at config load #1325
Conversation
This does not reload when a .manifest file is changed yet. Signed-off-by: Charlie Egan <charlie@styra.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Terrific!
loadedConfigEnabledNonAggregateRules []string | ||
loadedConfigEnabledAggregateRules []string | ||
loadedConfigAllRegoVersions *concurrent.Map[string, ast.RegoVersion] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat :)
internal/lsp/server.go
Outdated
var versionedDirs []string | ||
|
||
// if we have no information, then we can return the default | ||
if l.loadedConfigAllRegoVersions == nil || l.loadedConfigAllRegoVersions.Len() == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should have Len() always return 0 when its parent is nil? It would make the check here a little cleaner.
return fmt.Sprintf("package %s\n\nimport rego.v1\n", pkg), nil | ||
} | ||
|
||
return fmt.Sprintf("package %s\n\n", pkg), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a47ab6d
fixed here!
Signed-off-by: Charlie Egan <charlie@styra.com>
* lsp/server: Cache AllRegoVersions at config load This does not reload when a .manifest file is changed yet. Signed-off-by: Charlie Egan <charlie@styra.com> * concurrent/map: Nil map is empty Signed-off-by: Charlie Egan <charlie@styra.com> --------- Signed-off-by: Charlie Egan <charlie@styra.com>
* lsp/server: Cache AllRegoVersions at config load This does not reload when a .manifest file is changed yet. Signed-off-by: Charlie Egan <charlie@styra.com> * concurrent/map: Nil map is empty Signed-off-by: Charlie Egan <charlie@styra.com> --------- Signed-off-by: Charlie Egan <charlie@styra.com>
This does not reload when a .manifest file is changed yet.