Skip to content

Add cargo xtask rust-analyzer#2524

Open
mkeeter wants to merge 3 commits into
mkeeter/bump-depsfrom
mkeeter/xtask-rust-analyzer
Open

Add cargo xtask rust-analyzer#2524
mkeeter wants to merge 3 commits into
mkeeter/bump-depsfrom
mkeeter/xtask-rust-analyzer

Conversation

@mkeeter
Copy link
Copy Markdown
Collaborator

@mkeeter mkeeter commented May 20, 2026

This PR adds cargo xtask rust-analyzer, which points rust-analyzer at a particular (manifest, task) tuple (set by a CLI argument). It can be used as a drop-in replacement in your editor, to get LSP goodness within the Hubris build system.

@mkeeter mkeeter requested review from evan-oxide and jamesmunns May 20, 2026 20:05
@mkeeter mkeeter force-pushed the mkeeter/xtask-rust-analyzer branch from ab273d9 to b937c30 Compare May 20, 2026 20:08
Comment thread .gitignore
!.vscode/launch.json
!.vscode/tasks.json
!.vscode/extensions.json
.nvim.lua
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.nvim.lua
.nvim.lua
.zed/settings.json

@jamesmunns
Copy link
Copy Markdown
Contributor

jamesmunns commented May 21, 2026

This definitely works better for me in Zed, there are still some hiccups, I'll try to enumerate them a bit better once I've gotten a better chance to take this for a spin.

Looking at the logs, I see some weirdness: https://gist.github.com/jamesmunns/59c51489e6e62676bef118514a3fddbf

Some of this is attempting to build crates that aren't relevant for cosmo+control_plane_agent, e.g. task-attest.

There are some recurring errors that seem odd to me, like:

  Error: app.toml missing task config section [tasks.control_plane_agent.config]

And also:

Error: reading env var $HUBRIS_KCONFIG

That all being said, I am able to use rust-analyzer in the control-plane-agent task, as well as seemingly other cosmo-relevant tasks.

For context, this is my current .zed/settings.json:

// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
  "lsp": {
    // Specify the LSP name as a key here.
    "rust-analyzer": {
      // // A special flag for rust-analyzer integration, to use server-provided tasks
      // enable_lsp_tasks": true,
      "binary": {
        "path": "cargo",
        "arguments": [
          "run",
          "-pxtask",
          "--",
          "rust-analyzer",
          "--log",
          "./target/xtask-ra.log",
          "./app/cosmo/rev-b-dev.toml:control_plane_agent",
        ],
      },
      // These initialization options are merged into Zed's defaults
      "initialization_options": {
        "check": {
          "command": "clippy", // rust-analyzer.check.command (default: "check")
        },
        "cargo": {
          "targetDir": "target",
        },
      },
    },
  },
}

Copy link
Copy Markdown
Contributor

@jamesmunns jamesmunns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to do a follow-on PR to document setting up Zed as well.

@mkeeter
Copy link
Copy Markdown
Collaborator Author

mkeeter commented May 21, 2026

I pushed a fix to set check { workspace: false }, which should reduce some of the chattiness (because it will only run cargo check for the package being edited).

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