Repository navigation
Use tree sitter for parsing terminal auto approve sub-commands - #272281
Merged
Merged
Conversation
Daniel Imms (Tyriar)
force-pushed
the
tyriar/tree_sitter_subcommand
branch
from
October 22, 2025 12:38
e1b411e to
e5f4295
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR migrates from a string-based regex parser to Tree-sitter for parsing terminal commands into sub-commands to improve accuracy and support for shell syntax edge cases.
Key Changes:
- Adds
TreeSitterCommandParserclass to parse commands using Tree-sitter grammars for Bash and PowerShell - Extends
ITreeSitterLibraryServicewith asyncgetLanguage()andcreateQuery()methods - Updates
@vscode/tree-sitter-wasmdependency from 0.1.4 to 0.2.0 - Removes string-based sub-command splitting logic and associated test file
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/services/treeSitter/browser/treeSitterLibraryService.ts |
Adds async getLanguage() and createQuery() methods, renames sync methods with Sync suffix |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/subCommands.test.ts |
Removes entire test file for deprecated string-based parser |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts |
Removes dangerous pattern rules that blocked parentheses, braces, and backticks |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.ts |
New class implementing Tree-sitter-based command parsing |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts |
Integrates Tree-sitter parser, updates auto-approve flow with async parsing |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/subCommands.ts |
Removes entire file containing deprecated string-based parser |
src/vs/editor/test/common/services/testTreeSitterLibraryService.ts |
Updates test service to implement new interface methods |
src/vs/editor/standalone/browser/standaloneTreeSitterLibraryService.ts |
Updates standalone service to implement new interface methods |
src/vs/editor/common/services/treeSitter/treeSitterLibraryService.ts |
Adds documentation and new async methods to interface |
src/vs/editor/common/model/tokens/treeSitter/treeSitterSyntaxTokenBackend.ts |
Updates to use renamed Sync suffix methods |
package.json |
Updates tree-sitter dependency version |
eslint.config.js |
Adds type import allowance for tree-sitter-wasm |
We shouldn't show any rule suggestions if anything was denied
These work now with tree sitter
Daniel Imms (Tyriar)
marked this pull request as ready for review
October 22, 2025 21:12
Daniel Imms (Tyriar)
enabled auto-merge
October 22, 2025 21:12
roblourens
approved these changes
Oct 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #261794