Skip to content

feat: add shortcode completion provider#256

Merged
mcanouil merged 2 commits intomainfrom
feat/shortcode-completion
Feb 15, 2026
Merged

feat: add shortcode completion provider#256
mcanouil merged 2 commits intomainfrom
feat/shortcode-completion

Conversation

@mcanouil
Copy link
Copy Markdown
Owner

Summary

  • Add a shortcode parser (src/utils/shortcodeParser.ts) that tokenises Quarto {{< name key="value" >}} syntax and determines cursor context (name, argument, attribute key, or attribute value).
  • Add a completion provider (src/providers/shortcodeCompletionProvider.ts) that discovers shortcode schemas from installed extensions via SchemaCache and offers contextual completions for shortcode names, attribute keys, and attribute values.
  • Register the provider in src/extension.ts for the quarto language ID with space, =, and < as trigger characters.
  • Add Mocha tests (src/test/suite/shortcodeParser.test.ts) covering bounds detection, cursor context identification, quoted/unquoted values, multiline shortcodes, and edge cases.

Test plan

  • Verify shortcode parser tests pass via npm run test.
  • Verify TypeScript compiles without errors via npx tsc --noEmit.
  • Verify ESLint passes without warnings on changed files.
  • Open a .qmd file with installed extensions that have _schema.yml containing shortcode definitions, type {{< and confirm shortcode name completions appear.
  • After selecting a shortcode name, confirm attribute key completions appear.
  • After typing key=, confirm attribute value completions appear for enum-typed attributes.

Add a shortcode parser (shortcodeParser.ts) that tokenises Quarto
shortcode syntax ({{< name key="value" >}}) and determines cursor
context for driving completions.

Add a completion provider (shortcodeCompletionProvider.ts) that uses
SchemaCache to discover shortcode schemas from installed extensions
and offers contextual completions for shortcode names, attribute
keys, and attribute values.

Register the provider in extension.ts for the quarto language ID
with space, =, and < as trigger characters.

Include Mocha tests for the shortcode parser covering bounds
detection, cursor context identification, and various edge cases.
@mcanouil mcanouil added the Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses label Feb 15, 2026
@mcanouil mcanouil self-assigned this Feb 15, 2026
Base automatically changed from feat/schema-support to main February 15, 2026 16:50
@mcanouil mcanouil merged commit d0b43fe into main Feb 15, 2026
2 of 5 checks passed
@mcanouil mcanouil deleted the feat/shortcode-completion branch February 15, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant