Skip to content

ArthurHeymans/lsp-cargo-feature-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

lsp-cargo-feature-switcher

An Emacs package for interactively toggling Cargo features in Rust projects via LSP configuration.

2025-10-16.16-40-16.webm

Features

  • Find and parse Cargo.toml files
  • Interactive menu to toggle Cargo features
  • Automatically updates .dir-locals.el with LSP configuration
  • Shows enabled features and their dependencies
  • Supports toggling no-default-features
  • Supports both eglot and lsp-mode

Dependencies

Requires tomlparse.el, a tree-sitter based TOML parser that requires Emacs 29.1 or later.

Usage

Run M-x cargo-features-toggle-menu to open the interactive feature selection menu.

Configuration

By default, the package uses eglot mode. To switch to lsp-mode, set:

(setq cargo-features-lsp-mode 'lsp-mode)

Eglot Mode (default)

When using eglot, the .dir-locals.el file is created at the project root (directory containing .git) with configuration in the format:

((rustic-mode . ((eglot-workspace-configuration
                  . (:rust-analyzer
                     (:cargo (:features ["feature1" "feature2"]
                              :noDefaultFeatures t)))))))

LSP Mode

When using lsp-mode, the .dir-locals.el file is created at the Cargo.toml directory with configuration in the format:

((rustic-mode . ((lsp-rust-features . ["feature1" "feature2"])
                 (lsp-rust-no-default-features . t))))

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published