Merge pull request #3216 from matklad/rename-to-rust-analyzer

rename binary to rust-analyzer
This commit is contained in:
Aleksey Kladov 2020-02-18 13:30:40 +01:00 committed by GitHub
commit d05480a178
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 111 additions and 111 deletions

View file

@ -44,29 +44,29 @@ jobs:
CC: clang CC: clang
with: with:
command: build command: build
args: --package ra_lsp_server --bin ra_lsp_server --release --target x86_64-unknown-linux-musl args: --package rust-analyzer --bin rust-analyzer --release --target x86_64-unknown-linux-musl
- name: Build - name: Build
if: matrix.os != 'ubuntu-latest' if: matrix.os != 'ubuntu-latest'
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --package ra_lsp_server --bin ra_lsp_server --release args: --package rust-analyzer --bin rust-analyzer --release
- name: Create distribution dir - name: Create distribution dir
run: mkdir ./dist run: mkdir ./dist
- name: Copy binary - name: Copy binary
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: cp ./target/x86_64-unknown-linux-musl/release/ra_lsp_server ./dist/ra_lsp_server-linux && strip ./dist/ra_lsp_server-linux run: cp ./target/x86_64-unknown-linux-musl/release/rust-analyzer ./dist/rust-analyzer-linux && strip ./dist/rust-analyzer-linux
- name: Copy binary - name: Copy binary
if: matrix.os == 'macos-latest' if: matrix.os == 'macos-latest'
run: cp ./target/release/ra_lsp_server ./dist/ra_lsp_server-mac run: cp ./target/release/rust-analyzer ./dist/rust-analyzer-mac
- name: Copy binary - name: Copy binary
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: copy ./target/release/ra_lsp_server.exe ./dist/ra_lsp_server-windows.exe run: copy ./target/release/rust-analyzer.exe ./dist/rust-analyzer-windows.exe
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
@ -153,8 +153,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/ra_lsp_server-linux asset_path: ./dist/rust-analyzer-linux
asset_name: ra_lsp_server-linux asset_name: rust-analyzer-linux
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- uses: actions/upload-release-asset@v1.0.1 - uses: actions/upload-release-asset@v1.0.1
@ -162,8 +162,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/ra_lsp_server-mac asset_path: ./dist/rust-analyzer-mac
asset_name: ra_lsp_server-mac asset_name: rust-analyzer-mac
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- uses: actions/upload-release-asset@v1.0.1 - uses: actions/upload-release-asset@v1.0.1
@ -171,8 +171,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/ra_lsp_server-windows.exe asset_path: ./dist/rust-analyzer-windows.exe
asset_name: ra_lsp_server-windows.exe asset_name: rust-analyzer-windows.exe
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- uses: actions/upload-release-asset@v1.0.1 - uses: actions/upload-release-asset@v1.0.1

4
.vscode/launch.json vendored
View file

@ -45,7 +45,7 @@
"<node_internals>/**/*.js" "<node_internals>/**/*.js"
], ],
"env": { "env": {
"__RA_LSP_SERVER_DEBUG": "${workspaceFolder}/target/debug/ra_lsp_server" "__RA_LSP_SERVER_DEBUG": "${workspaceFolder}/target/debug/rust-analyzer"
} }
}, },
{ {
@ -59,7 +59,7 @@
"name": "Attach To Server", "name": "Attach To Server",
"type": "lldb", "type": "lldb",
"request": "attach", "request": "attach",
"program": "${workspaceFolder}/target/debug/ra_lsp_server", "program": "${workspaceFolder}/target/debug/rust-analyzer",
"pid": "${command:pickMyProcess}", "pid": "${command:pickMyProcess}",
"sourceLanguages": [ "sourceLanguages": [
"rust" "rust"

2
.vscode/tasks.json vendored
View file

@ -19,7 +19,7 @@
"label": "Build Server", "label": "Build Server",
"group": "build", "group": "build",
"type": "shell", "type": "shell",
"command": "cargo build --package ra_lsp_server", "command": "cargo build --package rust-analyzer",
"problemMatcher": "$rustc" "problemMatcher": "$rustc"
}, },
] ]

