aws-toolkit-vscode: amazonq: project context: "rejectCodeSuggestion not found" after ctrl-z

Problem

Steps to reproduce the issue

  1. Haven’t figure out the pattern
  2. Be editing with vim/nvim mode enabled, maybe a linter/formatter or two. Trunk.io can be heavy, especially if both are security scanning (Q was turned off for security)
  3. Crashes with the notification (paraphrased) “command aws.amazonq.rejectCodeSuggestion’ not found”
  4. Some after will find any question complex and out of its domain knowledge

Point four is likely not related yet amusing that the action of crashing is almost a reset.

Expected behavior

Stays “alive”. Remembers context it was part of in the chat, and doesn’t take over the screen with a long running loop.

System details (run AWS: About and/or Amazon Q: About)

  • OS: macOS 14.5
  • Visual Studio Code version:
Version: 1.91.1
Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:07:46.768Z (2 wks ago)
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0
  • AWS Toolkit version: N/A don’t use bundled
  • Amazon Q version:
Amazon Q v1.17.0
Published
2024-04-03, 08:40:29
Last released
2024-07-25, 13:24:54
Last updated
2024-07-26, 11:47:41
Identifier
amazonwebservices.amazon-q-vscode

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Fetched context from …

This implies that you have enabled the amazonQ.workspaceIndex setting, can you confirm? Is it reproducible if that setting is disabled?

image

I was able to reproduce the aws.amazonq.rejectCodeSuggestion not found issue by doing below steps:

  1. Install Vim
  2. Trigger a code suggestion from Amazon Q.
  3. Press tab to accept it.
  4. Press Ctrl + Z to revoke the acceptance, then you will see the inline suggestion shown again.
  5. Press Esc to reject it, then you will see aws.amazonq.rejectCodeSuggestion not found.

In fact this is reproducible even without Vim. The root cause is the Ctrl + Z reverted the editor states and brought back the inline suggestions while the command override subscriptions were not brought back.

During testing, I reproduced the crashing issue using Vim.

  1. Install Vim.
  2. Trigger a Q suggestion.
  3. Press left or right arrow, then the suggestion does not navigate to next, previous suggestion, instead the cursor moves. After this, I am not getting code suggestions unless after sometime or certain conditions. The root cause to this is: Vim override the left right keybindings https://github.com/VSCodeVim/Vim/blob/89cf2d0356966303dc1bac7ce40eaef167d44088/package.json#L123 The keybinding override was somehow ranked as a higher priority item than Q left right navigation buttons.

Before we have a fix, you can change the keybinding of editor.action.inlineSuggest.showNext to something not like right arrow key to avoid such keybinding conflict. You can also change keybinding of extension.vim_right to avoid such conflict which caused crashing. I was able to make Q working after fixing these keybinding conflict.