Skip to content

Add a searchable code-language picker #31

Closed

Description

@BinaryOutlook

Stage 3 — Layout and writing preferences

Synopsis

Replace the static clickable language list with a searchable picker that matches readable language names and existing aliases.

End goal

Users can quickly choose a code language by typing while preserving the code body and editing context.

Start after

No prerequisite issue. This work can start independently from freshly fetched origin/main; stage numbering does not require waiting for every earlier milestone. Use the repository's dedicated feature-branch/worktree workflow and record the actual base revision.

Current evidence

The current SUPPORTED_LANGUAGES list and alias mapping already exist, but the picker renders a static set of clickable items. Math and Mermaid entries currently perform special-block conversion and must retain explicit, tested behavior.

Source-inspected baseline: 19b276f3b819b9549e3a9e06d2dc967d8187ec06. Recheck the relevant code on the actual implementation base. No current runtime pass or implementation completion is claimed by this issue.

Agreed scope

  • Search human-readable names and aliases, including examples such as JS/JavaScript, C++/cpp, and C#/csharp.
  • Opening the picker should make typing useful immediately; provide keyboard navigation, confirmation, dismissal, and an understandable empty-result state.
  • Preserve an existing custom language identifier even when it is absent from suggestions.
  • Changing list ordering/pinning preferences is delivered separately; do not introduce usage tracking.

Acceptance criteria

  • Typing filters appropriate names/aliases and selecting a result updates the intended block and syntax highlighting.
  • Arrow keys, Enter, Escape, focus restoration, and accessible combobox/list semantics work without leaking keystrokes into the code body.
  • Opening, typing in, and canceling the picker do not mutate Markdown or undo; confirming an actual language change has correct undo/source behavior.
  • Existing custom/unknown languages are retained until deliberately changed, and the code body including whitespace remains intact.
  • The picker stays usable in narrow/short panes; Math/Mermaid conversions remain intentional and preserve their existing editing contracts.

Verification

  • Cover canonical names, aliases, case-insensitive matching, no match, existing custom languages, cancellation, and special-block choices.
  • Verify source switching, save/reopen, undo, and code-copy content after a selection.
  • Run production browser tests and smoke checks in both editor hosts.

Source pointers

  • src/webview/editor.js
  • src/webview/styles.css
  • src/i18n/locales
  • test/specs/codeblock-ui.spec.ts
  • test/specs/codeblock-lang-to-special-wrapper.spec.ts

Delivery contract

Implement the shared editor behavior in both VS Code and Electron. View-only settings/actions must preserve Markdown, selection/editing context, clean state, and undo history. For new or changed settings, keep host wiring, manifest descriptions, all supported translations, and documentation consistent. Preserve existing identifiers and defaults except for the deliberate changes specified above.

Work from the repository root using the Node version in .node-version and the maintained instructions in CONTRIBUTING.md, docs/building.md, and docs/testing/README.md; export changes also follow docs/export-verification.md. Run full compilation after webview JavaScript/CSS, shared-module, or translation changes, plus checks that exercise the changed behavior. Rebuild and reinstall for installed-extension evidence. Report failures/skips honestly; follow required CI and review gates. Update affected documentation and review any committed Markdown in source and rendered form.

Link the PR or investigation to this issue. Keep remediation on the same focused work item where practical. Completion requires the stated evidence and accepted outcome; opening a draft PR does not complete the issue. No deadline or assignee is imposed by this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions