You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`@ast-grep/napi` supports all builtin languages listed [here](/reference/languages.html).
17
+
`@ast-grep/napi` supports JS ecosystem languages by default.
18
+
More custom languages can be loaded via [`registerDynamicLanguage`](https://github.com/search?q=repo%3Aast-grep%2Flangs%20registerDynamicLanguage&type=code).
18
19
19
20
#### Type
20
21
@@ -25,26 +26,15 @@ export const enum Lang {
25
26
Tsx='Tsx',
26
27
Css='Css',
27
28
TypeScript='TypeScript',
28
-
Bash='Bash',
29
-
C='C',
30
-
Cpp='Cpp',
31
-
CSharp='CSharp',
32
-
Go='Go',
33
-
Elixir='Elixir',
34
-
Haskell='Haskell',
35
-
Java='Java',
36
-
Json='Json',
37
-
Kotlin='Kotlin',
38
-
Lua='Lua',
39
-
Php='Php',
40
-
Python='Python',
41
-
Ruby='Ruby',
42
-
Rust='Rust',
43
-
Scala='Scala',
44
-
Swift='Swift'
45
29
}
30
+
31
+
// More custom languages can be loaded
32
+
// see https://github.com/ast-grep/langs
33
+
typeCustomLang=string& {}
46
34
```
47
35
36
+
`CustomLang` is not widely used now. If you have use case and needs support, please file an issue in the [@ast-grep/langs](https://github.com/ast-grep/langs?tab=readme-ov-file#packages) repository.
37
+
48
38
### Main functions
49
39
50
40
You can use `parse` to transform a string to ast-grep's main object `SgRoot`.
@@ -203,12 +193,12 @@ interface Edit {
203
193
*[Test Case Source](https://github.com/ast-grep/ast-grep/blob/main/crates/napi/__test__/index.spec.ts) for `@ast-grep/napi`
204
194
* ast-grep usage in [vue-vine](https://github.com/vue-vine/vue-vine/blob/b661fd2dfb54f2945e7bf5f3691443e05a1ab8f8/packages/compiler/src/analyze.ts#L32)
205
195
206
-
207
196
### Language Object (deprecated) <Badgetype="danger"text="Deprecated" />
208
197
198
+
:::details language objects are deprecated
199
+
209
200
`ast-grep/napi` also has special language objects for `html`, `js` and `css`. They are deprecated and will be removed in the next version.
0 commit comments