Skip to content

Enhance Svelte syntax highlighting and markdown support#81

Open
realfakenerd wants to merge 4 commits into
zed-extensions:mainfrom
realfakenerd:improve-syntax-and-highlight
Open

Enhance Svelte syntax highlighting and markdown support#81
realfakenerd wants to merge 4 commits into
zed-extensions:mainfrom
realfakenerd:improve-syntax-and-highlight

Conversation

@realfakenerd

Copy link
Copy Markdown
Contributor

Description

This PR refines Tree-sitter queries (outline.scm, highlights.scm, and injections.scm) to make editor navigation and syntax highlighting significantly cleaner and more precise.

Changes

1. Markdown Injection for Component Docs (languages/svelte/injections.scm)

  • Resolved the downstream TODO by injecting the markdown parser into HTML comment blocks that contain the @component directive, enabling rich text highlighting inside component documentation.

2. Structural & Clean Code Navigation (languages/svelte/outline.scm)

  • HTML Noise Reduction: Filtered out generic HTML tags (e.g., div, span, p) from the Symbol Outline panel.
  • Component Focus: Modified queries to exclusively track Svelte Components (names starting with uppercase letters ^[A-Z]).
  • Framework Structural Blocks: Added native <svelte:*> tags and missing framework logical statements like key_statement ({#key ...}) to ensure proper workspace indexing.

3. High-Contrast Syntax Highlighting (languages/svelte/highlights.scm)

  • Native Framework Elements: Mapped <svelte:*> built-in structural tags (like <svelte:head>) to @keyword so they stand out visually from standard HTML tags.
  • Functional Directives: Isolated core Svelte element directives (bind:, on:, class:, use:, etc.) using regex and styled them as @keyword to cleanly differentiate logic from static markup.

@cla-bot cla-bot Bot added the cla-signed label Jun 9, 2026

@ghostdevv ghostdevv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, looks like CI is failing if you could take a look? If possible can you also include some before/after screenshots?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants