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

feat: send build events over grpc and new lsp cmd #3953

Merged
merged 5 commits into from
Jan 10, 2025

Conversation

wesbillman
Copy link
Collaborator

@wesbillman wesbillman commented Jan 9, 2025

Fixes #3925

This decoupling allows us to run the LSP independent of ftl dev. This means that our extensions can just start and stop the lsp whenever they want and it will pick up language server updates.

So now we can use VSCode with ftl without having it also start and stop the dev server.

This was referenced Jan 9, 2025
@wesbillman wesbillman force-pushed the build-engine-grpc-events branch from 6af259c to c898162 Compare January 9, 2025 22:48
@wesbillman wesbillman force-pushed the build-engine-grpc-events branch from c898162 to a91b5ad Compare January 9, 2025 23:27
@wesbillman wesbillman marked this pull request as ready for review January 9, 2025 23:28
@wesbillman wesbillman requested a review from alecthomas as a code owner January 9, 2025 23:28
Copy link
Contributor

@worstell worstell left a comment

Choose a reason for hiding this comment

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

so awesome

}

func (u *updatesService) StreamEngineEvents(ctx context.Context, req *connect.Request[buildenginepb.StreamEngineEventsRequest], stream *connect.ServerStream[buildenginepb.StreamEngineEventsResponse]) error {
events := make(chan *buildenginepb.EngineEvent, 64)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder about this case:

  • Start ftl dev in a terminal
  • Build engine fails to build a module, has code errors
  • IDE launches, connects to build engine for updates
  • IDE thinks everything is all good, rather than receiving the initial state

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this will def happen. And actually did happen before as well. :)

We might want to think about the lsp itself being about to trigger a build when it activates to get the current errors. I'm guessing other extensions might do something similar to get their initial state 🤔

}

if berr.Type == builderrors.COMPILER {
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be done buildengine side or LSP side? It feels LSP specific to me

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're totally right! I will remove this so that we can report all the errors 🤦


// Associate by filename.
for _, e := range buildErrors {
if e.Type == builderrors.COMPILER {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ah it is filtering on LSP side anyway

Copy link
Collaborator

@matt2e matt2e left a comment

Choose a reason for hiding this comment

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

Sweet!

default:
logger.Debugf("Connecting to build updates service")
if err := l.streamBuildEvents(ctx, client); err != nil {
logger.Debugf("Failed to connect to build updates service: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar logic to the comment about initial state in the stream, theres bad states that could arise here:
eg: errors were present in buildengine, lost connection / build engine dies, when we reconnect those errors may not be present anymore but the LSP wont be notified. Maybe we need to reset lsp state here.

@wesbillman wesbillman merged commit 87fd84e into main Jan 10, 2025
62 checks passed
@wesbillman wesbillman deleted the build-engine-grpc-events branch January 10, 2025 05:19
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.

See if we can make LSP snippets available even if ftl dev isn't running (via the VSCode extension)
3 participants