Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR introduces a new Language Server Protocol (LSP) implementation specifically for Eldritch v2. It replaces the previous Starlark-based LSP.

Changes:

  • New crate eldritch-lsp added to implants workspace.
  • eldritch-lsp supports:
    • textDocument/completion: Autocomplete for built-ins and variables.
    • textDocument/publishDiagnostics: Linting errors and warnings.
  • Added Linter trait and DeprecationRule (checks for os.system).
  • Modified eldritch-core to export Expr, Stmt, etc. for LSP consumption.
  • Updated VS Code extension to launch eldritch-lsp.

PR created automatically by Jules for task 8861086955046603492 started by @KCarretto

- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` which implements a new LSP server for Eldritch v2.
- Implemented autocomplete support using `eldritch-core`'s built-in completion logic.
- Implemented a flexible `LintRule` framework for adding linter rules on the AST.
- Added a `DeprecationRule` as an example to warn about `os.system` usage.
- Exported necessary AST types from `eldritch-core` to support external tooling.
- Updated the VS Code extension (`vscode/client`) to use `eldritch-lsp`.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting while preserving Eldritch-specific illegal keyword highlighting.
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting.
    - Added error handling and output channel logging for LSP client.
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting while preserving Eldritch-specific illegal keyword highlighting.
    - Added error handling and output channel logging for LSP client.
    - Added `postinstall` script to automatically build `eldritch-lsp` and copy it to `bin/`.
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting while preserving Eldritch-specific illegal keyword highlighting.
    - Added error handling and output channel logging for LSP client.
    - Added `postinstall` script to automatically build `eldritch-lsp` and copy it to `bin/`.
- Fixed LSP initialization error by correctly wrapping `ServerCapabilities` in `InitializeResult`.
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting while preserving Eldritch-specific illegal keyword highlighting.
    - Added error handling and output channel logging for LSP client.
    - Added `postinstall` script to automatically build `eldritch-lsp` and copy it to `bin/`.
- Fixed LSP initialization error by manually constructing correct JSON response structure for `InitializeResult`.
@github-actions
Copy link

github-actions bot commented Dec 24, 2025

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
375    ±0 375    ±0 0    ±0 0    ±0 0    ±0 0    ±0 26.1s    ↑926ms

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#3254 375 375 0 0 0 0 26.1s
#3253 375 375 0 0 0 0 25.1s

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
375 0 0 2.0s

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
TestGetRandomName/NoDuplicates 2 1.9s 2.0s
TestGetRandomName 2 1.9s 2.0s
TestCreateTestData 2 935ms 1.0s
TestPreventPubSubColdStarts_ZeroInterval 2 1.0s 1.0s
TestAPI 2 675ms 720ms
TestReverseShell_E2E 2 510ms 510ms
TestNewShellHandler 2 510ms 510ms
TestFetchAsset 2 495ms 500ms
TestFetchAsset/Large_File 2 475ms 480ms
TestAPI/mutations 2 365ms 390ms

🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 2 runs.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

google-labs-jules bot and others added 6 commits December 24, 2025 18:22
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting while preserving Eldritch-specific illegal keyword highlighting.
    - Added error handling and output channel logging for LSP client.
    - Added `postinstall` script to automatically build `eldritch-lsp` and copy it to `bin/`.
- Fixed LSP initialization error by correctly constructing `InitializeResult` to prevent `TypeError` on client side.
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated `eldritch-core` `complete` logic to ignore indentation tokens, fixing method completion issues.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting while preserving Eldritch-specific illegal keyword highlighting.
    - Added error handling and output channel logging for LSP client.
    - Added `postinstall` script to automatically build `eldritch-lsp` and copy it to `bin/`.
- Fixed LSP initialization error by correctly constructing `InitializeResult`.
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated `eldritch-core` `complete` logic:
    - Ignore `Indent`/`Dedent` tokens to fix method completion in blocks.
    - Support literal completion for Lists `[]`, Dictionaries `{}`, and Tuples `()`.
- Updated `eldritch-lsp` to register standard libraries (`agent`, `sys`, etc.) for completion using `eldritchv2` facade.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` to provide Python-style syntax highlighting while preserving Eldritch-specific illegal keyword highlighting.
    - Added error handling and output channel logging for LSP client.
    - Added `postinstall` script to automatically build `eldritch-lsp` and copy it to `bin/`.
- Fixed LSP initialization error by correctly constructing `InitializeResult`.
- Created `eldritch-lsp` crate in `implants/lib/eldritchv2/` implementing LSP for Eldritch v2.
- Implemented autocomplete logic leveraging `eldritch-core`'s built-in completion.
- Implemented AST-based Linter framework with example `DeprecationRule`.
- Updated `eldritch-core` to export AST types (`Expr`, `Stmt`) for external tooling.
- Updated `eldritch-core` `complete` logic:
    - Ignore `Indent`/`Dedent` tokens to fix method completion in blocks.
    - Support literal completion for Lists `[]`, Dictionaries `{}`, and Tuples `()`.
