qwen-code/packages/webui/src
易良 04afc610ea
fix(vscode-companion): slash command completion not triggering after message submit (#3609)
* fix(vscode-companion): slash command completion not triggering after message submit

After submitting a message, the input field is cleared with a zero-width
space (\u200B) to maintain contentEditable height. When the user then
types "/", the DOM content becomes "\u200B/" and the trigger character
lands at position 1 instead of 0. The word boundary check only recognized
regular space and newline, so the zero-width space was rejected as an
invalid boundary — preventing the completion popup from appearing.

Add \u200B to the valid word boundary characters so "/" and "@" triggers
work correctly after message submission without requiring an extra
backspace.

Closes #3592

* refactor(webui): extract zero-width space placeholder into shared constant

Replace scattered `\u200B` magic strings with a shared `ZERO_WIDTH_SPACE`
constant and `stripZeroWidthSpaces()` helper exported from @qwen-code/webui.

This also improves the slash command completion fix: instead of adding
\u200B to the word boundary check, strip it at the source in handleInput
(consistent with InputForm's onInput handler) and clamp the cursor
position to the stripped text length.

Closes #3592

* test: add tests for zero-width space handling and shouldSendMessage

- Add unit tests for ZERO_WIDTH_SPACE constant and stripZeroWidthSpaces
  helper (via @qwen-code/webui import)
- Add shouldSendMessage tests covering empty, whitespace, zero-width
  space, and attachment scenarios
- Add parseExportSlashCommand tests for zero-width space input

* fix(test): use correct ImageAttachment type in shouldSendMessage tests

Fix CI lint failure by providing all required ImageAttachment fields
(id, name, type, size, data, timestamp) instead of non-existent
mediaType property.
2026-04-26 22:27:54 +08:00
..
adapters feat(webui): add data adapter layer for ACP and JSONL protocols 2026-01-20 21:33:35 +08:00
components fix(vscode-companion): slash command completion not triggering after message submit (#3609) 2026-04-26 22:27:54 +08:00
context feat(webui): add webview container and isolate styles for VSCode integration 2026-01-17 10:53:32 +08:00
hooks fix(followup): prevent tool call UI leak and Enter accept buffer race (#2872) 2026-04-09 00:07:03 +08:00
styles feat(cli, webui): add follow-up suggestions feature (#2525) 2026-04-03 20:07:23 +08:00
types fix(webui): remove @qwen-code/qwen-code-core dependency (#2902) 2026-04-07 13:11:03 +08:00
utils fix(vscode-companion): slash command completion not triggering after message submit (#3609) 2026-04-26 22:27:54 +08:00
index.ts fix(vscode-companion): slash command completion not triggering after message submit (#3609) 2026-04-26 22:27:54 +08:00