src-mcp 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +721 -0
  3. package/assets/languages.json +219 -0
  4. package/assets/queries/_javascript/highlights.scm +36 -0
  5. package/assets/queries/_javascript/locals.scm +14 -0
  6. package/assets/queries/_javascript/tags.scm +88 -0
  7. package/assets/queries/_jsx/highlights.scm +43 -0
  8. package/assets/queries/_jsx/indents.scm +6 -0
  9. package/assets/queries/_jsx/textobjects.scm +7 -0
  10. package/assets/queries/_typescript/highlights.scm +148 -0
  11. package/assets/queries/_typescript/indents.scm +5 -0
  12. package/assets/queries/_typescript/locals.scm +34 -0
  13. package/assets/queries/_typescript/tags.scm +23 -0
  14. package/assets/queries/_typescript/textobjects.scm +12 -0
  15. package/assets/queries/c/highlights.scm +167 -0
  16. package/assets/queries/c/indents.scm +51 -0
  17. package/assets/queries/c/injections.scm +2 -0
  18. package/assets/queries/c/locals.scm +38 -0
  19. package/assets/queries/c/rainbows.scm +29 -0
  20. package/assets/queries/c/tags.scm +9 -0
  21. package/assets/queries/c/textobjects.scm +27 -0
  22. package/assets/queries/c_sharp/highlights.scm +208 -0
  23. package/assets/queries/c_sharp/injections.scm +2 -0
  24. package/assets/queries/c_sharp/tags.scm +21 -0
  25. package/assets/queries/c_sharp/textobjects.scm +20 -0
  26. package/assets/queries/cpp/highlights.scm +177 -0
  27. package/assets/queries/cpp/indents.scm +3 -0
  28. package/assets/queries/cpp/injections.scm +4 -0
  29. package/assets/queries/cpp/rainbows.scm +49 -0
  30. package/assets/queries/cpp/tags.scm +12 -0
  31. package/assets/queries/cpp/textobjects.scm +7 -0
  32. package/assets/queries/ecma/highlights.scm +288 -0
  33. package/assets/queries/ecma/indents.scm +28 -0
  34. package/assets/queries/ecma/injections.scm +100 -0
  35. package/assets/queries/ecma/locals.scm +26 -0
  36. package/assets/queries/ecma/rainbows.scm +28 -0
  37. package/assets/queries/ecma/textobjects.scm +45 -0
  38. package/assets/queries/go/highlights.scm +236 -0
  39. package/assets/queries/go/indents.scm +40 -0
  40. package/assets/queries/go/injections.scm +92 -0
  41. package/assets/queries/go/locals.scm +25 -0
  42. package/assets/queries/go/rainbows.scm +33 -0
  43. package/assets/queries/go/tags.scm +30 -0
  44. package/assets/queries/go/textobjects.scm +33 -0
  45. package/assets/queries/html/highlights.scm +47 -0
  46. package/assets/queries/html/injections.scm +10 -0
  47. package/assets/queries/html/rainbows.scm +13 -0
  48. package/assets/queries/html/textobjects.scm +9 -0
  49. package/assets/queries/java/highlights.scm +227 -0
  50. package/assets/queries/java/indents.scm +35 -0
  51. package/assets/queries/java/injections.scm +2 -0
  52. package/assets/queries/java/rainbows.scm +35 -0
  53. package/assets/queries/java/tags.scm +27 -0
  54. package/assets/queries/java/textobjects.scm +44 -0
  55. package/assets/queries/javascript/highlights.scm +3 -0
  56. package/assets/queries/javascript/indents.scm +3 -0
  57. package/assets/queries/javascript/injections.scm +3 -0
  58. package/assets/queries/javascript/locals.scm +3 -0
  59. package/assets/queries/javascript/rainbows.scm +1 -0
  60. package/assets/queries/javascript/tags.scm +3 -0
  61. package/assets/queries/javascript/textobjects.scm +3 -0
  62. package/assets/queries/jsx/highlights.scm +3 -0
  63. package/assets/queries/jsx/indents.scm +3 -0
  64. package/assets/queries/jsx/injections.scm +3 -0
  65. package/assets/queries/jsx/locals.scm +3 -0
  66. package/assets/queries/jsx/rainbows.scm +9 -0
  67. package/assets/queries/jsx/tags.scm +3 -0
  68. package/assets/queries/jsx/textobjects.scm +3 -0
  69. package/assets/queries/kotlin/folds.scm +17 -0
  70. package/assets/queries/kotlin/highlights.scm +330 -0
  71. package/assets/queries/kotlin/indents.scm +44 -0
  72. package/assets/queries/kotlin/injections.scm +42 -0
  73. package/assets/queries/kotlin/locals.scm +23 -0
  74. package/assets/queries/kotlin/tags.scm +12 -0
  75. package/assets/queries/kotlin/textobjects.scm +45 -0
  76. package/assets/queries/ocaml/highlights.scm +151 -0
  77. package/assets/queries/ocaml/indents.scm +12 -0
  78. package/assets/queries/ocaml/injections.scm +2 -0
  79. package/assets/queries/ocaml/locals.scm +24 -0
  80. package/assets/queries/php/highlights.scm +319 -0
  81. package/assets/queries/php/indents.scm +18 -0
  82. package/assets/queries/php/injections.scm +25 -0
  83. package/assets/queries/php/rainbows.scm +15 -0
  84. package/assets/queries/php/tags.scm +26 -0
  85. package/assets/queries/php/textobjects.scm +52 -0
  86. package/assets/queries/python/highlights.scm +308 -0
  87. package/assets/queries/python/indents.scm +84 -0
  88. package/assets/queries/python/injections.scm +14 -0
  89. package/assets/queries/python/locals.scm +50 -0
  90. package/assets/queries/python/rainbows.scm +30 -0
  91. package/assets/queries/python/tags.scm +14 -0
  92. package/assets/queries/python/textobjects.scm +35 -0
  93. package/assets/queries/ruby/highlights.scm +191 -0
  94. package/assets/queries/ruby/indents.scm +24 -0
  95. package/assets/queries/ruby/injections.scm +35 -0
  96. package/assets/queries/ruby/locals.scm +20 -0
  97. package/assets/queries/ruby/rainbows.scm +28 -0
  98. package/assets/queries/ruby/tags.scm +64 -0
  99. package/assets/queries/ruby/textobjects.scm +56 -0
  100. package/assets/queries/rust/highlights.scm +514 -0
  101. package/assets/queries/rust/indents.scm +148 -0
  102. package/assets/queries/rust/injections.scm +170 -0
  103. package/assets/queries/rust/locals.scm +28 -0
  104. package/assets/queries/rust/rainbows.scm +60 -0
  105. package/assets/queries/rust/tags.scm +26 -0
  106. package/assets/queries/rust/textobjects.scm +85 -0
  107. package/assets/queries/scala/highlights.scm +267 -0
  108. package/assets/queries/scala/indents.scm +22 -0
  109. package/assets/queries/scala/injections.scm +16 -0
  110. package/assets/queries/scala/locals.scm +14 -0
  111. package/assets/queries/scala/textobjects.scm +65 -0
  112. package/assets/queries/svelte/folds.scm +13 -0
  113. package/assets/queries/svelte/highlights.scm +38 -0
  114. package/assets/queries/svelte/indents.scm +24 -0
  115. package/assets/queries/svelte/injections.scm +46 -0
  116. package/assets/queries/svelte/locals.scm +1 -0
  117. package/assets/queries/swift/highlights.scm +200 -0
  118. package/assets/queries/swift/indents.scm +100 -0
  119. package/assets/queries/swift/injections.scm +10 -0
  120. package/assets/queries/swift/locals.scm +19 -0
  121. package/assets/queries/swift/rainbows.scm +60 -0
  122. package/assets/queries/swift/textobjects.scm +23 -0
  123. package/assets/queries/tsx/highlights.scm +3 -0
  124. package/assets/queries/tsx/indents.scm +3 -0
  125. package/assets/queries/tsx/injections.scm +3 -0
  126. package/assets/queries/tsx/locals.scm +3 -0
  127. package/assets/queries/tsx/rainbows.scm +2 -0
  128. package/assets/queries/tsx/tags.scm +3 -0
  129. package/assets/queries/tsx/textobjects.scm +3 -0
  130. package/assets/queries/typescript/highlights.scm +3 -0
  131. package/assets/queries/typescript/indents.scm +3 -0
  132. package/assets/queries/typescript/injections.scm +3 -0
  133. package/assets/queries/typescript/locals.scm +3 -0
  134. package/assets/queries/typescript/rainbows.scm +19 -0
  135. package/assets/queries/typescript/tags.scm +3 -0
  136. package/assets/queries/typescript/textobjects.scm +3 -0
  137. package/assets/wasm/tree-sitter-c.wasm +0 -0
  138. package/assets/wasm/tree-sitter-c_sharp.wasm +0 -0
  139. package/assets/wasm/tree-sitter-cpp.wasm +0 -0
  140. package/assets/wasm/tree-sitter-go.wasm +0 -0
  141. package/assets/wasm/tree-sitter-html.wasm +0 -0
  142. package/assets/wasm/tree-sitter-java.wasm +0 -0
  143. package/assets/wasm/tree-sitter-javascript.wasm +0 -0
  144. package/assets/wasm/tree-sitter-kotlin.wasm +0 -0
  145. package/assets/wasm/tree-sitter-ocaml.wasm +0 -0
  146. package/assets/wasm/tree-sitter-php.wasm +0 -0
  147. package/assets/wasm/tree-sitter-python.wasm +0 -0
  148. package/assets/wasm/tree-sitter-ruby.wasm +0 -0
  149. package/assets/wasm/tree-sitter-rust.wasm +0 -0
  150. package/assets/wasm/tree-sitter-scala.wasm +0 -0
  151. package/assets/wasm/tree-sitter-svelte.wasm +0 -0
  152. package/assets/wasm/tree-sitter-swift.wasm +0 -0
  153. package/assets/wasm/tree-sitter-tsx.wasm +0 -0
  154. package/assets/wasm/tree-sitter-typescript.wasm +0 -0
  155. package/dist/bin.d.ts +3 -0
  156. package/dist/bin.d.ts.map +1 -0
  157. package/dist/bin.js +4 -0
  158. package/dist/bin.js.map +1 -0
  159. package/dist/cli/adapter.d.ts +7 -0
  160. package/dist/cli/adapter.d.ts.map +1 -0
  161. package/dist/cli/adapter.js +39 -0
  162. package/dist/cli/adapter.js.map +1 -0
  163. package/dist/cli/commands/index.d.ts +24 -0
  164. package/dist/cli/commands/index.d.ts.map +1 -0
  165. package/dist/cli/commands/index.js +13 -0
  166. package/dist/cli/commands/index.js.map +1 -0
  167. package/dist/cli/commands/serve.command.d.ts +21 -0
  168. package/dist/cli/commands/serve.command.d.ts.map +1 -0
  169. package/dist/cli/commands/serve.command.js +62 -0
  170. package/dist/cli/commands/serve.command.js.map +1 -0
  171. package/dist/cli/commands/version.command.d.ts +2 -0
  172. package/dist/cli/commands/version.command.d.ts.map +1 -0
  173. package/dist/cli/commands/version.command.js +12 -0
  174. package/dist/cli/commands/version.command.js.map +1 -0
  175. package/dist/cli/index.d.ts +2 -0
  176. package/dist/cli/index.d.ts.map +1 -0
  177. package/dist/cli/index.js +15 -0
  178. package/dist/cli/index.js.map +1 -0
  179. package/dist/cli/parser.d.ts +7 -0
  180. package/dist/cli/parser.d.ts.map +1 -0
  181. package/dist/cli/parser.js +99 -0
  182. package/dist/cli/parser.js.map +1 -0
  183. package/dist/config/index.d.ts +24 -0
  184. package/dist/config/index.d.ts.map +1 -0
  185. package/dist/config/index.js +38 -0
  186. package/dist/config/index.js.map +1 -0
  187. package/dist/core/ast/index.d.ts +82 -0
  188. package/dist/core/ast/index.d.ts.map +1 -0
  189. package/dist/core/ast/index.js +204 -0
  190. package/dist/core/ast/index.js.map +1 -0
  191. package/dist/core/ast/types.d.ts +152 -0
  192. package/dist/core/ast/types.d.ts.map +1 -0
  193. package/dist/core/ast/types.js +5 -0
  194. package/dist/core/ast/types.js.map +1 -0
  195. package/dist/core/constants.d.ts +17 -0
  196. package/dist/core/constants.d.ts.map +1 -0
  197. package/dist/core/constants.js +49 -0
  198. package/dist/core/constants.js.map +1 -0
  199. package/dist/core/embeddings/callgraph.d.ts +98 -0
  200. package/dist/core/embeddings/callgraph.d.ts.map +1 -0
  201. package/dist/core/embeddings/callgraph.js +415 -0
  202. package/dist/core/embeddings/callgraph.js.map +1 -0
  203. package/dist/core/embeddings/chunker.d.ts +37 -0
  204. package/dist/core/embeddings/chunker.d.ts.map +1 -0
  205. package/dist/core/embeddings/chunker.js +298 -0
  206. package/dist/core/embeddings/chunker.js.map +1 -0
  207. package/dist/core/embeddings/client.d.ts +30 -0
  208. package/dist/core/embeddings/client.d.ts.map +1 -0
  209. package/dist/core/embeddings/client.js +65 -0
  210. package/dist/core/embeddings/client.js.map +1 -0
  211. package/dist/core/embeddings/crossfile.d.ts +58 -0
  212. package/dist/core/embeddings/crossfile.d.ts.map +1 -0
  213. package/dist/core/embeddings/crossfile.js +202 -0
  214. package/dist/core/embeddings/crossfile.js.map +1 -0
  215. package/dist/core/embeddings/enricher.d.ts +53 -0
  216. package/dist/core/embeddings/enricher.d.ts.map +1 -0
  217. package/dist/core/embeddings/enricher.js +308 -0
  218. package/dist/core/embeddings/enricher.js.map +1 -0
  219. package/dist/core/embeddings/index.d.ts +13 -0
  220. package/dist/core/embeddings/index.d.ts.map +1 -0
  221. package/dist/core/embeddings/index.js +20 -0
  222. package/dist/core/embeddings/index.js.map +1 -0
  223. package/dist/core/embeddings/reranker.d.ts +41 -0
  224. package/dist/core/embeddings/reranker.d.ts.map +1 -0
  225. package/dist/core/embeddings/reranker.js +117 -0
  226. package/dist/core/embeddings/reranker.js.map +1 -0
  227. package/dist/core/embeddings/store.d.ts +93 -0
  228. package/dist/core/embeddings/store.d.ts.map +1 -0
  229. package/dist/core/embeddings/store.js +304 -0
  230. package/dist/core/embeddings/store.js.map +1 -0
  231. package/dist/core/embeddings/types.d.ts +77 -0
  232. package/dist/core/embeddings/types.d.ts.map +1 -0
  233. package/dist/core/embeddings/types.js +5 -0
  234. package/dist/core/embeddings/types.js.map +1 -0
  235. package/dist/core/embeddings/watcher.d.ts +130 -0
  236. package/dist/core/embeddings/watcher.d.ts.map +1 -0
  237. package/dist/core/embeddings/watcher.js +448 -0
  238. package/dist/core/embeddings/watcher.js.map +1 -0
  239. package/dist/core/fallback/index.d.ts +26 -0
  240. package/dist/core/fallback/index.d.ts.map +1 -0
  241. package/dist/core/fallback/index.js +76 -0
  242. package/dist/core/fallback/index.js.map +1 -0
  243. package/dist/core/parser/index.d.ts +64 -0
  244. package/dist/core/parser/index.d.ts.map +1 -0
  245. package/dist/core/parser/index.js +205 -0
  246. package/dist/core/parser/index.js.map +1 -0
  247. package/dist/core/parser/languages.d.ts +26 -0
  248. package/dist/core/parser/languages.d.ts.map +1 -0
  249. package/dist/core/parser/languages.js +101 -0
  250. package/dist/core/parser/languages.js.map +1 -0
  251. package/dist/core/queries/helpers.d.ts +72 -0
  252. package/dist/core/queries/helpers.d.ts.map +1 -0
  253. package/dist/core/queries/helpers.js +101 -0
  254. package/dist/core/queries/helpers.js.map +1 -0
  255. package/dist/core/queries/index.d.ts +144 -0
  256. package/dist/core/queries/index.d.ts.map +1 -0
  257. package/dist/core/queries/index.js +396 -0
  258. package/dist/core/queries/index.js.map +1 -0
  259. package/dist/core/queries/loader.d.ts +46 -0
  260. package/dist/core/queries/loader.d.ts.map +1 -0
  261. package/dist/core/queries/loader.js +216 -0
  262. package/dist/core/queries/loader.js.map +1 -0
  263. package/dist/core/queries/patterns.d.ts +10 -0
  264. package/dist/core/queries/patterns.d.ts.map +1 -0
  265. package/dist/core/queries/patterns.js +112 -0
  266. package/dist/core/queries/patterns.js.map +1 -0
  267. package/dist/core/symbols/index.d.ts +70 -0
  268. package/dist/core/symbols/index.d.ts.map +1 -0
  269. package/dist/core/symbols/index.js +359 -0
  270. package/dist/core/symbols/index.js.map +1 -0
  271. package/dist/core/unified/index.d.ts +118 -0
  272. package/dist/core/unified/index.d.ts.map +1 -0
  273. package/dist/core/unified/index.js +428 -0
  274. package/dist/core/unified/index.js.map +1 -0
  275. package/dist/core/utils/assets.d.ts +34 -0
  276. package/dist/core/utils/assets.d.ts.map +1 -0
  277. package/dist/core/utils/assets.js +85 -0
  278. package/dist/core/utils/assets.js.map +1 -0
  279. package/dist/core/utils/cache.d.ts +43 -0
  280. package/dist/core/utils/cache.d.ts.map +1 -0
  281. package/dist/core/utils/cache.js +60 -0
  282. package/dist/core/utils/cache.js.map +1 -0
  283. package/dist/core/utils/index.d.ts +7 -0
  284. package/dist/core/utils/index.d.ts.map +1 -0
  285. package/dist/core/utils/index.js +10 -0
  286. package/dist/core/utils/index.js.map +1 -0
  287. package/dist/core/utils/tsconfig.d.ts +34 -0
  288. package/dist/core/utils/tsconfig.d.ts.map +1 -0
  289. package/dist/core/utils/tsconfig.js +173 -0
  290. package/dist/core/utils/tsconfig.js.map +1 -0
  291. package/dist/features/analyze-file/index.d.ts +15 -0
  292. package/dist/features/analyze-file/index.d.ts.map +1 -0
  293. package/dist/features/analyze-file/index.js +164 -0
  294. package/dist/features/analyze-file/index.js.map +1 -0
  295. package/dist/features/get-call-graph/index.d.ts +24 -0
  296. package/dist/features/get-call-graph/index.d.ts.map +1 -0
  297. package/dist/features/get-call-graph/index.js +246 -0
  298. package/dist/features/get-call-graph/index.js.map +1 -0
  299. package/dist/features/get-index-status/index.d.ts +20 -0
  300. package/dist/features/get-index-status/index.d.ts.map +1 -0
  301. package/dist/features/get-index-status/index.js +90 -0
  302. package/dist/features/get-index-status/index.js.map +1 -0
  303. package/dist/features/index-codebase/index.d.ts +24 -0
  304. package/dist/features/index-codebase/index.d.ts.map +1 -0
  305. package/dist/features/index-codebase/index.js +283 -0
  306. package/dist/features/index-codebase/index.js.map +1 -0
  307. package/dist/features/index.d.ts +15 -0
  308. package/dist/features/index.d.ts.map +1 -0
  309. package/dist/features/index.js +28 -0
  310. package/dist/features/index.js.map +1 -0
  311. package/dist/features/info/index.d.ts +19 -0
  312. package/dist/features/info/index.d.ts.map +1 -0
  313. package/dist/features/info/index.js +41 -0
  314. package/dist/features/info/index.js.map +1 -0
  315. package/dist/features/list-symbols/index.d.ts +22 -0
  316. package/dist/features/list-symbols/index.d.ts.map +1 -0
  317. package/dist/features/list-symbols/index.js +74 -0
  318. package/dist/features/list-symbols/index.js.map +1 -0
  319. package/dist/features/parse-ast/index.d.ts +12 -0
  320. package/dist/features/parse-ast/index.d.ts.map +1 -0
  321. package/dist/features/parse-ast/index.js +71 -0
  322. package/dist/features/parse-ast/index.js.map +1 -0
  323. package/dist/features/query-code/index.d.ts +23 -0
  324. package/dist/features/query-code/index.d.ts.map +1 -0
  325. package/dist/features/query-code/index.js +96 -0
  326. package/dist/features/query-code/index.js.map +1 -0
  327. package/dist/features/search-code/index.d.ts +39 -0
  328. package/dist/features/search-code/index.d.ts.map +1 -0
  329. package/dist/features/search-code/index.js +258 -0
  330. package/dist/features/search-code/index.js.map +1 -0
  331. package/dist/features/types.d.ts +14 -0
  332. package/dist/features/types.d.ts.map +1 -0
  333. package/dist/features/types.js +2 -0
  334. package/dist/features/types.js.map +1 -0
  335. package/dist/features/update-index/index.d.ts +24 -0
  336. package/dist/features/update-index/index.d.ts.map +1 -0
  337. package/dist/features/update-index/index.js +358 -0
  338. package/dist/features/update-index/index.js.map +1 -0
  339. package/dist/features/utils/content.d.ts +30 -0
  340. package/dist/features/utils/content.d.ts.map +1 -0
  341. package/dist/features/utils/content.js +49 -0
  342. package/dist/features/utils/content.js.map +1 -0
  343. package/dist/features/utils/index.d.ts +6 -0
  344. package/dist/features/utils/index.d.ts.map +1 -0
  345. package/dist/features/utils/index.js +8 -0
  346. package/dist/features/utils/index.js.map +1 -0
  347. package/dist/features/utils/result.d.ts +37 -0
  348. package/dist/features/utils/result.d.ts.map +1 -0
  349. package/dist/features/utils/result.js +53 -0
  350. package/dist/features/utils/result.js.map +1 -0
  351. package/dist/index.d.ts +2 -0
  352. package/dist/index.d.ts.map +1 -0
  353. package/dist/index.js +4 -0
  354. package/dist/index.js.map +1 -0
  355. package/dist/prompts/index.d.ts +9 -0
  356. package/dist/prompts/index.d.ts.map +1 -0
  357. package/dist/prompts/index.js +188 -0
  358. package/dist/prompts/index.js.map +1 -0
  359. package/dist/resources/index.d.ts +3 -0
  360. package/dist/resources/index.d.ts.map +1 -0
  361. package/dist/resources/index.js +17 -0
  362. package/dist/resources/index.js.map +1 -0
  363. package/dist/server.d.ts +4 -0
  364. package/dist/server.d.ts.map +1 -0
  365. package/dist/server.js +24 -0
  366. package/dist/server.js.map +1 -0
  367. package/dist/tools/adapter.d.ts +4 -0
  368. package/dist/tools/adapter.d.ts.map +1 -0
  369. package/dist/tools/adapter.js +28 -0
  370. package/dist/tools/adapter.js.map +1 -0
  371. package/dist/tools/index.d.ts +5 -0
  372. package/dist/tools/index.d.ts.map +1 -0
  373. package/dist/tools/index.js +9 -0
  374. package/dist/tools/index.js.map +1 -0
  375. package/dist/types/index.d.ts +20 -0
  376. package/dist/types/index.d.ts.map +1 -0
  377. package/dist/types/index.js +2 -0
  378. package/dist/types/index.js.map +1 -0
  379. package/dist/utils/colors.d.ts +24 -0
  380. package/dist/utils/colors.d.ts.map +1 -0
  381. package/dist/utils/colors.js +30 -0
  382. package/dist/utils/colors.js.map +1 -0
  383. package/dist/utils/index.d.ts +4 -0
  384. package/dist/utils/index.d.ts.map +1 -0
  385. package/dist/utils/index.js +4 -0
  386. package/dist/utils/index.js.map +1 -0
  387. package/dist/utils/logger.d.ts +8 -0
  388. package/dist/utils/logger.d.ts.map +1 -0
  389. package/dist/utils/logger.js +57 -0
  390. package/dist/utils/logger.js.map +1 -0
  391. package/dist/utils/spinner.d.ts +11 -0
  392. package/dist/utils/spinner.d.ts.map +1 -0
  393. package/dist/utils/spinner.js +36 -0
  394. package/dist/utils/spinner.js.map +1 -0
  395. package/package.json +110 -0