- Updated `eldritch-lsp` to:
    - Register standard libraries (`agent`, `sys`, etc.) for completion.
    - Accurately map parser/lexer error spans to LSP Diagnostics ranges.
    - Use distinct icons for Libraries (`Module`) vs Functions/Variables in autocomplete.
- Updated VS Code extension:
    - Launch `eldritch-lsp` instead of `eldritch-lang`.
    - Activate on `*.eldritch` files (`onLanguage:eldritch`).
    - Map `.eldritch` extension to `eldritch` language.
    - Updated grammar to inherit from `source.python` while adding specific highlighting for Eldritch built-ins (`tprint`) and libraries (`agent`, `sys`, etc.).
    - Configured file icon to use `images/eldritch.png`.
    - Added error handling and output channel logging for LSP client.
    - Added `postinstall` script to automatically build `eldritch-lsp` and copy it to `bin/`.
- Fixed LSP initialization error by correctly constructing `InitializeResult`.
- Created `eldritch-lsp` crate providing a language server for Eldritch v2.
- Implemented autocomplete, syntax diagnostics, and linting.
- Added `SemanticCheckRule` linter to detect unknown methods and signature mismatches.
- Updated `eldritch-core` to export AST nodes for LSP consumption.
- Configured VS Code extension to build and use the LSP server via `install.js`.
- Included debug logging to VS Code Output channel.
@KCarretto KCarretto marked this pull request as ready for review December 24, 2025 20:53
@KCarretto
Copy link
Collaborator

Jules run cargo fmt

@google-labs-jules
Copy link
Contributor Author

Jules run cargo fmt

I have run cargo fmt as requested.

google-labs-jules bot and others added 13 commits December 24, 2025 21:05
Run `cargo fmt` to format the codebase, specifically `eldritch-lsp` and `eldritch-core`.
…1400)

Added `TypeCheckRule` to the LSP linter to validate:
- Method existence on objects.
- Argument counts and types for method calls.
- Binary operation operand types (specifically avoiding List + String).

This involved:
- Adding `MethodSignature` and `ParameterSignature` structs to `eldritch-core`.
- Updating `ForeignValue` trait to expose `get_method_signature`.
- Updating `eldritch-macros` to automatically generate signature metadata for libraries.
- Implementing the linter rule in `eldritch-lsp`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Refactor `is_interpreter_type` to use nested `if let` blocks instead of unstable `let_chains` syntax. This resolves build errors on stable Rust toolchains.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Added a new linter rule `UndefinedSymbolRule` to `eldritch-lsp` which checks for usage of undefined variables.
The rule respects scoping rules (module, function, loop block scopes).
Updated `Linter` to include this new rule.
Added unit tests covering basic usage, function parameters, and loop variables.
Updated `eldritch-core/lib.rs` to export `FStringSegment` for LSP usage.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <Kcarretto@gmail.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <Kcarretto@gmail.com>
…r. (#1410)

- Added `doc` field to `MethodSignature` in `eldritch-core`.
- Updated `eldritch-macros` to initialize `doc` field.
- Implemented `get_native_method_signature` in `eldritch-core` to provide signatures and documentation for built-in methods (List, Dictionary, Set, String).
- Updated `eldritch-lsp` to handle `textDocument/hover` requests.
- Implemented robust `position_to_offset` and text traversal in `eldritch-lsp` to correctly handle UTF-8 and newlines.
- Added support for resolving dotted expressions (e.g., `file.append`) in hover requests.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Separated rules in `implants/lib/eldritchv2/eldritch-lsp/src/linter/mod.rs` into their own files (`deprecation.rs`, `type_check.rs`, `undefined_symbol.rs`) and moved helper methods to `utils.rs` and `visitors.rs`. Verified that all tests still pass.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
google-labs-jules bot and others added 4 commits December 25, 2025 23:21
- Update `eldritch-macros` to support `deprecated=true` or `deprecated="reason"` on `#[eldritch_method]`.
- Update `eldritch-core` `MethodSignature` to include `deprecated: Option<String>`.
- Update `eldritch-lsp` `DeprecationRule` to dynamically check the interpreter for deprecated methods instead of hardcoded `os.system`.
- Filter deprecated methods from auto-complete in `eldritch-core`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…sp (#1413)

- Fix unused variable warnings in `ast.rs` and tests.
- Add missing imports for `alloc::format` and `ToString` in `eldritch-core` for `no_std` compliance.
- Resolve clippy warnings in `eldritch-lsp` including collapsible matches/ifs and single matches.
- Fix broken test in `eldritch-lsp` regarding deprecation warnings.
- Run `cargo fmt` on both crates.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@KCarretto KCarretto closed this Dec 27, 2025
@KCarretto KCarretto reopened this Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants