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,170 @@
1
+ ([(line_comment !doc) (block_comment !doc)] @injection.content
2
+ (#set! injection.language "comment"))
3
+
4
+ ((doc_comment) @injection.content
5
+ (#set! injection.language "markdown-rustdoc")
6
+ (#set! injection.combined))
7
+
8
+ ((macro_invocation
9
+ (token_tree) @injection.content)
10
+ (#set! injection.language "rust")
11
+ (#set! injection.include-children))
12
+
13
+ ((macro_rule
14
+ (token_tree) @injection.content)
15
+ (#set! injection.language "rust")
16
+ (#set! injection.include-children))
17
+
18
+ ((macro_invocation
19
+ macro:
20
+ [
21
+ (scoped_identifier
22
+ name: (_) @_macro_name)
23
+ (identifier) @_macro_name
24
+ ]
25
+ (token_tree) @injection.content)
26
+ (#eq? @_macro_name "html")
27
+ (#set! injection.language "html")
28
+ (#set! injection.include-children))
29
+
30
+ ((macro_invocation
31
+ macro:
32
+ [
33
+ (scoped_identifier
34
+ name: (_) @_macro_name)
35
+ (identifier) @_macro_name
36
+ ]
37
+ (token_tree) @injection.content)
38
+ (#eq? @_macro_name "slint")
39
+ (#set! injection.language "slint")
40
+ (#set! injection.include-children))
41
+
42
+ ((macro_invocation
43
+ macro:
44
+ [
45
+ (scoped_identifier name: (_) @_macro_name)
46
+ (identifier) @_macro_name
47
+ ]
48
+ (token_tree
49
+ (token_tree . "{" "}" .) @injection.content))
50
+ (#eq? @_macro_name "json")
51
+ (#set! injection.language "json")
52
+ (#set! injection.include-children))
53
+
54
+ (call_expression
55
+ function: (scoped_identifier
56
+ path: (identifier) @_regex (#any-of? @_regex "Regex" "RegexBuilder")
57
+ name: (identifier) @_new (#eq? @_new "new"))
58
+ arguments:
59
+ (arguments
60
+ [
61
+ (string_literal (string_content) @injection.content)
62
+ (raw_string_literal (string_content) @injection.content)
63
+ ])
64
+ (#set! injection.language "regex"))
65
+
66
+ (call_expression
67
+ function: (scoped_identifier
68
+ path: (scoped_identifier (identifier) @_regex (#any-of? @_regex "Regex" "RegexBuilder") .)
69
+ name: (identifier) @_new (#eq? @_new "new"))
70
+ arguments:
71
+ (arguments
72
+ [
73
+ (string_literal (string_content) @injection.content)
74
+ (raw_string_literal (string_content) @injection.content)
75
+ ])
76
+ (#set! injection.language "regex"))
77
+
78
+ ; Highlight SQL in `sqlx::query!()`, `sqlx::query_scalar!()`, and `sqlx::query_scalar_unchecked!()`
79
+ (macro_invocation
80
+ macro: (scoped_identifier
81
+ path: (identifier) @_sqlx (#eq? @_sqlx "sqlx")
82
+ name: (identifier) @_query (#match? @_query "^query(_scalar|_scalar_unchecked)?$"))
83
+ (token_tree
84
+ ; Only the first argument is SQL
85
+ .
86
+ [
87
+ (string_literal (string_content) @injection.content)
88
+ (raw_string_literal (string_content) @injection.content)
89
+ ]
90
+ )
91
+ (#set! injection.language "sql"))
92
+
93
+ ; Highlight SQL in `sqlx::query_as!()` and `sqlx::query_as_unchecked!()`
94
+ (macro_invocation
95
+ macro: (scoped_identifier
96
+ path: (identifier) @_sqlx (#eq? @_sqlx "sqlx")
97
+ name: (identifier) @_query_as (#match? @_query_as "^query_as(_unchecked)?$"))
98
+ (token_tree
99
+ ; Only the second argument is SQL
100
+ .
101
+ ; Allow anything as the first argument in case the user has lower case type
102
+ ; names for some reason
103
+ (_)
104
+ [
105
+ (string_literal (string_content) @injection.content)
106
+ (raw_string_literal (string_content) @injection.content)
107
+ ]
108
+ )
109
+ (#set! injection.language "sql"))
110
+
111
+ ; Special language `tree-sitter-rust-format-args` for Rust macros,
112
+ ; which use `format_args!` under the hood and therefore have
113
+ ; the `format_args!` syntax.
114
+ ;
115
+ ; This language is injected into a hard-coded set of macros.
116
+ (
117
+ (macro_invocation
118
+ macro:
119
+ [
120
+ (scoped_identifier
121
+ name: (_) @_macro_name)
122
+ (identifier) @_macro_name
123
+ ]
124
+ (token_tree) @injection.content
125
+ )
126
+ (#any-of? @_macro_name
127
+ ; 1st argument is `format_args!`
128
+
129
+ ; std
130
+ "print" "println" "eprint" "eprintln"
131
+ "format" "format_args" "todo" "panic"
132
+ "unreachable" "unimplemented" "compile_error"
133
+ ; log
134
+ "crit" "trace" "debug" "info" "warn" "error"
135
+ ; anyhow
136
+ "anyhow" "bail"
137
+ ; syn
138
+ "format_ident"
139
+ ; indoc
140
+ "formatdoc" "printdoc" "eprintdoc" "writedoc"
141
+ ; iced
142
+ "text"
143
+ ; ratatui
144
+ "span"
145
+ ; eyre
146
+ "eyre"
147
+ ; miette
148
+ "miette"
149
+
150
+ ; 2nd argument is `format_args!`
151
+
152
+ ; std
153
+ "write" "writeln" "assert" "debug_assert"
154
+ ; defmt
155
+ "expect" "unwrap"
156
+ ; ratatui
157
+ "span"
158
+
159
+ ; 3rd argument is `format_args!`
160
+
161
+ ; std
162
+ "assert_eq" "debug_assert_eq" "assert_ne" "debug_assert_ne"
163
+
164
+ ; Dioxus's rsx! macro accepts string interpolation in all
165
+ ; strings, across the entire token tree
166
+ "rsx"
167
+ )
168
+ (#set! injection.language "rust-format-args-macro")
169
+ (#set! injection.include-children)
170
+ )
@@ -0,0 +1,28 @@
1
+ ; Scopes
2
+
3
+ [
4
+ (function_item)
5
+ (struct_item)
6
+ (enum_item)
7
+ (union_item)
8
+ (type_item)
9
+ (trait_item)
10
+ (impl_item)
11
+ (closure_expression)
12
+ (block)
13
+ ] @local.scope
14
+
15
+ ; Definitions
16
+
17
+ (function_item
18
+ (parameters
19
+ (parameter
20
+ pattern: (identifier) @local.definition.variable.parameter)))
21
+
22
+ (closure_parameters (identifier) @local.definition.variable.parameter)
23
+
24
+ ; References
25
+ (identifier) @local.reference
26
+ ; lifetimes / labels
27
+ (lifetime (identifier) @label)
28
+ (label (identifier) @label)
@@ -0,0 +1,60 @@
1
+ [
2
+ ; {/}
3
+ (declaration_list)
4
+ (field_declaration_list)
5
+ (field_initializer_list)
6
+ (enum_variant_list)
7
+ (block)
8
+ (match_block)
9
+ (use_list)
10
+ (struct_pattern)
11
+
12
+ ; (/)
13
+ (ordered_field_declaration_list)
14
+ (arguments)
15
+ (parameters)
16
+ (tuple_type)
17
+ (tuple_expression)
18
+ (tuple_pattern)
19
+ (tuple_struct_pattern)
20
+ (unit_type)
21
+ (unit_expression)
22
+ (visibility_modifier)
23
+ (parenthesized_expression)
24
+ (token_repetition_pattern)
25
+
26
+ ; </>
27
+ (type_parameters)
28
+ (type_arguments)
29
+ (bracketed_type)
30
+ (for_lifetimes)
31
+
32
+ ; [/]
33
+ (array_type)
34
+ (array_expression)
35
+ (index_expression)
36
+ (slice_pattern)
37
+
38
+ ; attributes #[]
39
+ (attribute_item)
40
+ (inner_attribute_item)
41
+
42
+ ; macros
43
+ (token_tree_pattern)
44
+ (macro_definition)
45
+
46
+ ; closures
47
+ (closure_parameters)
48
+ ] @rainbow.scope
49
+
50
+ ; attributes like `#[serde(rename_all = "kebab-case")]`
51
+ (attribute arguments: (token_tree) @rainbow.scope)
52
+
53
+ [
54
+ "#"
55
+ "[" "]"
56
+ "(" ")"
57
+ "{" "}"
58
+ "<" ">"
59
+ "|"
60
+ ] @rainbow.bracket
@@ -0,0 +1,26 @@
1
+ (struct_item
2
+ name: (type_identifier) @definition.struct)
3
+
4
+ (const_item
5
+ name: (identifier) @definition.constant)
6
+
7
+ (trait_item
8
+ name: (type_identifier) @definition.interface)
9
+
10
+ (function_item
11
+ name: (identifier) @definition.function)
12
+
13
+ (function_signature_item
14
+ name: (identifier) @definition.function)
15
+
16
+ (enum_item
17
+ name: (type_identifier) @definition.type)
18
+
19
+ (enum_variant
20
+ name: (identifier) @definition.struct)
21
+
22
+ (mod_item
23
+ name: (identifier) @definition.module)
24
+
25
+ (macro_definition
26
+ name: (identifier) @definition.macro)
@@ -0,0 +1,85 @@
1
+ (function_item
2
+ body: (_) @function.inside) @function.around
3
+
4
+ (closure_expression
5
+ body: (_) @function.inside) @function.around
6
+
7
+ (struct_item
8
+ body: (_) @class.inside) @class.around
9
+
10
+ (enum_item
11
+ body: (_) @class.inside) @class.around
12
+
13
+ (union_item
14
+ body: (_) @class.inside) @class.around
15
+
16
+ (trait_item
17
+ body: (_) @class.inside) @class.around
18
+
19
+ (impl_item
20
+ body: (_) @class.inside) @class.around
21
+
22
+ (parameters
23
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
24
+
25
+ (type_parameters
26
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
27
+
28
+ (type_arguments
29
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
30
+
31
+ (closure_parameters
32
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
33
+
34
+ (arguments
35
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
36
+
37
+ (field_initializer_list
38
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
39
+
40
+ [
41
+ (line_comment)
42
+ (block_comment)
43
+ ] @comment.inside
44
+
45
+ (line_comment)+ @comment.around
46
+
47
+ (block_comment) @comment.around
48
+
49
+ (; #[test]
50
+ (attribute_item
51
+ (attribute
52
+ (identifier) @_test_attribute))
53
+ ; allow other attributes like #[should_panic] and comments
54
+ [
55
+ (attribute_item)
56
+ (line_comment)
57
+ ]*
58
+ ; the test function
59
+ (function_item
60
+ body: (_) @test.inside) @test.around
61
+ (#eq? @_test_attribute "test"))
62
+
63
+ (array_expression
64
+ (_) @entry.around)
65
+
66
+ (tuple_expression
67
+ (_) @entry.around)
68
+
69
+ (tuple_pattern
70
+ (_) @entry.around)
71
+
72
+ ; Commonly used vec macro initializer is special cased
73
+ (macro_invocation
74
+ (identifier) @_id (token_tree (_) @entry.around)
75
+ (#eq? @_id "vec"))
76
+
77
+ (enum_variant) @entry.around
78
+
79
+ (field_declaration
80
+ (_) @entry.inside) @entry.around
81
+
82
+ (field_initializer
83
+ (_) @entry.inside) @entry.around
84
+
85
+ (shorthand_field_initializer) @entry.around
@@ -0,0 +1,267 @@
1
+ ; CREDITS @stumash (stuart.mashaal@gmail.com)
2
+
3
+ ;; variables
4
+
5
+ (identifier) @variable
6
+
7
+ (operator_identifier) @operator
8
+
9
+ ((identifier) @variable.builtin
10
+ (#match? @variable.builtin "^this$"))
11
+
12
+ (interpolation) @none
13
+
14
+ ; Assume other uppercase names constants.
15
+ ; NOTE: In order to distinguish constants we highlight
16
+ ; all the identifiers that are uppercased. But this solution
17
+ ; is not suitable for all occurrences e.g. it will highlight
18
+ ; an uppercased method as a constant if used with no params.
19
+ ; Introducing highlighting for those specific cases, is probably
20
+ ; best way to resolve the issue.
21
+ ((identifier) @constant (#match? @constant "^[A-Z]"))
22
+
23
+ ;; types
24
+
25
+ (type_identifier) @type
26
+
27
+ (class_definition
28
+ name: (identifier) @type)
29
+
30
+ (object_definition
31
+ name: (identifier) @type)
32
+
33
+ (trait_definition
34
+ name: (identifier) @type)
35
+
36
+ (type_definition
37
+ name: (type_identifier) @type)
38
+
39
+ (full_enum_case
40
+ name: (identifier) @type)
41
+
42
+ (simple_enum_case
43
+ name: (identifier) @type)
44
+
45
+ ;; val/var definitions/declarations
46
+
47
+ (val_definition
48
+ pattern: (identifier) @variable)
49
+
50
+ (var_definition
51
+ pattern: (identifier) @variable)
52
+
53
+ (val_declaration
54
+ name: (identifier) @variable)
55
+
56
+ (var_declaration
57
+ name: (identifier) @variable)
58
+
59
+ ; function definitions/declarations
60
+
61
+ (function_declaration
62
+ name: (identifier) @function.method)
63
+
64
+ (function_definition
65
+ name: (identifier) @function.method)
66
+
67
+ ; imports/exports
68
+
69
+ (import_declaration
70
+ path: (identifier) @namespace)
71
+ ((stable_identifier (identifier) @namespace))
72
+
73
+ ((import_declaration
74
+ path: (identifier) @type) (#match? @type "^[A-Z]"))
75
+ ((stable_identifier (identifier) @type) (#match? @type "^[A-Z]"))
76
+
77
+ (export_declaration
78
+ path: (identifier) @namespace)
79
+ ((stable_identifier (identifier) @namespace))
80
+
81
+ ((export_declaration
82
+ path: (identifier) @type) (#match? @type "^[A-Z]"))
83
+ ((stable_identifier (identifier) @type) (#match? @type "^[A-Z]"))
84
+
85
+ ((namespace_selectors (identifier) @type) (#match? @type "^[A-Z]"))
86
+
87
+ ; method invocation
88
+
89
+
90
+ (call_expression
91
+ function: (identifier) @function)
92
+
93
+ (call_expression
94
+ function: (operator_identifier) @function)
95
+
96
+ (call_expression
97
+ function: (field_expression
98
+ field: (identifier) @function.method))
99
+
100
+ (call_expression
101
+ function: (field_expression
102
+ field: (operator_identifier) @function.method))
103
+
104
+ ((call_expression
105
+ function: (identifier) @variable.other.member)
106
+ (#match? @variable.other.member "^[A-Z]"))
107
+
108
+ (generic_function
109
+ function: (identifier) @function)
110
+
111
+ (interpolated_string_expression
112
+ interpolator: (identifier) @function)
113
+
114
+ (
115
+ (identifier) @function.builtin
116
+ (#match? @function.builtin "^super$")
117
+ )
118
+
119
+ ; function definitions
120
+
121
+ (function_definition
122
+ name: (identifier) @function)
123
+
124
+ (function_definition
125
+ name: (operator_identifier) @function)
126
+
127
+ (parameter
128
+ name: (identifier) @variable.parameter)
129
+
130
+ (binding
131
+ name: (identifier) @variable.parameter)
132
+
133
+ ; expressions
134
+
135
+
136
+ (field_expression field: (identifier) @variable.other.member)
137
+ (field_expression value: (identifier) @type
138
+ (#match? @type "^[A-Z]"))
139
+
140
+ (infix_expression operator: (identifier) @operator)
141
+ (infix_expression operator: (operator_identifier) @operator)
142
+ (infix_type operator: (operator_identifier) @operator)
143
+ (infix_type operator: (operator_identifier) @operator)
144
+
145
+ ; literals
146
+ (boolean_literal) @constant.builtin.boolean
147
+ (integer_literal) @constant.numeric.integer
148
+ (floating_point_literal) @constant.numeric.float
149
+
150
+
151
+ (symbol_literal) @string.special.symbol
152
+
153
+ [
154
+ (string)
155
+ (character_literal)
156
+ (interpolated_string_expression)
157
+ ] @string
158
+
159
+ (interpolation "$" @punctuation.special)
160
+
161
+ ; annotations
162
+
163
+ (annotation) @attribute
164
+
165
+ ;; keywords
166
+
167
+ ;; storage in TextMate scope lingo means field or type
168
+ [
169
+ (opaque_modifier)
170
+ (infix_modifier)
171
+ (transparent_modifier)
172
+ (open_modifier)
173
+ "abstract"
174
+ "final"
175
+ "implicit"
176
+ "lazy"
177
+ "override"
178
+ "private"
179
+ "protected"
180
+ "sealed"
181
+ ] @keyword.storage.modifier
182
+
183
+ [
184
+ "class"
185
+ "enum"
186
+ "extension"
187
+ "given"
188
+ "object"
189
+ "package"
190
+ "trait"
191
+ "type"
192
+ "val"
193
+ "var"
194
+ ] @keyword.storage.type
195
+
196
+ [
197
+ "as"
198
+ "derives"
199
+ "end"
200
+ "extends"
201
+ ;; `forSome` existential types not implemented yet
202
+ ;; `macro` not implemented yet
203
+ ;; `throws`
204
+ "using"
205
+ "with"
206
+ ] @keyword
207
+
208
+ (null_literal) @constant.builtin
209
+ (wildcard) @keyword
210
+
211
+ ;; special keywords
212
+
213
+ "new" @keyword.operator
214
+
215
+ [
216
+ "case"
217
+ "catch"
218
+ "else"
219
+ "finally"
220
+ "if"
221
+ "match"
222
+ "then"
223
+ "throw"
224
+ "try"
225
+ ] @keyword.control.conditional
226
+
227
+ [
228
+ "("
229
+ ")"
230
+ "["
231
+ "]"
232
+ "{"
233
+ "}"
234
+ ] @punctuation.bracket
235
+
236
+ [
237
+ "."
238
+ ","
239
+ ] @punctuation.delimiter
240
+
241
+ [
242
+ "do"
243
+ "for"
244
+ "while"
245
+ "yield"
246
+ ] @keyword.control.repeat
247
+
248
+ "def" @keyword.function
249
+
250
+ [
251
+ "=>"
252
+ "<-"
253
+ "@"
254
+ ] @keyword.operator
255
+
256
+ "import" @keyword.control.import
257
+
258
+ "export" @keyword.control.import
259
+
260
+ "return" @keyword.control.return
261
+
262
+ [(comment) (block_comment)] @comment
263
+
264
+ ;; `case` is a conditional keyword in case_block
265
+
266
+ (case_block
267
+ (case_clause ("case") @keyword.control.conditional))
@@ -0,0 +1,22 @@
1
+ [
2
+ (block)
3
+ (arguments)
4
+ (parameter)
5
+ (class_definition)
6
+ (trait_definition)
7
+ (object_definition)
8
+ (function_definition)
9
+ (val_definition)
10
+ (import_declaration)
11
+ (while_expression)
12
+ (do_while_expression)
13
+ (for_expression)
14
+ (try_expression)
15
+ (match_expression)
16
+ ] @indent
17
+
18
+ [
19
+ "}"
20
+ "]"
21
+ ")"
22
+ ] @outdent
@@ -0,0 +1,16 @@
1
+ ([(comment) (block_comment)] @injection.content
2
+ (#set! injection.language "comment"))
3
+
4
+
5
+ ; TODO for some reason multiline string (triple quotes) interpolation works only if it contains interpolated value
6
+ ; Matches these SQL interpolators:
7
+ ; - Doobie: 'sql', 'fr'
8
+ ; - Quill: 'sql', 'infix'
9
+ ; - Slick: 'sql', 'sqlu'
10
+ (interpolated_string_expression
11
+ interpolator:
12
+ ((identifier) @interpolator
13
+ (#any-of? @interpolator "fr" "infix" "sql" "sqlu"))
14
+ (interpolated_string) @injection.content
15
+ (#set! injection.language "sql"))
16
+
@@ -0,0 +1,14 @@
1
+ (template_body) @local.scope
2
+ (lambda_expression) @local.scope
3
+
4
+
5
+ (function_declaration
6
+ name: (identifier) @local.definition.function) @local.scope
7
+
8
+ (function_definition
9
+ name: (identifier) @local.definition.function)
10
+
11
+ (parameter
12
+ name: (identifier) @local.definition.variable.parameter)
13
+
14
+ (identifier) @local.reference