feat: delegate lsp to handle context command filtering - #743
Merged
Merged
Conversation
aseemxs
approved these changes
Mar 31, 2026
aseemxs
left a comment
Contributor
There was a problem hiding this comment.
Would be great if you can attach a demo/screenshot of performan improvement or provide a build to test.
ashishrp-aws
approved these changes
Mar 31, 2026
Contributor
Author
yep makes sense, provided via slack. |
This was referenced Apr 1, 2026
Will-ShaoHua
added a commit
that referenced
this pull request
Apr 2, 2026
Patch #743 ## Problem The VS Code extension host forwards webview messages to the language server using `sendNotification` for unhandled `aws/chat/*` methods (via the `default` case in `messages.ts`). However, `onFilterContextCommands` is registered as a **request** handler (`lspConnection.onRequest`). Since request handlers do not fire for notifications, the server-side context command filtering never executes. This means in large repos (80k+ files), the `@` context picker can only search the capped initial set of items pushed via `sendContextCommands` (1000 items). Files beyond the cap are invisible to the user's search. ## Solution Register both a **request** handler and a **notification** handler for `filterContextCommands` in `base-runtime.ts` and `baseChat.ts`. The request handler preserves compatibility with IDE hosts that use `sendRequest`. The notification handler covers VS Code's `sendNotification` path — it invokes the same filtering logic and pushes results back to the client via `sendContextCommands`. ## Flow ``` User types in @ picker -> mynah-ui dispatches CONTEXT_COMMAND_FILTER (after 200ms debounce) -> chat-client sends postMessage to extension host -> extension host default case: sendNotification('aws/chat/filterContextCommands', params) -> [NEW] server notification handler fires -> server scores/sorts ALL cached items (e.g. 212k in linux kernel) -> server pushes top 1000 results via sendContextCommands notification -> client store updates -> picker refreshes with full search results ``` ## e2e see Amazon-Q-Developer/language-servers#2682
Will-ShaoHua
pushed a commit
that referenced
this pull request
Apr 3, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>chat-client-ui-types: 0.1.70</summary> ## [0.1.70](chat-client-ui-types/v0.1.69...chat-client-ui-types/v0.1.70) (2026-04-02) ### Dependencies * The following workspace dependencies were updated * dependencies * @aws/language-server-runtimes-types bumped from ^0.1.63 to ^0.1.64 </details> <details><summary>language-server-runtimes: 0.3.16</summary> ## [0.3.16](language-server-runtimes/v0.3.15...language-server-runtimes/v0.3.16) (2026-04-02) ### Features * delegate lsp to handle context command filtering ([#743](#743)) ([8836c33](8836c33)) * delegate lsp to handle context command filtering ([#745](#745)) ([2c7174a](2c7174a)) ### Bug Fixes * bump node-forge to ^1.4.0 to resolve CVEs ([#746](#746)) ([c1cd1a4](c1cd1a4)) ### Dependencies * The following workspace dependencies were updated * dependencies * @aws/language-server-runtimes-types bumped from ^0.1.63 to ^0.1.64 </details> <details><summary>language-server-runtimes-types: 0.1.64</summary> ## [0.1.64](language-server-runtimes-types/v0.1.63...language-server-runtimes-types/v0.1.64) (2026-04-02) ### Features * delegate lsp to handle context command filtering ([#743](#743)) ([8836c33](8836c33)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In large repos (80k+ files), the
@context picker in Amazon Q's chat UI becomes unusable. The root cause is that the server sends all context command items to the webview in a singlesendContextCommandsnotification. This triggers:getValue()deep-clones the entire array)Result: multi-second freezes when pressing
@or typing in the context picker.Solution
Keep all items cached on the server. Only send a capped subset (≤1000 items) to the webview for the initial
@press. When the user types, a newfilterContextCommandsLSP request is sent to the server, which scores and filters all 80k items and returns the top 1000 matches.Flow
Screen.Recording.2026-03-31.at.11.25.53.AM.mov
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.