Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clear-masks-improve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vortexlabs/kirari": patch
---

Highlight TypeScript enum declaration names as types.
2 changes: 1 addition & 1 deletion packages/kirari/src/tokenize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export function* scan(source: string, language: Language, start = 0, previous?:
else if (booleans.has(name)) type = 'boolean'
else if (nulls.has(name)) type = 'null'
// Built-in types, class names, and names in TypeScript type positions.
else if (types.has(name) || previous?.value === 'class' || typed && (context.annotation || previous?.type === 'keyword' && /^(type|interface)$/.test(previous.value))) type = 'type'
else if (types.has(name) || previous?.value === 'class' || typed && (context.annotation || previous?.type === 'keyword' && /^(type|interface|enum)$/.test(previous.value))) type = 'type'
else if ((previous?.value === '{' || previous?.value === ',') && nextVisibleChar(source, end) === ':') type = 'property' // { name: value }
else if (nextVisibleChar(source, end) === '(') type = 'function' // name(…)
// Look ahead for definitions such as `name = () => …` or `name: function () {}`.
Expand Down
11 changes: 11 additions & 0 deletions packages/kirari/test/corpus/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ export const corpus: readonly CorpusFixture[] = [
{ text: 'Parcel', type: 'type', occurrence: 1 },
],
},
{
id: 'typescript-enum-declaration-names', language: 'typescript',
source: 'enum Color { Red, Blue }\ndeclare enum D { Up }\ninterface I {}\nabstract class A {}\ntype K = string;',
assertions: [
{ text: 'enum', type: 'keyword', occurrence: 0 }, { text: 'Color', type: 'type' },
{ text: 'enum', type: 'keyword', occurrence: 1 }, { text: 'D', type: 'type' },
{ text: 'interface', type: 'keyword' }, { text: 'I', type: 'type' },
{ text: 'class', type: 'keyword' }, { text: 'A', type: 'type' },
{ text: 'type', type: 'keyword' }, { text: 'K', type: 'type' },
],
},
{
id: 'tsx-component-props', language: 'tsx',
source: 'const panel: unknown = <Notice tone="quiet" hidden={false} onOpen={() => reveal(record.id)}>Ready &amp; waiting</Notice>;',
Expand Down
9 changes: 9 additions & 0 deletions sites/docs/changelog/kirari/1.1.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
package: kirari
version: 1.1.1
date: 2026-10-21
---

### Bug fixes

- TypeScript enum declaration names are now highlighted as types, like class, interface, and type alias names.
8 changes: 7 additions & 1 deletion sites/docs/vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
"framework": "nextjs",
"installCommand": "cd ../.. && bun install --frozen-lockfile",
"buildCommand": "cd ../.. && bun run build",
"outputDirectory": ".next"
"outputDirectory": ".next",
"git": {
"deploymentEnabled": {
"**": false,
"main": true
}
}
}
Loading