* fix: addLineNumbers handling of empty content
Empty files should not have line numbers, but non-empty files with empty content at a specific line offset should.
- If content is empty, return empty string for empty files
- If content is empty but startLine > 1, return line number for empty content at that offset
This ensures that the model does not think the file contains a single empty line.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* refactor: improve readFileTool XML output format
- Remove unnecessary XML indentation that could confuse the model
- Separate file content from notices and errors using dedicated tags
- Add line range information to content tags
- Handle empty files properly with self-closing tags
- Add comprehensive test coverage
Fixes#2278
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* fix: always show line numbers in read_file XML output
- Always display line numbers in non-range reads
- Improve XML formatting with consistent newlines for better readability
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* test: update tests to match new XML format with line numbers
- Update test expectations to match the new XML format with newlines
- Update tests to expect line numbers attribute in content tags
- Modify test assertions to check for the correct line range values
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* fix: consistent blank line handling in addLineNumbers
- Add newline to all output
- Handle trailing newlines and empty lines consistently
- Add test cases for blank lines:
- Multiple blank lines within content
- Multiple trailing blank lines
- Only blank lines with offset
- Trailing newlines
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* test: use actual addLineNumbers in read-file-xml tests
- Modified extract-text mock to preserve actual addLineNumbers implementation
- Removed mock implementation of addLineNumbers
- Updated test data to account for trailing newline
- Removed unnecessary mock verification
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* test: ensure actual addLineNumbers function is called in tests
- Replace direct mocking of addLineNumbers with spy on actual implementation
- Add verification to ensure the real function is called when appropriate
- Add skipAddLineNumbersCheck option for cases where function should not be called
- Update test cases to use appropriate verification options
- Fix numberedFileContent to include trailing newline for consistency
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* fix: modify readLines to process data directly instead of line by line
- Direct data processing provides more accurate results by preserving exact content with carriage returns
- Improved performance through minimal buffering and efficient string operations
- Use string indexes to find newlines while maintaining their original format
- Handle all edge cases correctly with preserved line endings
- Add tests for various edge cases including empty files, single lines, and different line endings
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* test: remove unused mockInputContent variable
Remove unused variable declaration to appease ellipsis-dev linter requirements.
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: clarify difference between workspace directory and terminal working directory
This commit addresses confusion between the VS Code workspace directory and
terminal working directory. Roo was not properly distinguishing between these
concepts, leading to issues when terminal commands changed directories.
- Renamed 'Current Working Directory' to 'Current Workspace Directory' throughout
- Added clearer notice when a command changes the working directory in a terminal
- Added explanation about the difference between workspace and working directories
- Updated all tool descriptions to reference 'workspace directory'
References: https://www.reddit.com/r/RooCode/s/6L19EvsFbF
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
* test: update directory terminology in test files
Update terminology from 'working directory' to 'workspace directory' in tests
to reflect VSCode's concept of workspace vs working directory.
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>
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>
* Directly use provider rateLimitSeconds and remove uneeded default
* remove a bunch of unused rateLimitSeconds references
* rateLimitSettings field def in GlobalSettingsRecord isn't needed for migration
Implements a solution for the Vite port collision issue that allows easier development of Roo across multiple instances of VSCode in different Roo repository directories.
This may also fix crashes and strange behavior between multiple running instances that would otherwise create port conflicts. This is solved using the following automated process:
- When Vite automatically selects an alternative port, a custom plugin automatically writes the port to a '.vite-port' file in the repository root
- ClineProvider automatically reads the port from this file, falling back gracefully to port 5173 if the file doesn't exist
- No user intervention is necessary as the entire process is handled automatically
- Added detailed logging for debugging
- Added .vite-port to .gitignore
The extension now connects to the correct Vite development server port automatically, even when the default port (5173) is already in use.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
* Added Gemini 2.5 Pro model to Vertex AI Provider
* Adds Gemini 2.5 Pro preview model
Adds configuration for the new Gemini 2.5 Pro preview model,
including its token limits, context window size, image support, and
pricing information.
* feat: enhance rule file loading with .roo/rules directory support
- Introduced functions to safely read files and check for directory existence.
- Added capability to read all text files from a specified directory in alphabetical order.
- Updated `loadRuleFiles` to prioritize loading rules from a `.roo/rules/` directory, falling back to existing rule files if necessary.
- Enhanced `addCustomInstructions` to support loading mode-specific rules from a `.roo/rules-{mode}/` directory, improving flexibility in rule management.
This change improves the organization and retrieval of rule files, allowing for better modularity and maintainability.
* Updated strings and translations
* Add tests
* Revert changes to system prompt translations
* Fix path resolution
* Make instruction structure clearer
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>