Skip to content

Commit 213c23a

Browse files
NavarasuNavarasu
authored andcommitted
fix: restore missing @tag highlights for JSX/TSX/HTML (#254)
- Add @tag, @tag.builtin, @tag.attribute, @tag.delimiter highlights - Fixes broken syntax highlighting in JSX, TSX, HTML, and XML files - Tags display in purple, attributes in yellow - Add test files for TSX, TypeScript, and YAML - Add automated test for @tag highlights
1 parent adaa981 commit 213c23a

File tree

7 files changed

+167
-0
lines changed

7 files changed

+167
-0
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ Nothing yet!
1010

1111
---
1212

13+
## [v1.0.3] - 2025-11-24
14+
15+
### 🐛 Fixed
16+
17+
- **JSX/TSX/HTML highlighting broken** (#254)
18+
- Restored missing `@tag` highlight groups that were accidentally removed in v1.0.0
19+
- Fixed broken syntax highlighting in JSX, TSX, HTML, and XML files
20+
- Added `@tag`, `@tag.builtin`, `@tag.attribute`, and `@tag.delimiter` highlights
21+
- Tags now properly display in purple, attributes in yellow
22+
- Affected users were seeing degraded readability in React/TypeScript components
23+
24+
---
25+
1326
## [v1.0.2] - 2025-11-24
1427

1528
### 🐛 Fixed

lua/onedark/highlights.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ if vim.api.nvim_call_function("has", { "nvim-0.8" }) == 1 then
263263
["@string.special.symbol"] = colors.Cyan,
264264
["@string.special.url"] = {fg = c.cyan, fmt = 'underline'},
265265

266+
-- Tags (HTML, JSX, TSX, XML)
267+
["@tag"] = colors.Purple,
268+
["@tag.builtin"] = colors.Purple,
269+
["@tag.attribute"] = colors.Yellow,
270+
["@tag.delimiter"] = colors.Purple,
271+
266272
-- Types
267273
["@type"] = colors.Yellow,
268274
["@type.builtin"] = colors.Orange,

test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Test file:
2+
# Comment above class
3+
class Foo
4+
# Comment above method
5+
def bar
6+
# Comment inside method <-- THIS ONE
7+
x = 1
8+
end
9+
end

tests/automated/test_highlights.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,18 @@ else
179179
tests_failed = tests_failed + 1
180180
end
181181

182+
-- Test 11: Fix #254 - Tag highlights for JSX/TSX/HTML
183+
if test("Tag highlights exist (fix #254)", function()
184+
assert_highlight_exists("@tag")
185+
assert_highlight_exists("@tag.builtin")
186+
assert_highlight_exists("@tag.attribute")
187+
assert_highlight_exists("@tag.delimiter")
188+
end) then
189+
tests_passed = tests_passed + 1
190+
else
191+
tests_failed = tests_failed + 1
192+
end
193+
182194
-- Summary
183195
print("\n" .. string.rep("=", 60))
184196
print(string.format("Test Results: %d passed, %d failed", tests_passed, tests_failed))

tests/manual/test.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// TypeScript test file
2+
// Comment at the top
3+
4+
/**
5+
* Documentation comment for a function
6+
* @param name - The name parameter
7+
* @returns A greeting string
8+
*/
9+
function greet(name: string): string {
10+
// Comment inside function
11+
const greeting = `Hello, ${name}!`;
12+
return greeting;
13+
}
14+
15+
// Interface definition
16+
interface User {
17+
id: number;
18+
name: string;
19+
email: string;
20+
}
21+
22+
// Class with comments
23+
class UserManager {
24+
private users: User[] = [];
25+
26+
/**
27+
* Add a user to the list
28+
*/
29+
addUser(user: User): void {
30+
// Comment before operation
31+
this.users.push(user);
32+
}
33+
34+
// Get all users
35+
getUsers(): User[] {
36+
return this.users;
37+
}
38+
}
39+
40+
// Type alias
41+
type ID = string | number;
42+
43+
// Enum
44+
enum Status {
45+
Active,
46+
Inactive,
47+
Pending
48+
}
49+
50+
// Export statement
51+
export { greet, User, UserManager };

tests/manual/test.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React, { useState } from 'react';
2+
3+
// This is a comment in TypeScript
4+
interface Props {
5+
name: string;
6+
count: number;
7+
}
8+
9+
/**
10+
* Documentation comment for component
11+
*/
12+
function MyComponent({ name, count }: Props) {
13+
const [value, setValue] = useState(0);
14+
15+
// Comment inside function
16+
const handleClick = () => {
17+
setValue(value + 1);
18+
};
19+
20+
return (
21+
<div className="container">
22+
<h1>Hello {name}</h1>
23+
<p>Count: {count}</p>
24+
<button onClick={handleClick}>
25+
Click me: {value}
26+
</button>
27+
<CustomComponent prop="value" />
28+
</div>
29+
);
30+
}
31+
32+
// More comments
33+
const CustomComponent = ({ prop }: { prop: string }) => {
34+
return <span>{prop}</span>;
35+
};
36+
37+
export default MyComponent;

tests/manual/test.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# YAML configuration file
2+
# Comment at the top
3+
4+
name: My Application
5+
version: 1.0.0
6+
7+
# Server configuration
8+
server:
9+
host: localhost
10+
port: 8080
11+
# Nested comment
12+
ssl:
13+
enabled: true
14+
certificate: /path/to/cert.pem
15+
16+
# Database settings
17+
database:
18+
host: db.example.com
19+
port: 5432
20+
# Connection pool settings
21+
pool:
22+
min: 5
23+
max: 20
24+
25+
# Array of items
26+
features:
27+
- authentication
28+
- authorization
29+
- logging
30+
# - disabled-feature
31+
32+
# Multi-line string
33+
description: |
34+
This is a multi-line description
35+
that spans several lines
36+
and includes various details.
37+
38+
# Inline mapping
39+
metadata: { author: "John Doe", date: "2024-01-01" }

0 commit comments

Comments
 (0)