-
Notifications
You must be signed in to change notification settings - Fork 380
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
Adding more hooks to FinishableLanguage #1443
Conversation
How about extending the hooks and having:
There are other hook points that we may come up with, but those are the most obvious ones. |
@achew22 Do you prefer a breaking change or simply move the call of |
@illicitonion Can you take another look? |
I have a strong preference for no breaking changes |
@achew22 I see only two options to make this not break:
Any other options? |
LGTM, thanks! I'm happy to adapt my (one) extension to whatever ends up happening, so I'm not concerned with compatibility (but understand there are compatibility concerns). |
@@ -59,8 +65,15 @@ var kinds = map[string]rule.KindInfo{ | |||
}, | |||
} | |||
|
|||
func (l *testFilegroupLang) Init(ctx context.Context) { |
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.
I thought we were going to rename this to Before
?
// Init is called before any calls to GenerateRules | ||
// This allows for hooks to be called, for instance to starting a background | ||
// server process. | ||
Init(ctx context.Context) |
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.
Same comment here. Am I reviewing the correct PR?
Superseded by #1475 |
What type of PR is this?
Feature
What package or component does this PR mostly affect?
cmd/gazelle
What does this PR do? Why is it needed?
DoneGeneratingRules()
is called before resolving dependencies. However, some Gazelle extensions (e.g., Python) needs to start server processes to parse Python files and query standard modules before generating rules, and shutdown those processes after dependency resolution. AddingBeforeGeneratingRules
andDoneResolvingDeps
hooks to manage these server processes.Other notes for review
This is a breaking change. Existing implementations of
FinishableLanguage
need to implement those two additional methods.