@@ -0,0 +1,330 @@
1
+ ;;; Identifiers
2
+ (simple_identifier) @variable
3
+
4
+ ; `field` keyword inside property getter/setter
5
+ ; FIXME: This will highlight the keyword outside of getters and setters
6
+ ; since tree-sitter does not allow us to check for arbitrary nestation
7
+ ((simple_identifier) @variable.builtin
8
+ (#eq? @variable.builtin "field"))
9
+
10
+ ; `it` keyword inside lambdas
11
+ ; FIXME: This will highlight the keyword outside of lambdas since tree-sitter
12
+ ; does not allow us to check for arbitrary nestation
13
+ ((simple_identifier) @variable.builtin
14
+ (#eq? @variable.builtin "it"))
15
+
16
+
17
+ ;;; Operators & Punctuation
18
+
19
+ [
20
+ "."
21
+ ","
22
+ ";"
23
+ ":"
24
+ "::"
25
+ ] @punctuation.delimiter
26
+
27
+ [
28
+ "(" ")"
29
+ "[" "]"
30
+ "{" "}"
31
+ ] @punctuation.bracket
32
+
33
+ [
34
+ "!"
35
+ "!="
36
+ "!=="
37
+ "="
38
+ "=="
39
+ "==="
40
+ ">"
41
+ ">="
42
+ "<"
43
+ "<="
44
+ "||"
45
+ "&&"
46
+ "+"
47
+ "++"
48
+ "+="
49
+ "-"
50
+ "--"
51
+ "-="
52
+ "*"
53
+ "*="
54
+ "/"
55
+ "/="
56
+ "%"
57
+ "%="
58
+ "?."
59
+ "?:"
60
+ "!!"
61
+ "is"
62
+ "!is"
63
+ "in"
64
+ "!in"
65
+ "as"
66
+ "as?"
67
+ ".."
68
+ "->"
69
+ ] @operator
70
+
71
+ ;;; String interpolation
72
+
73
+ (string_literal
74
+ "$" @punctuation.special
75
+ (interpolated_identifier) @variable)
76
+ (string_literal
77
+ "${" @punctuation.special
78
+ (interpolated_expression) @none
79
+ "}" @punctuation.special)
80
+
81
+ ; `it` and `this` inside string interpolation
82
+ ((interpolated_identifier) @variable.builtin
83
+ (#eq? @variable.builtin "it"))
84
+ ((interpolated_identifier) @variable.builtin
85
+ (#eq? @variable.builtin "this"))
86
+
87
+ ;;; Keywords
88
+
89
+ (type_alias "typealias" @keyword)
90
+ [
91
+ (class_modifier)
92
+ (member_modifier)
93
+ (function_modifier)
94
+ (property_modifier)
95
+ (platform_modifier)
96
+ (variance_modifier)
97
+ (parameter_modifier)
98
+ (visibility_modifier)
99
+ (reification_modifier)
100
+ (inheritance_modifier)
101
+ ]@keyword
102
+
103
+ [
104
+ "val"
105
+ "var"
106
+ "enum"
107
+ "class"
108
+ "object"
109
+ "interface"
110
+ "companion"
111
+ ; "typeof" ; NOTE: It is reserved for future use
112
+ ] @keyword
113
+
114
+ ("fun") @keyword.function
115
+
116
+ (jump_expression) @keyword.control.return
117
+
118
+ [
119
+ "if"
120
+ "else"
121
+ "when"
122
+ ] @keyword.control.conditional
123
+
124
+ [
125
+ "for"
126
+ "do"
127
+ "while"
128
+ ] @keyword.control.repeat
129
+
130
+ [
131
+ "try"
132
+ "catch"
133
+ "throw"
134
+ "finally"
135
+ ] @keyword.control.exception
136
+
137
+ (annotation
138
+ "@" @attribute (use_site_target)? @attribute)
139
+ (annotation
140
+ (user_type
141
+ (type_identifier) @attribute))
142
+ (annotation
143
+ (constructor_invocation
144
+ (user_type
145
+ (type_identifier) @attribute)))
146
+
147
+ (file_annotation
148
+ "@" @attribute "file" @attribute ":" @attribute)
149
+ (file_annotation
150
+ (user_type
151
+ (type_identifier) @attribute))
152
+ (file_annotation
153
+ (constructor_invocation
154
+ (user_type
155
+ (type_identifier) @attribute)))
156
+
157
+ ;;; Literals
158
+ ; NOTE: Escapes not allowed in multi-line strings
159
+ (character_literal (character_escape_seq) @constant.character.escape)
160
+
161
+ (string_literal) @string
162
+
163
+ (character_literal) @constant.character
164
+
165
+ [
166
+ (null_literal) ; should be highlighted the same as booleans
167
+ (boolean_literal)
168
+ ] @constant.builtin.boolean
169
+
170
+ (real_literal) @constant.numeric.float
171
+ [
172
+ (integer_literal)
173
+ (long_literal)
174
+ (hex_literal)
175
+ (bin_literal)
176
+ (unsigned_literal)
177
+ ] @constant.numeric.integer
178
+
179
+ [
180
+ (line_comment)
181
+ (multiline_comment)
182
+ (shebang_line)
183
+ ] @comment
184
+
185
+ ;;; Constants
186
+
187
+ (enum_entry
188
+ (simple_identifier) @constant)
189
+
190
+ ; SCREAMING CASE identifiers are assumed to be constants
191
+ ((simple_identifier) @constant
192
+ (#match? @constant "^[A-Z][A-Z0-9_]*$"))
193
+
194
+ ;;; Navigation, Members & Function calls
195
+
196
+ ; generic property navigation (e.g. obj.property)
197
+ (_
198
+ (navigation_suffix
199
+ (simple_identifier) @variable.other.member))
200
+
201
+ ; generic function call (e.g. foo())
202
+ (call_expression
203
+ . (simple_identifier) @function)
204
+
205
+ ; method call via navigation (e.g. obj.method())
206
+ (call_expression
207
+ (navigation_expression
208
+ (navigation_suffix
209
+ (simple_identifier) @function) . ))
210
+
211
+ ; infix function call (e.g. 1 to 2)
212
+ (infix_expression
213
+ . (_) .
214
+ (simple_identifier) @function)
215
+
216
+ ; builtin function calls
217
+ (call_expression
218
+ . (simple_identifier) @function.builtin
219
+ (#match? @function.builtin "^(arrayOf|arrayOfNulls|byteArrayOf|shortArrayOf|intArrayOf|longArrayOf|ubyteArrayOf|ushortArrayOf|uintArrayOf|ulongArrayOf|floatArrayOf|doubleArrayOf|booleanArrayOf|charArrayOf|emptyArray|mapOf|setOf|listOf|emptyMap|emptySet|emptyList|mutableMapOf|mutableSetOf|mutableListOf|print|println|error|TODO|run|runCatching|repeat|lazy|lazyOf|enumValues|enumValueOf|assert|check|checkNotNull|require|requireNotNull|with|suspend|synchronized)$"))
220
+
221
+ ; constant access via navigation (e.g. Foo.CONSTANT)
222
+ (_
223
+ (navigation_suffix
224
+ (simple_identifier) @constant
225
+ (#match? @constant "^[A-Z][A-Z0-9_]*$")))
226
+
227
+ ; object or class reference (e.g. TextObjects.TEXT)
228
+ ((navigation_expression
229
+ . (simple_identifier) @type)
230
+ (#match? @type "^[A-Z]"))
231
+
232
+ ;;; Function definitions
233
+
234
+ ; lambda parameters
235
+ (lambda_literal
236
+ (lambda_parameters
237
+ (variable_declaration
238
+ (simple_identifier) @variable.parameter)))
239
+
240
+ (parameter_with_optional_type
241
+ (simple_identifier) @variable.parameter)
242
+
243
+ (parameter
244
+ (simple_identifier) @variable.parameter)
245
+
246
+ ; named arguments
247
+ (value_argument
248
+ . (simple_identifier) @variable.parameter)
249
+
250
+ (anonymous_initializer
251
+ ("init") @constructor)
252
+
253
+ (constructor_invocation
254
+ (user_type
255
+ (type_identifier) @constructor))
256
+
257
+ (secondary_constructor
258
+ ("constructor") @constructor)
259
+ (primary_constructor) @constructor
260
+
261
+ (getter
262
+ ("get") @function.builtin)
263
+ (setter
264
+ ("set") @function.builtin)
265
+
266
+ ; normal function
267
+ (function_declaration
268
+ (modifiers)?
269
+ (type_parameters)?
270
+ (simple_identifier) @function)
271
+
272
+ ; extension function
273
+ (function_declaration
274
+ receiver: (receiver_type)
275
+ (simple_identifier) @function)
276
+
277
+ ; TODO: Separate labeled returns/breaks/continue/super/this
278
+ ; Must be implemented in the parser first
279
+ (label) @label
280
+
281
+ (import_header
282
+ (identifier
283
+ (simple_identifier) @function @_import .)
284
+ (import_alias
285
+ (type_identifier) @function)?
286
+ (#match? @_import "^[a-z]"))
287
+
288
+ ; The last `simple_identifier` in a `import_header` will always either be a function
289
+ ; or a type. Classes can appear anywhere in the import path, unlike functions
290
+ (import_header
291
+ (identifier
292
+ (simple_identifier) @type @_import)
293
+ (import_alias
294
+ (type_identifier) @type)?
295
+ (#match? @_import "^[A-Z]"))
296
+
297
+ (import_header
298
+ "import" @keyword.control.import)
299
+
300
+ (package_header
301
+ . (identifier)) @namespace
302
+
303
+ (type_identifier) @type
304
+
305
+ ((type_identifier) @type.builtin
306
+ (#match? @type.builtin "^(Byte|Short|Int|Long|UByte|UShort|UInt|ULong|Float|Double|Boolean|Char|String|Array|ByteArray|ShortArray|IntArray|LongArray|UByteArray|UShortArray|UIntArray|ULongArray|FloatArray|DoubleArray|BooleanArray|CharArray|Map|Set|List|EmptyMap|EmptySet|EmptyList|MutableMap|MutableSet|MutableList)$"))
307
+
308
+ (type_parameter
309
+ (type_identifier) @type.parameter)
310
+
311
+ ((class_body
312
+ (property_declaration
313
+ (variable_declaration
314
+ (simple_identifier) @variable.other.member)))
315
+ (#not-match? @variable.other.member "^[A-Z][A-Z0-9_]*$"))
316
+
317
+ ; Extension property
318
+ (property_declaration
319
+ receiver: (receiver_type)
320
+ (variable_declaration
321
+ (simple_identifier) @variable.other.member))
322
+
323
+ (class_parameter
324
+ (simple_identifier) @variable.other.member)
325
+
326
+ ; `super` keyword inside classes
327
+ (super_expression) @variable.builtin
328
+
329
+ ; `this` this keyword inside classes
330
+ (this_expression) @variable.builtin
@@ -0,0 +1,44 @@
1
+ [
2
+ (class_body)
3
+ (enum_class_body)
4
+ (lambda_literal)
5
+
6
+ ; _block is hidden in the grammar, so list all public wrappers explicitly.
7
+ (function_body)
8
+ (anonymous_initializer)
9
+ (control_structure_body)
10
+ (secondary_constructor)
11
+ (try_expression)
12
+ (catch_block)
13
+ (finally_block)
14
+
15
+ (property_declaration)
16
+ (assignment)
17
+
18
+ (when_expression)
19
+ (call_expression)
20
+ (if_expression)
21
+
22
+ ; Binary expressions
23
+ (multiplicative_expression)
24
+ (additive_expression)
25
+ (range_expression)
26
+ (infix_expression)
27
+ (elvis_expression)
28
+ (check_expression)
29
+ (comparison_expression)
30
+ (equality_expression)
31
+ (comparison_expression)
32
+ (equality_expression)
33
+ (conjunction_expression)
34
+ (disjunction_expression)
35
+
36
+ (call_suffix)
37
+ (function_value_parameters)
38
+ ] @indent
39
+
40
+ [
41
+ "}"
42
+ ")"
43
+ "]"
44
+ ] @outdent
@@ -0,0 +1,42 @@
1
+ ([
2
+ (line_comment)
3
+ (multiline_comment)
4
+ ] @injection.content
5
+ (#set! injection.language "comment"))
6
+
7
+ ; There are 3 ways to define a regex
8
+ ; - "[abc]?".toRegex()
9
+ ((call_expression
10
+ (navigation_expression
11
+ (string_literal
12
+ (string_content) @injection.content)
13
+ (navigation_suffix
14
+ ((simple_identifier) @_function
15
+ (#eq? @_function "toRegex")))))
16
+ (#set! injection.language "regex"))
17
+
18
+ ; - Regex("[abc]?")
19
+ ((call_expression
20
+ ((simple_identifier) @_function
21
+ (#eq? @_function "Regex"))
22
+ (call_suffix
23
+ (value_arguments
24
+ (value_argument
25
+ (string_literal
26
+ (string_content) @injection.content)))))
27
+ (#set! injection.language "regex"))
28
+
29
+ ; - Regex.fromLiteral("[abc]?")
30
+ ((call_expression
31
+ (navigation_expression
32
+ ((simple_identifier) @_class
33
+ (#eq? @_class "Regex"))
34
+ (navigation_suffix
35
+ ((simple_identifier) @_function
36
+ (#eq? @_function "fromLiteral"))))
37
+ (call_suffix
38
+ (value_arguments
39
+ (value_argument
40
+ (string_literal
41
+ (string_content) @injection.content)))))
42
+ (#set! injection.language "regex"))
@@ -0,0 +1,23 @@
1
+ ; Scopes
2
+ [
3
+ (class_declaration)
4
+ (function_declaration)
5
+ (lambda_literal)
6
+ ] @local.scope
7
+
8
+ ; Definitions
9
+ (type_parameter
10
+ (type_identifier) @local.definition.type.parameter)
11
+
12
+ (parameter
13
+ (simple_identifier) @local.definition.variable.parameter)
14
+
15
+ (lambda_literal
16
+ (lambda_parameters
17
+ (variable_declaration
18
+ (simple_identifier) @local.definition.variable.parameter)))
19
+
20
+ ; References
21
+ (simple_identifier) @local.reference
22
+ (type_identifier) @local.reference
23
+ (interpolated_identifier) @local.reference
@@ -0,0 +1,12 @@
1
+ (class_declaration
2
+ (type_identifier) @definition.class)
3
+
4
+ (object_declaration
5
+ "object" (type_identifier) @definition.class)
6
+
7
+ (function_declaration
8
+ (simple_identifier) @definition.function)
9
+
10
+ (property_declaration
11
+ (variable_declaration
12
+ (simple_identifier) @definition.constant))
@@ -0,0 +1,45 @@
1
+ (function_declaration
2
+ (function_body)? @function.inside) @function.around
3
+
4
+ ; Unlike function_body above, the constructor body is does not have its own
5
+ ; symbol in the current grammar.
6
+ (secondary_constructor) @function.around
7
+
8
+ (class_declaration
9
+ (class_body)? @class.inside) @class.around
10
+
11
+ (class_declaration
12
+ (enum_class_body) @class.inside) @class.around
13
+
14
+ [
15
+ (line_comment)
16
+ (multiline_comment)
17
+ ] @comment.inside
18
+
19
+ (line_comment)+ @comment.around
20
+
21
+ (multiline_comment) @comment.around
22
+
23
+ (enum_entry) @entry.around
24
+ (lambda_literal) @entry.around
25
+ (property_declaration) @entry.around
26
+ (object_declaration) @entry.around
27
+ (assignment) @entry.around
28
+
29
+ ; TODO: This doesn't work with annotations yet, but fixing it without breaking
30
+ ; the case of multiple parameters is non-trivial.
31
+ (function_value_parameters
32
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
33
+
34
+ ; secondary constructor uses function_value_parameters above
35
+ (primary_constructor
36
+ ((_)@parameter.inside . ","? @parameter.around) @parameter.around)
37
+
38
+ (function_type_parameters
39
+ ((_)@parameter.inside . ","? @parameter.around) @parameter.around)
40
+
41
+ (value_arguments
42
+ ((_)@parameter.inside . ","? @parameter.around) @parameter.around)
43
+
44
+ (lambda_parameters
45
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
@@ -0,0 +1,151 @@
1
+ ; Punctuation
2
+ ;------------
3
+
4
+ "%" @punctuation.special
5
+
6
+ ["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket
7
+
8
+ [
9
+ "," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&"
10
+ "->" ";;" ":>" "+=" ":=" ".."
11
+ ] @punctuation.delimiter
12
+
13
+ (object_type ["<" ">"] @punctuation.bracket)
14
+
15
+ (attribute ["[@" "]"] @punctuation.special)
16
+ (item_attribute ["[@@" "]"] @punctuation.special)
17
+ (floating_attribute ["[@@@" "]"] @punctuation.special)
18
+ (extension ["[%" "]"] @punctuation.special)
19
+ (item_extension ["[%%" "]"] @punctuation.special)
20
+ (quoted_extension ["{%" "}"] @punctuation.special)
21
+ (quoted_item_extension ["{%%" "}"] @punctuation.special)
22
+
23
+ ; Modules
24
+ ;--------
25
+
26
+ [(module_name) (module_type_name)] @namespace
27
+
28
+ ; Types
29
+ ;------
30
+
31
+ (
32
+ (type_constructor) @type.builtin
33
+ (#match? @type.builtin "^(int|char|bytes|string|float|bool|unit|exn|array|list|option|int32|int64|nativeint|format6|lazy_t)$")
34
+ )
35
+
36
+ [(class_name) (class_type_name) (type_constructor)] @type
37
+
38
+ [(constructor_name) (tag)] @constructor
39
+
40
+ ; Variables
41
+ ;----------
42
+
43
+ [(value_name) (type_variable)] @variable
44
+
45
+ (value_pattern) @variable.parameter
46
+
47
+ ; Functions
48
+ ;----------
49
+
50
+ (let_binding
51
+ pattern: (value_name) @function
52
+ (parameter))
53
+
54
+ (let_binding
55
+ pattern: (value_name) @function
56
+ body: [(fun_expression) (function_expression)])
57
+
58
+ (value_specification (value_name) @function)
59
+
60
+ (external (value_name) @function)
61
+
62
+ (method_name) @function.method
63
+
64
+ ; Application
65
+ ;------------
66
+
67
+ (
68
+ (value_name) @function.builtin
69
+ (#match? @function.builtin "^(raise(_notrace)?|failwith|invalid_arg)$")
70
+ )
71
+
72
+ (infix_expression
73
+ left: (value_path (value_name) @function)
74
+ operator: (concat_operator) @operator
75
+ (#eq? @operator "@@"))
76
+
77
+ (infix_expression
78
+ operator: (rel_operator) @operator
79
+ right: (value_path (value_name) @function)
80
+ (#eq? @operator "|>"))
81
+
82
+ (application_expression
83
+ function: (value_path (value_name) @function))
84
+
85
+ ; Properties
86
+ ;-----------
87
+
88
+ [(label_name) (field_name) (instance_variable_name)] @variable.other.member
89
+
90
+ ; Constants
91
+ ;----------
92
+
93
+ (boolean) @constant.builtin.boolean
94
+
95
+ [(number) (signed_number)] @constant.numeric
96
+
97
+ [(string) (character)] @string
98
+
99
+ (quoted_string "{" @string "}" @string) @string
100
+
101
+ (escape_sequence) @constant.character.escape
102
+
103
+ (conversion_specification) @string.special
104
+
105
+ ; Operators
106
+ ;----------
107
+
108
+ ["*" "#" "::" "<-"] @operator
109
+
110
+ [
111
+ (prefix_operator)
112
+ (sign_operator)
113
+ (pow_operator)
114
+ (mult_operator)
115
+ (add_operator)
116
+ (concat_operator)
117
+ (rel_operator)
118
+ (and_operator)
119
+ (or_operator)
120
+ (assign_operator)
121
+ (hash_operator)
122
+ (indexing_operator)
123
+ (let_operator)
124
+ (let_and_operator)
125
+ (match_operator)
126
+ ] @operator
127
+
128
+ (match_expression (match_operator) @keyword)
129
+
130
+ (value_definition [(let_operator) (let_and_operator)] @keyword)
131
+
132
+ ; Keywords
133
+ ;---------
134
+
135
+ [
136
+ "and" "as" "assert" "begin" "class" "constraint" "do" "done" "downto" "else"
137
+ "end" "exception" "external" "for" "fun" "function" "functor" "if" "in"
138
+ "include" "inherit" "initializer" "lazy" "let" "match" "method" "module"
139
+ "mutable" "new" "nonrec" "object" "of" "open" "private" "rec" "sig" "struct"
140
+ "then" "to" "try" "type" "val" "virtual" "when" "while" "with"
141
+ ] @keyword
142
+
143
+ ; Attributes
144
+ ;-----------
145
+
146
+ (attribute_id) @tag
147
+
148
+ ; Comments
149
+ ;---------
150
+
151
+ [(comment) (line_number_directive) (directive) (shebang)] @comment
@@ -0,0 +1,12 @@
1
+ [
2
+ (let_binding)
3
+ (type_binding)
4
+ (structure)
5
+ (signature)
6
+ (record_declaration)
7
+ (function_expression)
8
+ (match_case)
9
+ ] @indent
10
+
11
+ "}" @outdent
12
+
@@ -0,0 +1,2 @@
1
+ ((comment) @injection.content
2
+ (#set! injection.language "comment"))
@@ -0,0 +1,24 @@
1
+ ; Scopes
2
+ ;-------
3
+
4
+ [
5
+ (let_binding)
6
+ (class_binding)
7
+ (class_function)
8
+ (method_definition)
9
+ (fun_expression)
10
+ (object_expression)
11
+ (for_expression)
12
+ (match_case)
13
+ (attribute_payload)
14
+ ] @local.scope
15
+
16
+ ; Definitions
17
+ ;------------
18
+
19
+ (value_pattern) @local.definition.variable.parameter
20
+
21
+ ; References
22
+ ;-----------
23
+
24
+ (value_path . (value_name) @local.reference)