Skip to content

Commit 4b69def

Browse files
committed
tree-sitter for TypeScript
lem-project/lem#2101
1 parent d76746f commit 4b69def

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

content/en/development/tree-sitter.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ weight: -3
55

66
Lem integrates [tree-sitter](https://tree-sitter.github.io/tree-sitter/) for advanced syntax highlighting and indentation. Tree-sitter provides incremental parsing that can efficiently update syntax trees as you edit, enabling features that understand code structure rather than just patterns.
77

8+
## Supported Languages
9+
10+
The following modes have tree-sitter support:
11+
12+
| Language | Syntax Highlighting | Indentation |
13+
|----------|:------------------:|:-----------:|
14+
| TypeScript |||
15+
| JSON || - |
16+
| YAML || - |
17+
| Nix |||
18+
| Markdown || - |
19+
| WAT (WebAssembly Text) || - |
20+
821
## Overview
922

1023
The tree-sitter integration in Lem provides:
@@ -41,18 +54,6 @@ The integration consists of:
4154
| `lem-tree-sitter` | `extensions/tree-sitter/` | Core integration module |
4255
| Query files | `extensions/<mode>/tree-sitter/` | Per-language highlight/indent rules |
4356

44-
## Supported Languages
45-
46-
The following modes have tree-sitter support:
47-
48-
| Language | Syntax Highlighting | Indentation |
49-
|----------|:------------------:|:-----------:|
50-
| JSON || - |
51-
| YAML || - |
52-
| Nix |||
53-
| Markdown || - |
54-
| WAT (WebAssembly Text) || - |
55-
5657
## Adding Tree-sitter Support to a Mode
5758

5859
### Step 1: Create Query Files

content/en/modes/typescript.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ TypeScript is supported and enabled for the ".ts" and ".tsx" file
88
extensions. It relies on `typescript-language-server`, `typescript`
99
and `prettier` for auto formatting.
1010

11+
Syntax highlighting is done with tree-sitter and fallsback to a
12+
tmLanguage grammar if tree-sitter isn't available.
13+
1114
This is its default LSP configuration:
1215

1316
```lisp

0 commit comments

Comments
 (0)