|
| 1 | +--- |
| 2 | +title: What's New in v2.5.0 |
| 3 | +date: 2026-03-31 |
| 4 | +--- |
| 5 | + |
| 6 | +# What's New in RobotCode v2.5.0 |
| 7 | + |
| 8 | +This release brings **major performance improvements**, a powerful new **SQLite-based cache system**, and smarter **code completion** — making RobotCode faster and more productive than ever, especially for large projects. |
| 9 | + |
| 10 | +## Highlights |
| 11 | + |
| 12 | +### Blazing-Fast Startup with Namespace Caching |
| 13 | + |
| 14 | +The biggest highlight of this release is the new **namespace disk cache**. RobotCode now caches fully resolved namespace data to a SQLite database, so on subsequent IDE starts cached namespaces are reused instead of re-analyzing every file from scratch. This dramatically reduces the time until diagnostics, code completion, and navigation become available — especially in large workspaces with hundreds of Robot files. |
| 15 | + |
| 16 | +- **Enabled by default** — no configuration needed; just enjoy faster startups. |
| 17 | +- **Automatic invalidation** — the cache is rebuilt when source files, library dependencies, environment variables, command-line variables, language settings, or the RobotCode version change. |
| 18 | +- **SQLite backend** — all cache entries are consolidated into a single SQLite database per workspace, replacing the old scattered `.pkl` files. |
| 19 | +- **Advisory file locking** — concurrent access from multiple processes (language server, CLI, analyze) is safe thanks to `fcntl.flock`-based locking. |
| 20 | + |
| 21 | +### Cache Management CLI |
| 22 | + |
| 23 | +A new `robotcode analyze cache` command group gives you full control over the cache: |
| 24 | + |
| 25 | +| Command | Description | |
| 26 | +|---------|-------------| |
| 27 | +| `path` | Print the resolved cache directory | |
| 28 | +| `info` | Show cache statistics with per-section breakdown | |
| 29 | +| `list` | List cached entries with glob pattern filtering (`-p`) | |
| 30 | +| `clear` | Remove cached entries by section | |
| 31 | +| `prune` | Delete the entire cache database | |
| 32 | + |
| 33 | +You can also override the cache location via the `ROBOTCODE_CACHE_DIR` environment variable — the VS Code extension sets this automatically in the integrated terminal. |
| 34 | + |
| 35 | +### Code Completion for `Literal` Type Hints |
| 36 | + |
| 37 | +Keywords with `Literal["fast", "slow", "auto"]` type hints now show their allowed values directly in the completion list. No more switching to documentation just to find valid argument values. Supports `Union` types containing `Literal` as well. |
| 38 | + |
| 39 | +### Unused Keywords & Variables Detection on CLI |
| 40 | + |
| 41 | +The `robotcode analyze code` command now supports collecting unused keyword and variable diagnostics. Enable it in `robot.toml`: |
| 42 | + |
| 43 | +```toml |
| 44 | +[tool.robotcode-analyze.code] |
| 45 | +collect-unused = true |
| 46 | +``` |
| 47 | + |
| 48 | +Or use the CLI flags directly: |
| 49 | + |
| 50 | +```bash |
| 51 | +robotcode analyze code --collect-unused |
| 52 | +robotcode analyze code --no-collect-unused |
| 53 | +``` |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## Performance |
| 58 | + |
| 59 | +This release includes a wave of performance optimizations that significantly reduce analysis time and memory usage: |
| 60 | + |
| 61 | +| Optimization | Impact | |
| 62 | +|---|---| |
| 63 | +| **Patch RF's `variable_not_found`** | Skips slow `RecommendationFinder` — fixes 30+ min hangs on large projects ([#587](https://github.com/robotcodedev/robotcode/issues/587)) | |
| 64 | +| **Replace pathlib with `os.path`** | Warm namespace-cache scenario: **-28.3%** wall time | |
| 65 | +| **Cache `KeywordMatcher` + dict-index** | Keyword matching: **-94%**, overall analysis: **-22%**, function calls: 118M → 81M | |
| 66 | +| **Fix `ArgumentSpec.resolve()` caching** | `RobotArgumentSpec.__init__` calls: 100K → 1.3K (**-98.7%**) | |
| 67 | +| **Single AST model per document** | Saves ~500 KB/doc (CLI) and ~200 KB/doc (Language Server) | |
| 68 | +| **Namespace cache source hints** | Skips expensive `find_resource()` filesystem searches on warm start | |
| 69 | +| **Lazy `CacheEntry` deserialization** | Data blobs are only unpickled on cache hit | |
| 70 | +| **Cache `get_module_spec` results** | Avoids repeated importlib lookups | |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Bug Fixes |
| 75 | + |
| 76 | +- **Relative library path resolution** — Namespace cache validation no longer fails for relative imports like `../../resources/libraries/common.py`, preventing unnecessary full rebuilds on every warm start. |
| 77 | +- **Variable name trailing `=`** — Variable names in resource builder now correctly strip trailing `=` ([#546](https://github.com/robotcodedev/robotcode/issues/546)). |
| 78 | +- **Model source field** — RobotCode no longer overrides the `source` field on AST blocks when newer Robot Framework versions already set it ([#588](https://github.com/robotcodedev/robotcode/issues/588)). |
| 79 | +- **`__init__.py` file check** — Corrected file type check in `_is_valid_file` function. |
| 80 | +- **Thread safety** — Added lock for `_workspace_languages` to prevent race conditions on concurrent access. |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +## Internal Improvements |
| 85 | + |
| 86 | +- **ProjectIndex** — New incrementally maintained inverse reference index for O(1) workspace-wide lookups of keywords, variables, namespace entries, tags, and metadata. |
| 87 | +- **Tag & metadata reference tracking** — Structured reference tracking for keyword tags, testcase tags, and metadata during analysis, enabling future features like tag-based navigation. |
| 88 | +- **`RF_VERSION` constant** — Replaced ~134 `get_robot_version()` call sites with a single module-level constant. Removed all dead code for Robot Framework < 5.0. |
| 89 | +- **Namespace refactoring** — Split the monolithic `Namespace` class into a pure DTO with event-driven invalidation, separate builder, and focused modules for import resolution, AST analysis, and variable scoping. |
| 90 | +- **JSON file watching** — `.json` files are now included in the watched file extensions for automatic workspace updates. |
| 91 | +- **Deprecated robocop options removed** — Legacy robocop configuration options have been removed. |
| 92 | +- **Resource lifecycle hardening** — Replaced fragile `__del__`-based cleanup in JSON-RPC layer with explicit `close`/`close_async` paths and best-effort weakref finalizers. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Thank You |
| 97 | + |
| 98 | +Thanks to everyone who reported issues, contributed ideas, and tested pre-release builds. Your feedback drives every release. |
| 99 | + |
| 100 | +- [Report issues](https://github.com/robotcodedev/robotcode/issues) |
| 101 | +- [Discussions & Q&A](https://github.com/robotcodedev/robotcode/discussions) |
| 102 | +- [Sponsor RobotCode](https://opencollective.com/robotcode) |
0 commit comments