Skip to content

fix: prevent request failure notification spam for new files in lazy loader#1202

Merged
joerdav merged 1 commit intoa-h:mainfrom
prathshenoy:code-action-spam-notify
Jun 24, 2025
Merged

fix: prevent request failure notification spam for new files in lazy loader#1202
joerdav merged 1 commit intoa-h:mainfrom
prathshenoy:code-action-spam-notify

Conversation

@prathshenoy
Copy link
Copy Markdown
Contributor

@prathshenoy prathshenoy commented Jun 24, 2025

When a new Templ file is created, it can take a moment for GOPACKAGESDRIVER to detect that the file belongs to a specific Go package—typically after the package clause is added at the top of the file.

Until this happens, any requests that depend on package context, such as textDocument/codeAction, are likely to fail. This isn't a problem in isolation, but when a user creates a new file and starts typing before the package is recognized, the client continues to send textDocument/codeAction requests on each keystroke. Since the server can't resolve the file's package, each request fails, and the user is bombarded with failure notifications in VS Code, which quickly becomes annoying.

To avoid this, ignore textDocument/codeAction requests for Templ files that haven't yet been loaded by the lazy loader.

@prathshenoy prathshenoy changed the title fix: prevent request failure notification spam for new files fix: prevent request failure notification spam for new files in lazy loader Jun 24, 2025
@joerdav
Copy link
Copy Markdown
Collaborator

joerdav commented Jun 24, 2025

Great, this all looks good. Thanks as always for the contribution.

@joerdav joerdav merged commit 9ad7ba1 into a-h:main Jun 24, 2025
5 checks passed
@prathshenoy prathshenoy deleted the code-action-spam-notify branch June 24, 2025 14:35
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