Skip to content

codemirror: Fix suggestions snippet behavior

Warren Gifford requested to merge fkling/cm/38254-fix-suggestion-snippets into main

Created by: fkling

Fixes #38254 (closed)

Tabbing from the last field in a snippet causes the input to loose focus. CodeMirror only overwrites the Tab key behavior for any but the last placeholder field in the snippet. The simple solution is to always append an empty placeholder field at the end of the snippet. This replicates Monaco's behavior.

Behavior after the fix (see issue for before behavior):

https://user-images.githubusercontent.com/179026/177419522-7252d8a9-100e-4631-bd37-6b7572806d34.mp4

Test plan

  • Trigger suggestions for repo: filter (no filter value)
  • Select a predicate with a single placeholder field (e.g. contains.commit.before(...))
  • Pressing the Tab key should move focus after the filter, not outside the query input

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading