Skip to content

Conversation

@YuryKL
Copy link

@YuryKL YuryKL commented Dec 7, 2025

Adding functionality from github.com/YuryKL/textmate-datastar to the official extension.

I confirm that I have read the contribution guidelines and will include a clear explanation of the problem, solution, and alternatives for any proposed change in behavior.

Problem Statement

The VS-Code extension provides autocomplete via snippets, but has no syntax highlight for Datastar attributes and expressions making small typos harder to visually identify.

Proposed Solution

Integrate a TextMate grammar into the official extension to provide syntax highlighting in a wide variety of markup files alongside the existing snippet functionality. The highlights include:
The grammar provides color-coded highlighting for:

  • Datastar attribute structure (data-[plugin]:[key]__[modifier.arg])
  • Datastar expressions (signals with $, actions with @, + JS syntax)

Changes

  • Added datastar.injection.tmLanguage.json textmate grammar file
  • Added datastar.customAttributes configuration setting to highlight custom attribute plugins
  • Added grammar generation/regeneration logic into extension.js to watch for configuration updates

Alternatives Considered

Keep as seperate extensions: maintaining textmate-datastar as a standalone would avoid merging codebases, but users would need to install two extensions that may have different versions.
LSP: This is another option to get the same functionality in VS-Code but is much more complex to build/maintain.

Adding functionality from githun.com/YuryKL/textmate-datastar to the
official extension.
@bencroker
Copy link
Collaborator

Thanks so much for the PR! I‘ll review it in the coming days.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants