Skip to main content

Crate rust_analyzer

Crate rust_analyzer 

Source
Expand description

Implementation of the LSP for rust-analyzer.

This crate takes Rust-specific analysis results from ide and translates into LSP types.

It also is the root of all state. world module defines the bulk of the state, and main_loop module defines the rules for modifying it.

The cli submodule implements some batch-processing analysis, primarily as a debugging aid.

ModulesΒ§

cli
Various batch processing tasks, intended primarily for debugging.
command πŸ”’
Utilities for running a cargo command like cargo check or cargo test in a separate thread and parse its stdout/stderr.
config
Config used by the language server.
diagnostics πŸ”’
Book keeping for keeping diagnostics easily in sync with the client.
discover πŸ”’
Infrastructure for lazy project discovery. Currently only support rust-project.json discovery via a custom discover command.
flycheck πŸ”’
Flycheck provides the functionality needed to run cargo check to provide LSP diagnostics based on the output of the command.
global_state πŸ”’
The context or environment in which the language server functions. In our server implementation this is know as the WorldState.
handlers πŸ”’
line_index πŸ”’
Enhances ide::LineIndex with additional info required to convert offsets into lsp positions.
lsp
Custom LSP definitions and protocol conversions.
main_loop πŸ”’
The main loop of rust-analyzer responsible for dispatching LSP requests/replies and notifications back to the client.
mem_docs πŸ”’
In-memory document information.
op_queue πŸ”’
Bookkeeping to make sure only one long-running operation is being executed at a time.
reload πŸ”’
Project loading & configuration updates.
target_spec πŸ”’
See TargetSpec
task_pool πŸ”’
A thin wrapper around [stdx::thread::Pool] which threads a sender through spawned jobs. It is used in crate::global_state::GlobalState throughout the main loop.
test_runner πŸ”’
This module provides the functionality needed to run cargo test in a background thread and report the result of each test in a channel.
tracing
version πŸ”’
Code for representing rust-analyzer’s release version number.

ConstantsΒ§

MINIMUM_SUPPORTED_TOOLCHAIN_VERSION
Any toolchain less than this version will likely not work with rust-analyzer built from this revision.

FunctionsΒ§

from_json
main_loop
server_capabilities
version
Returns information about cargo’s version.
ws_to_crate_graph