Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triple slash reference types directive in typescript highlighted like regular comment #11001

Closed
1 task done
acalvino4 opened this issue Apr 25, 2024 · 2 comments
Closed
1 task done
Labels
defect [core label] editor Feedback for code editing, formatting, editor iterations, etc language An umbrella label for all programming languages syntax behaviors typescript TypeScript programming language support

Comments

@acalvino4
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Include a triple slash reference types directive in your typescript file

/// <reference types="vite/client" />

Observe the lack of syntax highlighting
image

Compared to vscode
image

Environment

Zed: v0.132.2 (Zed)
OS: macOS 14.4.1
Memory: 16 GiB
Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

@acalvino4 acalvino4 added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels Apr 25, 2024
@JosephTLyons JosephTLyons added typescript TypeScript programming language support language An umbrella label for all programming languages syntax behaviors editor Feedback for code editing, formatting, editor iterations, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Apr 25, 2024
@d1y
Copy link
Contributor

d1y commented Apr 26, 2024

Apply my patch it work 😁

image
diff --git a/crates/languages/src/typescript/injections.scm b/crates/languages/src/typescript/injections.scm
index 0df1691e7..b971afa92 100644
--- a/crates/languages/src/typescript/injections.scm
+++ b/crates/languages/src/typescript/injections.scm
@@ -1,5 +1,9 @@
 ((comment) @content
   (#set! "language" "jsdoc"))
 
+(((comment) @cx
+  (#match? @cx "^/// <reference types=\"\\S+\"\\s*/>$")) @content
+  (#set! "language" "html"))
+
 ((regex) @content
   (#set! "language" "regex"))

SomeoneToIgnore pushed a commit that referenced this issue Apr 29, 2024
luckydye pushed a commit to luckydye/zed that referenced this issue Apr 30, 2024
@JosephTLyons
Copy link
Contributor

This is now in 0.134.0-pre.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] editor Feedback for code editing, formatting, editor iterations, etc language An umbrella label for all programming languages syntax behaviors typescript TypeScript programming language support
Projects
None yet
Development

No branches or pull requests

3 participants