76
Cargo.lock generated
View file

@ -1094,44 +1094,6 @@ dependencies = [
"unicase", "unicase",
] ]
[[package]]
name = "ra_lsp_server"
version = "0.1.0"
dependencies = [
"anyhow",
"crossbeam-channel",
"either",
"env_logger",
"globset",
"itertools",
"jod-thread",
"log",
"lsp-server",
"lsp-types",
"parking_lot",
"pico-args",
"ra_cargo_watch",
"ra_db",
"ra_hir",
"ra_hir_def",
"ra_hir_ty",
"ra_ide",
"ra_prof",
"ra_project_model",
"ra_syntax",
"ra_text_edit",
"ra_vfs",
"rand",
"relative-path",
"rustc-hash",
"serde",
"serde_json",
"tempfile",
"test_utils",
"threadpool",
"winapi 0.3.8",
]
[[package]] [[package]]
name = "ra_mbe" name = "ra_mbe"
version = "0.1.0" version = "0.1.0"
@ -1353,6 +1315,44 @@ dependencies = [
"thin-dst", "thin-dst",
] ]
[[package]]
name = "rust-analyzer"
version = "0.1.0"
dependencies = [
"anyhow",
"crossbeam-channel",
"either",
"env_logger",
"globset",
"itertools",
"jod-thread",
"log",
"lsp-server",
"lsp-types",
"parking_lot",
"pico-args",
"ra_cargo_watch",
"ra_db",
"ra_hir",
"ra_hir_def",
"ra_hir_ty",
"ra_ide",
"ra_prof",
"ra_project_model",
"ra_syntax",
"ra_text_edit",
"ra_vfs",
"rand",
"relative-path",
"rustc-hash",
"serde",
"serde_json",
"tempfile",
"test_utils",
"threadpool",
"winapi 0.3.8",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.16" version = "0.1.16"

View file

@ -35,7 +35,7 @@ $ git clone https://github.com/rust-analyzer/rust-analyzer && cd rust-analyzer
# install both the language server and VS Code extension # install both the language server and VS Code extension
$ cargo xtask install $ cargo xtask install
# alternatively, install only the server. Binary name is `ra_lsp_server`. # alternatively, install only the server. Binary name is `rust-analyzer`.
$ cargo xtask install --server $ cargo xtask install --server
``` ```

View file

@ -3,7 +3,7 @@
//! derived from this input. //! derived from this input.
//! //!
//! Note that neither this module, nor any other part of the analyzer's core do //! Note that neither this module, nor any other part of the analyzer's core do
//! actual IO. See `vfs` and `project_model` in the `ra_lsp_server` crate for how //! actual IO. See `vfs` and `project_model` in the `rust-analyzer` crate for how
//! actual IO is done and lowered to input. //! actual IO is done and lowered to input.
use std::{fmt, str::FromStr}; use std::{fmt, str::FromStr};

View file

@ -13,7 +13,7 @@ use rustc_hash::FxHashMap;
/// checked at compile time, to keep things simple and flexible. /// checked at compile time, to keep things simple and flexible.
/// ///
/// Also note that, at the moment, `FeatureFlags` also store features for /// Also note that, at the moment, `FeatureFlags` also store features for
/// `ra_lsp_server`. This should be benign layering violation. /// `rust-analyzer`. This should be benign layering violation.
#[derive(Debug)] #[derive(Debug)]
pub struct FeatureFlags { pub struct FeatureFlags {
flags: FxHashMap<String, bool>, flags: FxHashMap<String, bool>,

View file

@ -351,13 +351,13 @@ impl Drop for Scope {
/// 2. Build with `cpu_profiler` feature. /// 2. Build with `cpu_profiler` feature.
/// 3. Tun the code, the *raw* output would be in the `./out.profile` file. /// 3. Tun the code, the *raw* output would be in the `./out.profile` file.
/// 4. Install pprof for visualization (https://github.com/google/pprof). /// 4. Install pprof for visualization (https://github.com/google/pprof).
/// 5. Use something like `pprof -svg target/release/ra_lsp_server ./out.profile` to see the results. /// 5. Use something like `pprof -svg target/release/rust-analyzer ./out.profile` to see the results.
/// ///
/// For example, here's how I run profiling on NixOS: /// For example, here's how I run profiling on NixOS:
/// ///
/// ```bash /// ```bash
/// $ nix-shell -p gperftools --run \ /// $ nix-shell -p gperftools --run \
/// 'cargo run --release -p ra_lsp_server -- parse < ~/projects/rustbench/parser.rs > /dev/null' /// 'cargo run --release -p rust-analyzer -- parse < ~/projects/rustbench/parser.rs > /dev/null'
/// ``` /// ```
#[derive(Debug)] #[derive(Debug)]
pub struct CpuProfiler { pub struct CpuProfiler {

View file

@ -22,7 +22,7 @@ ra_text_edit = { path = "../ra_text_edit" }
ra_parser = { path = "../ra_parser" } ra_parser = { path = "../ra_parser" }
# This crate transitively depends on `smol_str` via `rowan`. # This crate transitively depends on `smol_str` via `rowan`.
# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here # ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here
# to reduce number of compilations # to reduce number of compilations
smol_str = { version = "0.1.12", features = ["serde"] } smol_str = { version = "0.1.12", features = ["serde"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }

View file

@ -8,6 +8,6 @@ authors = ["rust-analyzer developers"]
doctest = false doctest = false
[dependencies] [dependencies]
# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here # ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here
# to reduce number of compilations # to reduce number of compilations
smol_str = { version = "0.1.12", features = ["serde"] } smol_str = { version = "0.1.12", features = ["serde"] }

View file

@ -1,6 +1,6 @@
[package] [package]
edition = "2018" edition = "2018"
name = "ra_lsp_server" name = "rust-analyzer"
version = "0.1.0" version = "0.1.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
autobins = false autobins = false
@ -9,7 +9,7 @@ autobins = false
doctest = false doctest = false
[[bin]] [[bin]]
name = "ra_lsp_server" name = "rust-analyzer"
path = "./src/bin/main.rs" path = "./src/bin/main.rs"
[dependencies] [dependencies]

View file

@ -5,7 +5,7 @@
use anyhow::{bail, Result}; use anyhow::{bail, Result};
use pico_args::Arguments; use pico_args::Arguments;
use ra_lsp_server::cli::{BenchWhat, Position, Verbosity}; use rust_analyzer::cli::{BenchWhat, Position, Verbosity};
use std::{fmt::Write, path::PathBuf}; use std::{fmt::Write, path::PathBuf};
@ -74,7 +74,7 @@ impl Args {
ra-cli-parse ra-cli-parse
USAGE: USAGE:
ra_lsp_server parse [FLAGS] rust-analyzer parse [FLAGS]
FLAGS: FLAGS:
-h, --help Prints help inforamtion -h, --help Prints help inforamtion
@ -94,7 +94,7 @@ FLAGS:
ra-cli-symbols ra-cli-symbols
USAGE: USAGE:
ra_lsp_server highlight [FLAGS] rust-analyzer highlight [FLAGS]
FLAGS: FLAGS:
-h, --help Prints help inforamtion" -h, --help Prints help inforamtion"
@ -113,7 +113,7 @@ FLAGS:
ra-cli-highlight ra-cli-highlight
USAGE: USAGE:
ra_lsp_server highlight [FLAGS] rust-analyzer highlight [FLAGS]
FLAGS: FLAGS:
-h, --help Prints help information -h, --help Prints help information
@ -133,7 +133,7 @@ FLAGS:
ra-cli-analysis-stats ra-cli-analysis-stats
USAGE: USAGE:
ra_lsp_server analysis-stats [FLAGS] [OPTIONS] [PATH] rust-analyzer analysis-stats [FLAGS] [OPTIONS] [PATH]
FLAGS: FLAGS:
-h, --help Prints help information -h, --help Prints help information
@ -168,10 +168,10 @@ ARGS:
if matches.contains(["-h", "--help"]) { if matches.contains(["-h", "--help"]) {
eprintln!( eprintln!(
"\ "\
ra_lsp_server-analysis-bench rust-analyzer-analysis-bench
USAGE: USAGE:
ra_lsp_server analysis-bench [FLAGS] [OPTIONS] [PATH] rust-analyzer analysis-bench [FLAGS] [OPTIONS] [PATH]
FLAGS: FLAGS:
-h, --help Prints help information -h, --help Prints help information
@ -207,7 +207,7 @@ ARGS:
ra-cli ra-cli
USAGE: USAGE:
ra_lsp_server <SUBCOMMAND> rust-analyzer <SUBCOMMAND>
FLAGS: FLAGS:
-h, --help Prints help information -h, --help Prints help information

View file

@ -4,8 +4,8 @@
mod args; mod args;
use lsp_server::Connection; use lsp_server::Connection;
use ra_lsp_server::{cli, from_json, show_message, Result, ServerConfig};
use ra_prof; use ra_prof;
use rust_analyzer::{cli, from_json, show_message, Result, ServerConfig};
use crate::args::HelpPrinted; use crate::args::HelpPrinted;
@ -51,7 +51,7 @@ fn run_server() -> Result<()> {
log::info!("lifecycle: server started"); log::info!("lifecycle: server started");
let (connection, io_threads) = Connection::stdio(); let (connection, io_threads) = Connection::stdio();
let server_capabilities = serde_json::to_value(ra_lsp_server::server_capabilities()).unwrap(); let server_capabilities = serde_json::to_value(rust_analyzer::server_capabilities()).unwrap();
let initialize_params = connection.initialize(server_capabilities)?; let initialize_params = connection.initialize(server_capabilities)?;
let initialize_params = let initialize_params =
@ -84,7 +84,7 @@ fn run_server() -> Result<()> {
}) })
.unwrap_or_default(); .unwrap_or_default();
ra_lsp_server::main_loop( rust_analyzer::main_loop(
workspace_roots, workspace_roots,
initialize_params.capabilities, initialize_params.capabilities,
server_config, server_config,

View file

@ -1,4 +1,4 @@
//! The main loop of `ra_lsp_server` responsible for dispatching LSP //! The main loop of `rust-analyzer` responsible for dispatching LSP
//! requests/replies and notifications back to the client. //! requests/replies and notifications back to the client.
mod handlers; mod handlers;

View file

@ -7,7 +7,7 @@ use lsp_types::{
PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams, PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams,
WorkDoneProgressParams, WorkDoneProgressParams,
}; };
use ra_lsp_server::req::{ use rust_analyzer::req::{
CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument, CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument,
Formatting, OnEnter, Runnables, RunnablesParams, Formatting, OnEnter, Runnables, RunnablesParams,
}; };

View file

@ -19,7 +19,7 @@ use serde_json::{to_string_pretty, Value};
use tempfile::TempDir; use tempfile::TempDir;
use test_utils::{find_mismatch, parse_fixture}; use test_utils::{find_mismatch, parse_fixture};
use ra_lsp_server::{main_loop, req, ServerConfig}; use rust_analyzer::{main_loop, req, ServerConfig};
pub struct Project<'a> { pub struct Project<'a> {
fixture: &'a str, fixture: &'a str,

View file

@ -80,7 +80,7 @@ In general, I use one of the following workflows for fixing bugs and
implementing features. implementing features.
If the problem concerns only internal parts of rust-analyzer (ie, I don't need If the problem concerns only internal parts of rust-analyzer (ie, I don't need
to touch `ra_lsp_server` crate or typescript code), there is a unit-test for it. to touch `rust-analyzer` crate or typescript code), there is a unit-test for it.
So, I use **Rust Analyzer: Run** action in VS Code to run this single test, and So, I use **Rust Analyzer: Run** action in VS Code to run this single test, and
then just do printf-driven development/debugging. As a sanity check after I'm then just do printf-driven development/debugging. As a sanity check after I'm
done, I use `cargo xtask install --server` and **Reload Window** action in VS done, I use `cargo xtask install --server` and **Reload Window** action in VS
@ -88,17 +88,17 @@ Code to sanity check that the thing works as I expect.
If the problem concerns only the VS Code extension, I use **Run Extension** If the problem concerns only the VS Code extension, I use **Run Extension**
launch configuration from `launch.json`. Notably, this uses the usual launch configuration from `launch.json`. Notably, this uses the usual
`ra_lsp_server` binary from `PATH`. For this it is important to have the following `rust-analyzer` binary from `PATH`. For this it is important to have the following
in `setting.json` file: in `setting.json` file:
```json ```json
{ {
"rust-analyzer.raLspServerPath": "ra_lsp_server" "rust-analyzer.serverPath": "rust-analyzer"
} }
``` ```
After I am done with the fix, I use `cargo After I am done with the fix, I use `cargo
xtask install --client-code` to try the new extension for real. xtask install --client-code` to try the new extension for real.
If I need to fix something in the `ra_lsp_server` crate, I feel sad because it's If I need to fix something in the `rust-analyzer` crate, I feel sad because it's
on the boundary between the two processes, and working there is slow. I usually on the boundary between the two processes, and working there is slow. I usually
just `cargo xtask install --server` and poke changes from my live environment. just `cargo xtask install --server` and poke changes from my live environment.
Note that this uses `--release`, which is usually faster overall, because Note that this uses `--release`, which is usually faster overall, because
@ -113,7 +113,7 @@ communication, and `print!` would break it.
If I need to fix something simultaneously in the server and in the client, I If I need to fix something simultaneously in the server and in the client, I
feel even more sad. I don't have a specific workflow for this case. feel even more sad. I don't have a specific workflow for this case.
Additionally, I use `cargo run --release -p ra_lsp_server -- analysis-stats Additionally, I use `cargo run --release -p rust-analyzer -- analysis-stats
path/to/some/rust/crate` to run a batch analysis. This is primarily useful for path/to/some/rust/crate` to run a batch analysis. This is primarily useful for
performance optimizations, or for bug minimization. performance optimizations, or for bug minimization.
@ -148,7 +148,7 @@ There's also two VS Code commands which might be of interest:
* `Rust Analyzer: Status` shows some memory-usage statistics. To take full * `Rust Analyzer: Status` shows some memory-usage statistics. To take full
advantage of it, you need to compile rust-analyzer with jemalloc support: advantage of it, you need to compile rust-analyzer with jemalloc support:
``` ```
$ cargo install --path crates/ra_lsp_server --force --features jemalloc $ cargo install --path crates/rust-analyzer --force --features jemalloc
``` ```
There's an alias for this: `cargo xtask install --server --jemalloc`. There's an alias for this: `cargo xtask install --server --jemalloc`.
@ -170,12 +170,12 @@ In particular, I have `export RA_PROFILE='*>10'` in my shell profile.
To measure time for from-scratch analysis, use something like this: To measure time for from-scratch analysis, use something like this:
``` ```
$ cargo run --release -p ra_lsp_server -- analysis-stats ../chalk/ $ cargo run --release -p rust-analyzer -- analysis-stats ../chalk/
``` ```
For measuring time of incremental analysis, use either of these: For measuring time of incremental analysis, use either of these:
``` ```
$ cargo run --release -p ra_lsp_server -- analysis-bench ../chalk/ --highlight ../chalk/chalk-engine/src/logic.rs $ cargo run --release -p rust-analyzer -- analysis-bench ../chalk/ --highlight ../chalk/chalk-engine/src/logic.rs
$ cargo run --release -p ra_lsp_server -- analysis-bench ../chalk/ --complete ../chalk/chalk-engine/src/logic.rs:94:0 $ cargo run --release -p rust-analyzer -- analysis-bench ../chalk/ --complete ../chalk/chalk-engine/src/logic.rs:94:0
``` ```

View file

@ -134,7 +134,7 @@ APIs in this crate are IDE centric: they take text offsets as input and produce
offsets and strings as output. This works on top of rich code model powered by offsets and strings as output. This works on top of rich code model powered by
`hir`. `hir`.
### `crates/ra_lsp_server` ### `crates/rust-analyzer`
An LSP implementation which wraps `ra_ide` into a language server protocol. An LSP implementation which wraps `ra_ide` into a language server protocol.
@ -153,7 +153,7 @@ Rust Analyzer has three interesting [systems
boundaries](https://www.tedinski.com/2018/04/10/making-tests-a-positive-influence-on-design.html) boundaries](https://www.tedinski.com/2018/04/10/making-tests-a-positive-influence-on-design.html)
to concentrate tests on. to concentrate tests on.
The outermost boundary is the `ra_lsp_server` crate, which defines an LSP The outermost boundary is the `rust-analyzer` crate, which defines an LSP
interface in terms of stdio. We do integration testing of this component, by interface in terms of stdio. We do integration testing of this component, by
feeding it with a stream of LSP requests and checking responses. These tests are feeding it with a stream of LSP requests and checking responses. These tests are
known as "heavy", because they interact with Cargo and read real files from known as "heavy", because they interact with Cargo and read real files from
@ -162,7 +162,7 @@ in a statically typed language, it's hard to make an error in the protocol
itself if messages are themselves typed. itself if messages are themselves typed.
The middle, and most important, boundary is `ra_ide`. Unlike The middle, and most important, boundary is `ra_ide`. Unlike
`ra_lsp_server`, which exposes API, `ide` uses Rust API and is intended to `rust-analyzer`, which exposes API, `ide` uses Rust API and is intended to
use by various tools. Typical test creates an `AnalysisHost`, calls some use by various tools. Typical test creates an `AnalysisHost`, calls some
`Analysis` functions and compares the results against expectation. `Analysis` functions and compares the results against expectation.

View file

@ -22,8 +22,8 @@ where **only** the `rust-analyzer` extension being debugged is enabled.
## Debug TypeScript VSCode extension ## Debug TypeScript VSCode extension
- `Run Extension` - runs the extension with the globally installed `ra_lsp_server` binary. - `Run Extension` - runs the extension with the globally installed `rust-analyzer` binary.
- `Run Extension (Dev Server)` - runs extension with the locally built LSP server (`target/debug/ra_lsp_server`). - `Run Extension (Dev Server)` - runs extension with the locally built LSP server (`target/debug/rust-analyzer`).
TypeScript debugging is configured to watch your source edits and recompile. TypeScript debugging is configured to watch your source edits and recompile.
To apply changes to an already running debug process press <kbd>Ctrl+Shift+P</kbd> and run the following command in your `[Extension Development Host]` To apply changes to an already running debug process press <kbd>Ctrl+Shift+P</kbd> and run the following command in your `[Extension Development Host]`
@ -47,13 +47,13 @@ To apply changes to an already running debug process press <kbd>Ctrl+Shift+P</kb
debug = 2 debug = 2
``` ```
- Select `Run Extension (Dev Server)` to run your locally built `target/debug/ra_lsp_server`. - Select `Run Extension (Dev Server)` to run your locally built `target/debug/rust-analyzer`.
- In the original VSCode window once again select the `Attach To Server` debug configuration. - In the original VSCode window once again select the `Attach To Server` debug configuration.
- A list of running processes should appear. Select the `ra_lsp_server` from this repo. - A list of running processes should appear. Select the `rust-analyzer` from this repo.
- Navigate to `crates/ra_lsp_server/src/main_loop.rs` and add a breakpoint to the `on_task` function. - Navigate to `crates/rust-analyzer/src/main_loop.rs` and add a breakpoint to the `on_task` function.
- Go back to the `[Extension Development Host]` instance and hover over a Rust variable and your breakpoint should hit. - Go back to the `[Extension Development Host]` instance and hover over a Rust variable and your breakpoint should hit.
@ -64,15 +64,15 @@ To apply changes to an already running debug process press <kbd>Ctrl+Shift+P</kb
## Troubleshooting ## Troubleshooting
### Can't find the `ra_lsp_server` process ### Can't find the `rust-analyzer` process
It could be a case of just jumping the gun. It could be a case of just jumping the gun.
The `ra_lsp_server` is only started once the `onLanguage:rust` activation. The `rust-analyzer` is only started once the `onLanguage:rust` activation.
Make sure you open a rust file in the `[Extension Development Host]` and try again. Make sure you open a rust file in the `[Extension Development Host]` and try again.
### Can't connect to `ra_lsp_server` ### Can't connect to `rust-analyzer`
Make sure you have run `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`. Make sure you have run `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`.

View file

@ -64,14 +64,14 @@ To make VS Code use the freshly build server, add this to the settings:
[source,json] [source,json]
---- ----
{ "rust-analyzer.raLspServerPath": "ra_lsp_server" } { "rust-analyzer.serverPath": "rust-analyzer" }
---- ----
Note that installing via `xtask install` does not work for VS Code Remote, instead you'll need to install the `.vsix` manually. Note that installing via `xtask install` does not work for VS Code Remote, instead you'll need to install the `.vsix` manually.
=== Language Server Binary === Language Server Binary
Other editors generally require `ra_lsp_server` binary to be in `$PATH`. Other editors generally require `rust-analyzer` binary to be in `$PATH`.
You can download pre-build binary from You can download pre-build binary from
https://github.com/rust-analyzer/rust-analyzer/releases[releases] https://github.com/rust-analyzer/rust-analyzer/releases[releases]
page, or you can install it from source using the following command: page, or you can install it from source using the following command:
@ -102,7 +102,7 @@ The are several LSP client implementations for vim:
2. Run `:CocInstall coc-rust-analyzer` to install 2. Run `:CocInstall coc-rust-analyzer` to install
https://github.com/fannheyward/coc-rust-analyzer[coc-rust-analyzer], https://github.com/fannheyward/coc-rust-analyzer[coc-rust-analyzer],
this extension implements _most_ of the features supported in the VSCode extension: this extension implements _most_ of the features supported in the VSCode extension:
* same configurations as VSCode extension, `rust-analyzer.raLspServerPath`, `rust-analyzer.enableCargoWatchOnStartup` etc. * same configurations as VSCode extension, `rust-analyzer.serverPath`, `rust-analyzer.enableCargoWatchOnStartup` etc.
* same commands too, `rust-analyzer.analyzerStatus`, `rust-analyzer.startCargoWatch` etc. * same commands too, `rust-analyzer.analyzerStatus`, `rust-analyzer.startCargoWatch` etc.
* highlighting and inlay_hints are not implemented yet * highlighting and inlay_hints are not implemented yet
@ -117,7 +117,7 @@ The are several LSP client implementations for vim:
[source,vim] [source,vim]
---- ----
let g:LanguageClient_serverCommands = { let g:LanguageClient_serverCommands = {
\ 'rust': ['ra_lsp_server'], \ 'rust': ['rust-analyzer'],
\ } \ }
---- ----
@ -142,7 +142,7 @@ Installation:
[source,json] [source,json]
---- ----
"rust-analyzer": { "rust-analyzer": {
"command": ["ra_lsp_server"], "command": ["rust-analyzer"],
"languageId": "rust", "languageId": "rust",
"scopes": ["source.rust"], "scopes": ["source.rust"],
"syntaxes": [ "syntaxes": [

View file

@ -179,13 +179,13 @@
"default": {}, "default": {},
"description": "Fine grained feature flags to disable annoying features" "description": "Fine grained feature flags to disable annoying features"
}, },
"rust-analyzer.raLspServerPath": { "rust-analyzer.serverPath": {
"type": [ "type": [
"null", "null",
"string" "string"
], ],
"default": null, "default": null,
"description": "Path to ra_lsp_server executable (points to bundled binary by default)" "description": "Path to rust-analyzer executable (points to bundled binary by default)"
}, },
"rust-analyzer.excludeGlobs": { "rust-analyzer.excludeGlobs": {
"type": "array", "type": "array",
@ -245,7 +245,7 @@
"Full log" "Full log"
], ],
"default": "off", "default": "off",
"description": "Trace requests to the ra_lsp_server" "description": "Trace requests to the rust-analyzer"
}, },
"rust-analyzer.lruCapacity": { "rust-analyzer.lruCapacity": {
"type": [ "type": [

View file

@ -76,7 +76,7 @@ export class Config {
} }
/** /**
* Name of the binary artifact for `ra_lsp_server` that is published for * Name of the binary artifact for `rust-analyzer` that is published for
* `platform` on GitHub releases. (It is also stored under the same name when * `platform` on GitHub releases. (It is also stored under the same name when
* downloaded by the extension). * downloaded by the extension).
*/ */
@ -91,12 +91,12 @@ export class Config {
case "arm": case "arm":
case "arm64": return null; case "arm64": return null;
default: return "ra_lsp_server-linux"; default: return "rust-analyzer-linux";
} }
} }
case "darwin": return "ra_lsp_server-mac"; case "darwin": return "rust-analyzer-mac";
case "win32": return "ra_lsp_server-windows.exe"; case "win32": return "rust-analyzer-windows.exe";
// Users on these platforms yet need to manually build from sources // Users on these platforms yet need to manually build from sources
case "aix": case "aix":
@ -111,7 +111,7 @@ export class Config {
} }
get serverSource(): null | BinarySource { get serverSource(): null | BinarySource {
const serverPath = RA_LSP_DEBUG ?? this.cfg.get<null | string>("raLspServerPath"); const serverPath = RA_LSP_DEBUG ?? this.cfg.get<null | string>("serverPath");
if (serverPath) { if (serverPath) {
return { return {

View file

@ -29,7 +29,7 @@ export async function ensureServerBinary(source: null | BinarySource): Promise<n
vscode.window.showErrorMessage( vscode.window.showErrorMessage(
`Unable to run ${source.path} binary. ` + `Unable to run ${source.path} binary. ` +
`To use the pre-built language server, set "rust-analyzer.raLspServerPath" ` + `To use the pre-built language server, set "rust-analyzer.serverPath" ` +
"value to `null` or remove it from the settings to use it by default." "value to `null` or remove it from the settings to use it by default."
); );
return null; return null;

View file

@ -39,7 +39,7 @@ impl InstallCmd {
" "
Installation complete. Installation complete.
Add `\"rust-analyzer.raLspServerPath\": \"ra_lsp_server\",` to VS Code settings, Add `\"rust-analyzer.serverPath\": \"rust-analyzer\",` to VS Code settings,
otherwise it will use the latest release from GitHub. otherwise it will use the latest release from GitHub.
" "
) )
@ -142,7 +142,7 @@ fn install_server(opts: ServerOpt) -> Result<()> {
} }
let jemalloc = if opts.jemalloc { "--features jemalloc" } else { "" }; let jemalloc = if opts.jemalloc { "--features jemalloc" } else { "" };
let res = run!("cargo install --path crates/ra_lsp_server --locked --force {}", jemalloc); let res = run!("cargo install --path crates/rust-analyzer --locked --force {}", jemalloc);
if res.is_err() && old_rust { if res.is_err() && old_rust {
eprintln!( eprintln!(