* refactor: standardize C# Tree-Sitter parser tests
This commit standardizes the C# Tree-Sitter parser tests to ensure:
- Variable/function names in sample code match the tests
- Each test only verifies specific identifiers relevant to that test
- Test names clearly indicate what they're testing
- No skipped tests remain
- Only one test exists per structure or combination of structures
- All debug output uses debugLog from helpers.ts
The standardization improves maintainability and clarity while preserving
all existing functionality.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: standardize C Tree-Sitter parser tests
This commit standardizes the C Tree-Sitter parser tests to ensure:
- Variable/function names in sample code match the tests (using snake_case)
- Each test only verifies specific identifiers relevant to that test
- Test names clearly indicate what they're testing
- No skipped tests remain - tests for unsupported features are removed
- Only one test exists per structure or combination of structures
- All debug output uses debugLog from helpers.ts
The standardization improves maintainability and clarity while preserving
all existing functionality. Documentation has been added for C language
constructs that are not currently supported by the parser.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: standardize Kotlin Tree-Sitter parser
Standardized Kotlin Tree-Sitter parser to ensure consistent naming and structure:
- Renamed identifiers to clearly indicate what they're testing
- Ensured all code sections are at least 4 lines long
- Organized query patterns logically with clear comments
- Removed skipped tests and unused query patterns
- Ensured only one test per structure or combination of structures
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: standardize PHP Tree-Sitter parser
Standardized PHP Tree-Sitter parser to ensure consistent naming and structure:
- Renamed identifiers to clearly indicate what they're testing
- Ensured all code sections are at least 4 lines long
- Organized query patterns logically with clear comments
- Consolidated related tests to ensure only one test per structure
- Ensured all debug output uses debugLog from helpers.ts
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: standardize Ruby Tree-Sitter parser
Standardized Ruby Tree-Sitter parser to ensure consistent naming and structure:
- Expanded query to support many more Ruby language constructs
- Added comprehensive test file with clear section headers
- Ensured all code sections are at least 4 lines long
- Added tests for each language construct
- Used consistent naming conventions for test identifiers
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: standardize Swift Tree-Sitter parser
Standardized Swift Tree-Sitter parser to ensure consistent naming and structure:
- Renamed identifiers to clearly indicate what they're testing
- Ensured all code sections are at least 4 lines long
- Organized query patterns logically with clear comments
- Removed skipped tests and unused query patterns
- Ensured only one test per structure or combination of structures
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: dynamically include all tree-sitter WASM files in build process
- Modified esbuild.js to dynamically read and copy all WASM files from tree-sitter-wasms package
- Added error handling and logging for better debugging
- Ensures all language parsers are automatically included without requiring manual updates
* refactor: move test mocks and fixtures to shared locations
Move test mocks to helpers.ts to be shared between test files
Create fixtures directory for shared test data
Move sample TSX content to fixtures/sample-tsx.ts
Update test files to use shared mocks and fixtures
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: simplify tree-sitter debug output
- Remove detailed node inspection to reduce noise
- Keep only essential tree structure output
- Remove duplicate content logging
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: standardize C# tree-sitter test structure
Move C# sample code to dedicated fixture file and create inspectCSharp test
following the same pattern as other language tests. This improves test
organization and maintainability by:
- Extracting sample C# code to fixtures/sample-c-sharp.ts
- Adding inspectCSharp.test.ts for tree structure inspection
- Updating parseSourceCodeDefinitions.c-sharp.test.ts to use fixture
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: add language-specific capture processing
- Add language parameter to processCaptures for language-specific handling
- Implement selective HTML filtering for jsx/tsx files
- Update all call sites to pass correct language parameter
- Fix type safety by properly passing language strings
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: move tree-sitter test samples to fixtures
Move sample code from parseSourceCodeDefinitions test files into dedicated
fixtures directory for better organization and reuse:
- Created fixtures directory for language samples
- Moved sample code for C#, C, JSON, Kotlin, PHP, Ruby, Rust, and Swift
- Created inspect test files for each language
- Updated original test files to import from fixtures
- Standardized test options across languages
- No behavior changes, all tests passing
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: standardize tree-sitter test code across languages
Standardize test code structure and naming across all language parsers:
- Rename identifiers to clearly indicate test purpose
- Ensure each code section has descriptive comments
- Group related code sections together
- Maintain language-specific naming conventions
- Keep test structure consistent across languages
- Remove tests for unsupported features
Changes made to:
- C, JSON, Kotlin, PHP, Ruby, Rust, and Swift test files
- Sample code fixtures
- Parser definition tests
- Inspect structure tests
No functional changes - all tests passing with improved maintainability.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: standardize tree-sitter parser tests across all languages
- Ensure all test structures span at least 4 lines for better parsing
- Create exactly one consolidated test per data structure type
- Use descriptive names that clearly indicate test purpose
- Improve query pattern organization and documentation
- Simplify inspect test files to focus on structure validation
- Implement result caching in test files for better performance
- Remove duplicate and skipped tests
- Follow consistent naming conventions across all languages
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* first pass all but elm-bash
* test: inspectTreeStructure helper now returns a string
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: establish single source of truth for MIN_COMPONENT_LINES
- Move minComponentLines parameter to a file-level constant
- Remove parameter passing to processCaptures function
- Update all references to use the global constant
- Remove redundant local constant declaration in parseFile
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: improve MIN_COMPONENT_LINES implementation
- Changed MIN_COMPONENT_LINES constant to use getter/setter functions
- Updated references to use getMinComponentLines() function
- Modified test helper to set value to 0 during tests
- This establishes a single source of truth while making testing easier
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: standardize tree-sitter test implementations
Standardized tree-sitter test implementations across all supported languages:
- Removed debugLog calls from test files
- Implemented consistent line number pattern matching
- Ensured proper test structure and execution order
- Added comprehensive test coverage for supported structures
- Maintained 1:1 mapping between queries, tests and samples
- Documented unsupported features in TODO sections
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* docs: document tree-sitter parseable but unsupported structures
Added TODO sections in test files documenting structures that can be parsed
by tree-sitter but currently lack query pattern support:
- Python: f-strings, complex type annotations, pattern matching
- C++: virtual methods, field initializers, base class clauses
- Java: import declarations, field declarations with modifiers
- TSX: React hooks, context providers, event handlers
Added examples and clarifying comments to existing TODO sections.
Enhanced Java query patterns for better structure capture including
lambda expressions, field declarations, and type parameters.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* fix: use correct distDir variable for WASM file copying
The copyWasmFiles plugin was using an undefined targetDir variable when copying
tree-sitter WASM files. Changed to use the correctly defined distDir variable,
fixing the build process.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* lint: remove unused imports and variables from tree-sitter tests
Removed unused imports and variables from tree-sitter test files to fix linting errors:
- Removed unused goQuery import from helpers.ts
- Removed unused imports and mockedFs variables from language-specific test files
- Cleaned up test files to only import what they use
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>
* feat: support environment variables reference in mcp `env` config
* tests(src/utils/config): add test for `injectEnv`
* fix(injectEnv): use `env == null` and `??` check instead of `!env`, `||`
* refactor: remove unnecessary type declare
* chore!: simplify regexp, remove replacement for env vars with dots
This commit significantly enhances the Python tree-sitter parser to support a comprehensive range of Python language constructs, enabling more accurate and detailed code analysis.
Key improvements:
- Added support for method definitions (instance, class, and static methods)
- Added support for decorators on functions and classes
- Added support for module-level variables and constants
- Added support for async functions and methods
- Added support for property getters/setters
- Added support for type annotations in various contexts
- Added support for dataclasses
- Added support for nested functions and classes
- Added support for generator functions
- Added support for list/dict/set comprehensions
- Added support for lambda functions
- Added support for abstract base classes and methods
The parser now handles Python's rich feature set more comprehensively, including special Python patterns like decorators, type annotations, and various comprehension types. This enables better code navigation, understanding, and analysis for Python codebases.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This enhancement significantly expands the Java parser's capabilities to recognize and parse a wide range of Java language constructs:
- Added support for enum declarations and enum constants
- Added support for annotation type declarations and elements
- Added support for field declarations
- Added support for constructor declarations
- Added support for lambda expressions
- Added support for inner and anonymous classes
- Added support for type parameters (generics)
- Added support for package and import declarations
These improvements enable more comprehensive code analysis for Java projects, providing better definition extraction and navigation capabilities.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This enhancement significantly expands the Go parser's capabilities to recognize and extract a comprehensive set of language constructs:
- Added support for struct and interface definitions with proper type identification
- Implemented parsing for constant declarations (both single and in blocks)
- Added support for variable declarations (both single and in blocks)
- Added recognition of type aliases with proper distinction from regular types
- Implemented special handling for init functions
- Added support for anonymous functions, including nested function literals
- Improved documentation and organization of query patterns
These enhancements enable more accurate code navigation, better symbol extraction, and improved code intelligence for Go codebases.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This enhancement significantly expands the C++ parser's capabilities to recognize and extract a wide range of modern C++ language constructs, improving code navigation and analysis.
New supported language constructs include:
- Union declarations and their members
- Destructors and their implementations
- Operator overloading (including stream operators)
- Free-standing and namespace-scoped functions
- Enum declarations (both traditional and scoped enum class)
- Lambda expressions and their captures
- Attributes and annotations
- Method overrides with virtual/override specifiers
- Exception specifications (noexcept)
- Default parameters in function declarations
- Variadic templates and parameter packs
- Structured bindings (C++17)
- Inline namespaces and nested namespace declarations
- Template specializations and instantiations
- Constructor implementations
This enhancement provides more comprehensive code structure analysis for C++ codebases, particularly those using modern C++ features from C++11, C++14, and C++17 standards.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
- Enhanced the Tree-Sitter parser for JavaScript/TypeScript with support for advanced language constructs
- Modified the parser to exclude comments from the output
- Consolidated sample code in tests for better maintainability
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* test: add comprehensive Rust Tree-sitter tests
Add test suite for Rust language support in Tree-sitter:
- Verify parsing of struct definitions
- Verify parsing of method definitions within impl blocks
- Verify parsing of standalone function definitions
- Add tests for complex Rust structures
- Include skipped debug test for future diagnostics
These tests confirm the existing Rust support in Tree-sitter is working correctly and provide a foundation for future enhancements to the Rust parser.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat: enhance Rust tree-sitter parser with advanced language structures
- Add support for additional Rust language structures:
- Enum definitions
- Trait definitions
- Impl trait for struct
- Generic structs with lifetime parameters
- Macro definitions
- Module definitions
- Union types
- Closures
- Match expressions
- Where clauses
- Async functions
- Impl blocks with generic parameters
- Complex trait bounds
- Update tests to verify capture of these structures
- Modify debug helper to use environment variables
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>
Problem:
Closing auxiliary windows (e.g., from "open in editor") could prematurely dispose the shared singleton McpHub instance, shutting down MCP servers unexpectedly while other panels (like the sidebar) might still be active.
Solution:
Implemented reference counting directly within the McpHub class to manage its own lifecycle based on active clients (ClineProvider instances).
- Added `refCount`, `registerClient()`, and `unregisterClient()` methods to McpHub.
- McpHub now disposes itself only when the last registered client unregisters (`refCount` reaches 0).
- ClineProvider instances now call `mcpHub.registerClient()` upon initialization and `mcpHub.unregisterClient()` upon disposal.
- Removed the direct `mcpHub.dispose()` call from ClineProvider.dispose.
Benefit:
This ensures the shared McpHub instance remains active as long as at least one ClineProvider instance is using it. Cleanup now correctly occurs only when the last provider is closed or during full extension deactivation. This centralizes the resource's lifecycle logic within the resource class itself.
Files Changed:
- src/services/mcp/McpHub.ts
- src/core/webview/ClineProvider.ts
* 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>
* fix: remove -p flag from test script to prevent git operation errors
The -p flag in npm-run-all was causing tests to run in parallel, which led to 'Cannot log after tests are done' errors with git operations. These errors don't appear when running test:extension alone.
The issue occurs because git-based tests create temporary directories and run async operations that can interfere with each other when executed in parallel. Running tests sequentially resolves this cleanly.
While it might increase total test time slightly, it ensures more reliable and consistent test results.
* refactor(terminal): improve mock streams and fix test issues
- Create shell-specific mock streams (bash, cmd, pwsh) with proper line ending handling
- Fix open handles in tests by properly managing timeouts
- Standardize stderr redirection across all shell implementations using stdio option
- Improve test reliability and output cleanliness
* fix(tests): add skipVerification option to PowerShell tests to debug Linux issues
* fix(tests): use explicit variable name in PowerShell test to fix Linux compatibility
* Refactor terminal tests to use purpose-based approach instead of command mapping
* Remove reference to non-existent test file
* fix: use printf instead of echo -e for more consistent behavior across platforms
* fix: use single quotes for PowerShell commands to preserve variables on Linux
* Update code-qa workflow to run tests on both Windows and Ubuntu
* fix: use platform-specific PowerShell command execution for Linux and Windows
* Fix toggleToolAlwaysAllow to handle path normalization for cross-platform compatibility
* Fix McpHub tests to handle normalized paths on Windows
* Suppress console.error messages in McpHub tests
* fix: make Bedrock ARN regex patterns Windows-compatible
Fixed an issue where AWS Bedrock tests were timing out on Windows but passing on Linux. The root cause was path separator handling in regex patterns used for model ID extraction from ARNs.
1. Updated model ID extraction regex to handle both forward slashes (Linux) and backslashes (Windows)
2. Modified ARN matching regex to be platform-independent
3. Ensured consistent region prefix handling for all supported regions
This change maintains functionality while ensuring cross-platform compatibility.
* fix: make WorkspaceTracker test cross-platform compatible
Fixed an issue where the WorkspaceTracker test 'should initialize with workspace files' was failing on Windows but passing on Linux. The problem was in the mock implementation of toRelativePath that only handled forward slashes.
- Updated the toRelativePath mock to use path.relative which properly handles platform-specific path separators
- Ensured all paths are converted to forward slashes for consistency in test assertions
- The fix maintains cross-platform compatibility while preserving the test's intent
* fix: make WorkspaceTracker tests cross-platform compatible
Fixed cross-platform compatibility issues in the WorkspaceTracker tests that were causing failures on Windows but passing on Linux:
1. Updated the toRelativePath mock implementation to:
- Use path.relative which properly handles platform-specific path separators
- Convert paths to forward slashes for consistency in test assertions
2. Enhanced the 'should not update file paths' test to be platform-agnostic by:
- Using more flexible assertions that don't depend on specific path formats
- Checking file path length and content rather than exact string matches
- Properly typed the test assertions to fix TypeScript errors
These changes preserve the test intent while ensuring they run successfully across different operating systems.
* fix: make McpHub tests cross-platform compatible
Fixed cross-platform compatibility issues in the McpHub tests that were causing failures on Windows but passing on Linux:
1. Made the toggleToolAlwaysAllow tests more platform-agnostic by:
- No longer relying on specific path formats which differ between Windows and Linux
- Using the last write call instead of searching for a specific path string
- Adding more robust assertions that verify structure instead of exact path matches
- Properly handling array existence checks
2. These tests would fail on Windows because paths are formatted with backslashes instead of
forward slashes, causing path equality checks to fail.
The changes maintain test intent while ensuring cross-platform compatibility.
* handle escaping of slash and quote
* fix: ensure consistent line endings in git fallback strategy
Fixed an issue where tests would fail on GitHub Windows runners but pass on local Windows machines due to line ending differences. The fix ensures consistent line ending handling by:
1. Normalizing CRLF to LF when reading files in the git fallback strategy
2. Disabling Git's automatic line ending conversion
3. Maintaining consistent line ending usage throughout text operations
* feat: run tests sequentially on Windows, parallel otherwise
* Browser Automation Improvements
* Added multi-tab remote Chrome support
* Added support for hover
* Properly caching remote browser host in global state
* Cleanup functions
* Updated for changes after merge
* Added www. exception for common tabs
* Update src/core/webview/ClineProvider.ts
* Revert README changes
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
* support project-level mcp config
* switch the toasts to English
fix test
(cherry picked from commit 26941dcaae)
* add i18n for project mcp
(cherry picked from commit 792a8225c1)
* optimize McpHub.ts
* fix merge main into head
* fix project mcp
* partial update mcp config
* fix toggleToolAlwaysAllow
* Modify mcp to support project and global of the same name
* fix ut
* remove unused mcp log
* i18n for mcp
* Revert README changes
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
* #906 Add watchPaths option to McpHub for file change detection
* #906 Refactor file watcher management in McpHub
add support multiple watchers per server.
modified the setupFileWatcher method to properly handle asynchronous operations and prevent unhandled promise rejections.
error handling now includes specific error messages that identify exactly where the error occurred.
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
Use compact line number format matching read_file/search_files to:
- Reduce token usage in AI responses
- Simplify output parsing
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
* Replace hardcoded custom modes filename with GlobalFileNames constant
* Remove 'cline' prefix from mcpSettings filename
* Use GlobalFileNames.customModes in modes.ts
* replace two more `cline_mcp_settings` with `mcp_settings` in tests.
* feat: add settings file migration for new file naming convention
- Implement migrateSettings function to rename legacy settings files to new format
- Migrate cline_custom_modes.json to new custom modes filename
- Migrate cline_mcp_settings.json to new MCP settings filename
- Add TODO to remove migration code in September 2025 (6 months after implementation)
- Make activate function async to support migration on startup
* Add associated changeset
* removed unused import
* refactor: move migrateSettings to dedicated utility file
- Extract migrateSettings function from extension.ts to src/utils/migrateSettings.ts
- Update extension.ts to import and use the extracted function
- Update tests to use the real implementation
- Improve dependency injection by passing outputChannel as parameter
- Enhance maintainability by isolating temporary migration code (to be removed Sept 2025)
* Update src/extension.ts
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
Problem:
- Previous implementation incorrectly grouped context lines with matches
- Context lines were split into beforeContext/afterContext arrays, making it difficult to maintain proper line order
- Output format was inconsistent with read_file output
- Non-contiguous search results were sometimes broken or incorrectly grouped
- Example of incorrect output:
# bench/bundle-test/rollup.config.mjs
16 | file: 'dist/index-wasm.min.mjs',
17 | format: 'es',
24 | output: {
----
25 | file: 'dist/index-lite.min.mjs',
26 | format: 'es',
----
# packages/rehype/package.json
----
10 | it('run', async () => {
27 | "files": [
28 | "dist"
----
Solution:
- Replace separate context arrays with a single 'lines' array containing both matches and context
- Add isMatch flag to distinguish between match and context lines
- Improve contiguity detection by checking if line numbers are sequential
- Standardize output format to match read_file output
- Properly handle non-contiguous search results by creating new result groups
- Example of correct output:
# bench/bundle-test/rollup.config.mjs
16 | file: 'dist/index-wasm.min.mjs',
17 | format: 'es',
----
24 | output: {
25 | file: 'dist/index-lite.min.mjs',
26 | format: 'es',
----
This change ensures search results are properly grouped and displayed with the correct context.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat read file range
feat: add file truncation with code structure preview
Add configurable line limit for large file handling with source code structure preview. This improves performance and memory usage while maintaining code readability.
Key changes:
Add maxReadFileLine setting (default: 4500) with UI controls
Create efficient line counter utility using streams
Add parseSourceCodeDefinitionsForFile for single file parsing
Show truncation notice with code structure for large files
Add comprehensive tests for new functionality
Move file extensions to shared constant
add line number
pr comment
Return definition ranges from tree-sitter
make treesitter always add line
add line number to rg search
enhance tree siter output & fix test
update snapshot
fix test
* Add translations, tweak range
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>