Find a file
KJ7LNW d7ad9470e2
Tree-sitter Enhancements: TSX, TypeScript, JSON, and Markdown Support (#2169)
* feat: add Tree-sitter TSX query support

Added support for parsing TSX files with Tree-sitter:
- Created TSX query patterns for React components and functions
- Fixed field name issues by using direct node matching
- Added comprehensive documentation about TSX component structure
- Created a debug tool to inspect the actual tree structure
- Added test coverage for TSX parsing
- Embedded test fixture directly in the test file

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: combine TypeScript and TSX queries

Reduce duplication by:
- Import TypeScript queries from typescript.ts
- Keep only TSX-specific component and JSX queries
- Update documentation to reflect combined approach

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: update integration for parse definitions

- Adjusted logParseResult to call the actual parse definitions function using WASM from initializeWorkingParser.
- Patched TreeSitter initialization to resolve the WASM path correctly and bypass redundant init() calls.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: should successfully call parseSourceCodeDefinitionsForFile

Mock loadRequiredLanguageParsers to use real parser instance from initializeTreeSitter,
ensuring proper interaction between parseSourceCodeDefinitionsForFile and its dependencies.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: improve test structure for parseSourceCodeDefinitions

- Combine component parsing tests into a single test case
- Update test assertions to match actual parser output
- Fix interface and component definition tests to use VSCodeCheckbox as sample

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: improve React component detection in tree-sitter

- Add tests for complex TSX structures (nested components, HOCs)
- Enhance TSX queries to better detect React components
- Document current limitations in test file

* feat: improve React component detection in TSX files

Make TSX/React component detection more generic and robust by:
- Implementing structural pattern matching instead of specific React wrapper functions
- Adding configurable line threshold for React component inclusion (MIN_COMPONENT_LINES)
- Adding robust HTML element filtering with regex patterns
- Improving React component name handling for nested components
- Ensuring proper context handling for multi-line React components

Also update mock captures in tree-sitter tests to span at least 4 lines
to meet the MIN_COMPONENT_LINES threshold.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: use testParseSourceCodeDefinitions in logParseResult

- Moved testParseSourceCodeDefinitions function to top level
- Updated logParseResult to use testParseSourceCodeDefinitions
- Removed duplicate function from describe block
- Added console.log for debugging output

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: improve React component detection output format

- Remove individual line output for components that don't meet MIN_COMPONENT_LINES threshold
- Update tests to match the new behavior where lines < MIN_COMPONENT_LINES are skipped
- Maintain range output (e.g., 1--4) for component definitions
- Preserve context for larger definitions as ranges only

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add switch/case statement support to tree-sitter TypeScript parser

- Added node patterns in typescript.ts query to capture switch statements, case clauses, and default clauses
- Modified index.ts to avoid duplicate line ranges in the output
- Added test for switch/case statements with complex case blocks
- Fixed line range tracking to prevent duplicate output

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add support for enum declarations in tree-sitter TypeScript parser

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add support for namespace declarations in tree-sitter TypeScript parser

Added query pattern for namespace declarations (internal_module nodes) in the TypeScript parser.
This allows the parser to identify and extract namespace declarations from TypeScript code.

- Added test case to verify namespace parsing functionality
- Added query pattern to capture namespace declarations in typescript.ts

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add decorator pattern support to tree-sitter TypeScript parser

- Added support for parsing complex decorators with arguments
- Added test case for Component decorator pattern
- Enhanced TypeScript queries to capture decorator definitions

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: add generic type declaration support to tree-sitter TypeScript parser

- Added support for parsing generic types with constraints
- Added test case for Dictionary<K extends string | number, V> pattern
- Enhanced TypeScript queries to capture generic type definitions

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: add conditional type support to tree-sitter TypeScript parser

- Added test case for conditional type patterns like ReturnType<T>
- Verified that conditional types with infer keyword are already supported
- Enhanced inspectTreeStructure with detailed node inspection for debugging

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: add template literal type support to tree-sitter TypeScript parser

- Added test case for template literal type patterns like EventName<T>
- Verified that template literal types are already partially supported
- Confirmed support for complex template literal patterns in conditional types

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: implement tree-sitter compatible markdown processor

Adds a special case implementation for markdown files that:
- Parses markdown headers and section line ranges
- Returns captures in a format compatible with tree-sitter
- Integrates with the existing parseFile function
- Includes comprehensive tests for the implementation

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* fix: markdown parser not detecting sections with horizontal rules

The markdownParser was incorrectly interpreting horizontal rules (---) as setext headers when they appeared after non-header text. This caused some sections to be missed in the output.

This fix:
- Makes setext header detection more strict by requiring at least 3 = or - characters
- Adds validation for the text line before a potential setext header
- Ensures horizontal rules are not confused with setext headers

Added a test case to verify the fix works correctly with horizontal rules.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* refactor: move helper functions to dedicated file

Move test helper functions from parseSourceCodeDefinitions.test.ts to a new helpers.ts file.
Rename test file to parseSourceCodeDefinitions.tsx.test.ts to indicate it's for TSX tests.
This improves code organization by separating test helpers from test cases.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: enable JSON structure display in list_code_definitions

This change allows list_code_definitions to show JSON structures by:
- Moving JSON query patterns into the JavaScript query file
- Using the JavaScript parser for JSON files
- Removing the separate JSON parser implementation
- Adding comprehensive tests for JSON parsing

Example output for a JSON file:
# test.json
0--90 | {
1--9 |   "server": {
4--8 |     "ssl": {
10--45 |   "database": {
11--24 |     "primary": {
14--18 |       "credentials": {
19--23 |       "pool": {
25--44 |     "replicas": [
26--43 |       {
30--42 |         "status": {
33--41 |           "metrics": {
36--40 |             "connections": {
46--73 |   "features": {
47--72 |     "auth": {
48--71 |       "providers": {
49--53 |         "local": {
54--70 |         "oauth": {
56--69 |           "providers": [
57--68 |             {

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* fix: Add compile step to CI workflow to ensure WASM files are available

The TreeSitter tests were failing in CI because the WASM files weren't being copied to the dist directory before running the tests. This adds an explicit compile step to ensure the WASM files are properly built and copied.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* fix: improve tree-sitter test type safety and debug logging

- Replace 'any' types with proper Parser types in helpers.ts
- Add centralized DEBUG flag and debugLog function in helpers.ts
- Update all console.log statements to use debugLog across all test files
- This change appeases @ellipsis-dev by improving type safety and
  providing a clean way to control debug logging

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

---------

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
2025-03-31 23:34:06 -05:00
.changeset Fix Tests to run properly on Windows (#1963) 2025-03-31 23:17:56 -05:00
.github Tree-sitter Enhancements: TSX, TypeScript, JSON, and Markdown Support (#2169) 2025-03-31 23:34:06 -05:00
.husky Automatically generate roo-code.d.ts (including type generation via zod-to-ts) (#2024) 2025-03-27 09:38:56 -07:00
.vscode Settings tweaks: add terminal & language sections, fix whell scroll in editor tab (#1763) 2025-03-18 00:11:57 -07:00
assets Update app icon (#2166) 2025-03-31 22:24:48 -05:00
audio Play sound effects for notifications and events (#38) 2024-12-01 22:25:10 -05:00
benchmark Update benchmark/prompts/cpp.md 2025-03-17 10:10:08 -07:00
cline_docs Prettier backfill 2025-01-17 14:11:28 -05:00
e2e Automatically generate roo-code.d.ts (including type generation via zod-to-ts) (#2024) 2025-03-27 09:38:56 -07:00
locales v3.11.0 (#2136) 2025-03-31 00:19:56 -04:00
scripts Fix Tests to run properly on Windows (#1963) 2025-03-31 23:17:56 -05:00
src Tree-sitter Enhancements: TSX, TypeScript, JSON, and Markdown Support (#2169) 2025-03-31 23:34:06 -05:00
webview-ui Revert "feat @-mention window path style & file with space (#1924)" (#2162) 2025-03-31 15:56:47 -05:00
.clinerules Update .clinerules 2025-03-07 16:27:53 -05:00
.dockerignore Evals 2025-03-17 10:09:19 -07:00
.env.sample App tab layout fixes 2025-03-09 15:07:59 -07:00
.eslintrc.json Rename ClineAPI to RooCodeAPI and improve types 2025-03-10 11:16:38 -07:00
.git-blame-ignore-revs Custom modes 2025-01-21 09:39:54 -05:00
.gitattributes Add new demo 2024-10-09 02:30:38 -04:00
.gitconfig Set up ignoring revisions for git blame 2025-01-17 11:21:25 -08:00
.gitignore In-Editor Browser Improvements (#1601) 2025-03-29 00:46:01 -04:00
.npmrc Adding basic npmrc file to avoid code artifact issues 2024-12-10 13:55:42 -08:00
.nvmrc Require node v20 everywhere (#922) 2025-03-19 10:46:40 -07:00
.prettierignore Chore: Prettier for consistant formatting (#794) 2024-11-21 13:13:54 -08:00
.prettierrc.json Chore: Prettier for consistant formatting (#794) 2024-11-21 13:13:54 -08:00
.rooignore Add telemetry and privacy policy 2025-03-07 03:03:44 -05:00
.roomodes Interpolate settings link in telemetry banner (#1873) 2025-03-21 09:58:25 -04:00
.vscodeignore Welcome page OAuth (#1913) 2025-03-23 10:08:16 -04:00
CHANGELOG.md Changeset version bump (#2163) 2025-03-31 16:11:17 -05:00
CODE_OF_CONDUCT.md Update email and attribution 2025-03-14 12:16:04 -04:00
CONTRIBUTING.md Add roadmap to CONTRIBUTING (#1883) 2025-03-21 12:27:48 -04:00
ellipsis.yaml Revert "Turn off ellipsis quiet mode" 2025-03-07 02:26:25 -05:00
esbuild.js Extension-side internationalization (#1757) 2025-03-18 10:39:21 -04:00
flake.lock Run integration tests in CI 2025-01-31 14:12:21 -08:00
flake.nix Require node v20 everywhere (#922) 2025-03-19 10:46:40 -07:00
jest.config.js Fix Tests to run properly on Windows (#1963) 2025-03-31 23:17:56 -05:00
knip.json Evals 2025-03-17 10:09:19 -07:00
LICENSE Custom modes 2025-01-21 09:39:54 -05:00
package-lock.json Changeset version bump (#2163) 2025-03-31 16:11:17 -05:00
package.json Fix Tests to run properly on Windows (#1963) 2025-03-31 23:17:56 -05:00
PRIVACY.md Add telemetry and privacy policy 2025-03-07 03:03:44 -05:00
README.md v3.11.0 (#2136) 2025-03-31 00:19:56 -04:00
tsconfig.json GHA fixes 2024-12-16 15:28:37 -08:00


Join the Roo Code Community

Connect with developers, contribute ideas, and stay ahead with the latest AI-powered coding tools.

Join Discord Join Reddit



Roo Code (prev. Roo Cline)

Download on VS Marketplace Feature Requests Rate & Review Documentation

Roo Code is an AI-powered autonomous coding agent that lives in your editor. It can:

  • Communicate in natural language
  • Read and write files directly in your workspace
  • Run terminal commands
  • Automate browser actions
  • Integrate with any OpenAI-compatible or custom API/model
  • Adapt its “personality” and capabilities through Custom Modes

Whether you’re seeking a flexible coding partner, a system architect, or specialized roles like a QA engineer or product manager, Roo Code can help you build software more efficiently.

Check out the CHANGELOG for detailed updates and fixes.


🎉 Roo Code 3.11 Released

Roo Code 3.11 brings significant performance improvements and new features!

  • Fast Edits - Edits now apply way faster. Less waiting, more coding.
  • API Key Balances - View your OpenRouter and Requesty balances in settings.
  • Project-Level MCP Config - Now you can configure it per project/workspace.
  • Improved Gemini Support - Smarter retries, fixed escaping, added to Vertex provider.
  • Import/Export Settings - Easily back up or share your config across setups.

What Can Roo Code Do?

  • 🚀 Generate Code from natural language descriptions
  • 🔧 Refactor & Debug existing code
  • 📝 Write & Update documentation
  • 🤔 Answer Questions about your codebase
  • 🔄 Automate repetitive tasks
  • 🏗️ Create new files and projects

Quick Start

  1. Install Roo Code
  2. Connect Your AI Provider
  3. Try Your First Task

Key Features

Multiple Modes

Roo Code adapts to your needs with specialized modes:

  • Code Mode: For general-purpose coding tasks
  • Architect Mode: For planning and technical leadership
  • Ask Mode: For answering questions and providing information
  • Debug Mode: For systematic problem diagnosis
  • Custom Modes: Create unlimited specialized personas for security auditing, performance optimization, documentation, or any other task

Smart Tools

Roo Code comes with powerful tools that can:

  • Read and write files in your project
  • Execute commands in your VS Code terminal
  • Control a web browser
  • Use external tools via MCP (Model Context Protocol)

MCP extends Roo Code's capabilities by allowing you to add unlimited custom tools. Integrate with external APIs, connect to databases, or create specialized development tools - MCP provides the framework to expand Roo Code's functionality to meet your specific needs.

Customization

Make Roo Code work your way with:

Resources

Documentation

Community


Local Setup & Development

  1. Clone the repo:
git clone https://github.com/RooVetGit/Roo-Code.git
  1. Install dependencies:
npm run install:all
  1. Start the webview (Vite/React app with HMR):
npm run dev
  1. Debug: Press F5 (or Run → Start Debugging) in VSCode to open a new session with Roo Code loaded.

Changes to the webview will appear immediately. Changes to the core extension will require a restart of the extension host.

Alternatively you can build a .vsix and install it directly in VSCode:

npm run build

A .vsix file will appear in the bin/ directory which can be installed with:

code --install-extension bin/roo-cline-<version>.vsix

We use changesets for versioning and publishing. Check our CHANGELOG.md for release notes.


Disclaimer

Please note that Roo Veterinary, Inc does not make any representations or warranties regarding any code, models, or other tools provided or made available in connection with Roo Code, any associated third-party tools, or any resulting outputs. You assume all risks associated with the use of any such tools or outputs; such tools are provided on an "AS IS" and "AS AVAILABLE" basis. Such risks may include, without limitation, intellectual property infringement, cyber vulnerabilities or attacks, bias, inaccuracies, errors, defects, viruses, downtime, property loss or damage, and/or personal injury. You are solely responsible for your use of any such tools or outputs (including, without limitation, the legality, appropriateness, and results thereof).


Contributing

We love community contributions! Get started by reading our CONTRIBUTING.md.


Contributors

Thanks to all our contributors who have helped make Roo Code better!

mrubens
mrubens
saoudrizwan
saoudrizwan
cte
cte
samhvw8
samhvw8
daniel-lxs
daniel-lxs
a8trejo
a8trejo
ColemanRoo
ColemanRoo
stea9499
stea9499
joemanley201
joemanley201
System233
System233
nissa-seru
nissa-seru
jquanton
jquanton
hannesrudolph
hannesrudolph
NyxJae
NyxJae
MuriloFP
MuriloFP
punkpeye
punkpeye
d-oit
d-oit
monotykamary
monotykamary
cannuri
cannuri
lloydchang
lloydchang
feifei325
feifei325
vigneshsubbiah16
vigneshsubbiah16
KJ7LNW
KJ7LNW
Szpadel
Szpadel
lupuletic
lupuletic
qdaxb
qdaxb
wkordalski
wkordalski
Smartsheet-JB-Brown
Smartsheet-JB-Brown
Premshay
Premshay
psv2522
psv2522
olweraltuve
olweraltuve
RaySinner
RaySinner
aheizi
aheizi
afshawnlotfi
afshawnlotfi
diarmidmackenzie
diarmidmackenzie
emshvac
emshvac
pdecat
pdecat
pugazhendhi-m
pugazhendhi-m
Lunchb0ne
Lunchb0ne
sammcj
sammcj
dtrugman
dtrugman
aitoroses
aitoroses
yt3trees
yt3trees
yongjer
yongjer
vincentsong
vincentsong
teddyOOXX
teddyOOXX
eonghk
eonghk
arthurauffray
arthurauffray
heyseth
heyseth
philfung
philfung
napter
napter
mdp
mdp
Chenjiayuan195
Chenjiayuan195
jcbdev
jcbdev
GitlyHallows
GitlyHallows
benzntech
benzntech
anton-otee
anton-otee
kohii
kohii
kinandan
kinandan
jwcraig
jwcraig
im47cn
im47cn
dqroid
dqroid
dairui1
dairui1
bannzai
bannzai
ashktn
ashktn
Yoshino-Yukitaro
Yoshino-Yukitaro
vladstudio
vladstudio
tgfjt
tgfjt
maekawataiki
maekawataiki
AMHesch
AMHesch
lightrabbit
lightrabbit
olup
olup
moqimoqidea
moqimoqidea
mosleyit
mosleyit
oprstchn
oprstchn
philipnext
philipnext
refactorthis
refactorthis
samir-nimbly
samir-nimbly
shaybc
shaybc
shohei-ihaya
shohei-ihaya
student20880
student20880
cdlliuy
cdlliuy
PretzelVector
PretzelVector
nevermorec
nevermorec
adamwlarson
adamwlarson
alarno
alarno
andreastempsch
andreastempsch
Atlogit
Atlogit
bramburn
bramburn
chadgauth
chadgauth
dleen
dleen
dbasclpy
dbasclpy
snoyiatk
snoyiatk
linegel
linegel
celestial-vault
celestial-vault
franekp
franekp
DeXtroTip
DeXtroTip
gtaylor
gtaylor
hesara
hesara
eltociear
eltociear
Jdo300
Jdo300
libertyteeth
libertyteeth
mamertofabian
mamertofabian
marvijo-code
marvijo-code
kvokka
kvokka
nbihan-mediware
nbihan-mediware
PeterDaveHello
PeterDaveHello
Sarke
Sarke
01Rian
01Rian
samsilveira
samsilveira
StevenTCramer
StevenTCramer

License

Apache 2.0 © 2025 Roo Veterinary, Inc.


Enjoy Roo Code! Whether you keep it on a short leash or let it roam autonomously, we can’t wait to see what you build. If you have questions or feature ideas, drop by our Reddit community or Discord. Happy coding!