From c0fa5e2246457df10e92c2e11c971f2f40921793 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Feb 2020 12:33:16 +0100 Subject: Rename the binary to rust-analyzer --- .github/workflows/release.yaml | 22 +++---- .vscode/launch.json | 4 +- .vscode/tasks.json | 2 +- Cargo.lock | 76 +++++++++++------------ README.md | 2 +- crates/ra_db/src/input.rs | 2 +- crates/ra_ide_db/src/feature_flags.rs | 2 +- crates/ra_lsp_server/Cargo.toml | 4 +- crates/ra_lsp_server/src/bin/args.rs | 16 ++--- crates/ra_lsp_server/src/bin/main.rs | 6 +- crates/ra_lsp_server/src/main_loop.rs | 2 +- crates/ra_lsp_server/tests/heavy_tests/main.rs | 2 +- crates/ra_lsp_server/tests/heavy_tests/support.rs | 2 +- crates/ra_prof/src/lib.rs | 4 +- crates/ra_syntax/Cargo.toml | 2 +- crates/ra_tt/Cargo.toml | 2 +- docs/dev/README.md | 18 +++--- docs/dev/architecture.md | 6 +- docs/dev/debugging.md | 16 ++--- docs/user/readme.adoc | 8 +-- editors/code/package.json | 4 +- editors/code/src/config.ts | 8 +-- xtask/src/install.rs | 4 +- 23 files changed, 107 insertions(+), 107 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d6d5dba95..a697c0071 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,29 +44,29 @@ jobs: CC: clang with: 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 if: matrix.os != 'ubuntu-latest' uses: actions-rs/cargo@v1 with: command: build - args: --package ra_lsp_server --bin ra_lsp_server --release + args: --package rust-analyzer --bin rust-analyzer --release - name: Create distribution dir run: mkdir ./dist - name: Copy binary 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 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 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 uses: actions/upload-artifact@v1 @@ -153,8 +153,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/ra_lsp_server-linux - asset_name: ra_lsp_server-linux + asset_path: ./dist/rust-analyzer-linux + asset_name: rust-analyzer-linux asset_content_type: application/octet-stream - uses: actions/upload-release-asset@v1.0.1 @@ -162,8 +162,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/ra_lsp_server-mac - asset_name: ra_lsp_server-mac + asset_path: ./dist/rust-analyzer-mac + asset_name: rust-analyzer-mac asset_content_type: application/octet-stream - uses: actions/upload-release-asset@v1.0.1 @@ -171,8 +171,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/ra_lsp_server-windows.exe - asset_name: ra_lsp_server-windows.exe + asset_path: ./dist/rust-analyzer-windows.exe + asset_name: rust-analyzer-windows.exe asset_content_type: application/octet-stream - uses: actions/upload-release-asset@v1.0.1 diff --git a/.vscode/launch.json b/.vscode/launch.json index b1bd98d4a..2e5c61735 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -45,7 +45,7 @@ "/**/*.js" ], "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", "type": "lldb", "request": "attach", - "program": "${workspaceFolder}/target/debug/ra_lsp_server", + "program": "${workspaceFolder}/target/debug/rust-analyzer", "pid": "${command:pickMyProcess}", "sourceLanguages": [ "rust" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index fc9a8593b..4037e7cce 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -19,7 +19,7 @@ "label": "Build Server", "group": "build", "type": "shell", - "command": "cargo build --package ra_lsp_server", + "command": "cargo build --package rust-analyzer", "problemMatcher": "$rustc" }, ] diff --git a/Cargo.lock b/Cargo.lock index c22cbca3a..c10d72aa4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1094,44 +1094,6 @@ dependencies = [ "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]] name = "ra_mbe" version = "0.1.0" @@ -1353,6 +1315,44 @@ dependencies = [ "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]] name = "rustc-demangle" version = "0.1.16" diff --git a/README.md b/README.md index fabb8479d..13d81d4ae 100644 --- a/README.md +++ b/README.md @@ -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 $ 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 ``` diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 1f1dcea42..1b4b47215 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs @@ -3,7 +3,7 @@ //! derived from this input. //! //! 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. use std::{fmt, str::FromStr}; diff --git a/crates/ra_ide_db/src/feature_flags.rs b/crates/ra_ide_db/src/feature_flags.rs index 1b3cabf4d..76655f572 100644 --- a/crates/ra_ide_db/src/feature_flags.rs +++ b/crates/ra_ide_db/src/feature_flags.rs @@ -13,7 +13,7 @@ use rustc_hash::FxHashMap; /// checked at compile time, to keep things simple and flexible. /// /// 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)] pub struct FeatureFlags { flags: FxHashMap, diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index 151ca3da5..3dae43d2a 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -1,6 +1,6 @@ [package] edition = "2018" -name = "ra_lsp_server" +name = "rust-analyzer" version = "0.1.0" authors = ["rust-analyzer developers"] autobins = false @@ -9,7 +9,7 @@ autobins = false doctest = false [[bin]] -name = "ra_lsp_server" +name = "rust-analyzer" path = "./src/bin/main.rs" [dependencies] diff --git a/crates/ra_lsp_server/src/bin/args.rs b/crates/ra_lsp_server/src/bin/args.rs index 3890fe13a..5ad3963a2 100644 --- a/crates/ra_lsp_server/src/bin/args.rs +++ b/crates/ra_lsp_server/src/bin/args.rs @@ -5,7 +5,7 @@ use anyhow::{bail, Result}; 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}; @@ -74,7 +74,7 @@ impl Args { ra-cli-parse USAGE: - ra_lsp_server parse [FLAGS] + rust-analyzer parse [FLAGS] FLAGS: -h, --help Prints help inforamtion @@ -94,7 +94,7 @@ FLAGS: ra-cli-symbols USAGE: - ra_lsp_server highlight [FLAGS] + rust-analyzer highlight [FLAGS] FLAGS: -h, --help Prints help inforamtion" @@ -113,7 +113,7 @@ FLAGS: ra-cli-highlight USAGE: - ra_lsp_server highlight [FLAGS] + rust-analyzer highlight [FLAGS] FLAGS: -h, --help Prints help information @@ -133,7 +133,7 @@ FLAGS: ra-cli-analysis-stats USAGE: - ra_lsp_server analysis-stats [FLAGS] [OPTIONS] [PATH] + rust-analyzer analysis-stats [FLAGS] [OPTIONS] [PATH] FLAGS: -h, --help Prints help information @@ -168,10 +168,10 @@ ARGS: if matches.contains(["-h", "--help"]) { eprintln!( "\ -ra_lsp_server-analysis-bench +rust-analyzer-analysis-bench USAGE: - ra_lsp_server analysis-bench [FLAGS] [OPTIONS] [PATH] + rust-analyzer analysis-bench [FLAGS] [OPTIONS] [PATH] FLAGS: -h, --help Prints help information @@ -207,7 +207,7 @@ ARGS: ra-cli USAGE: - ra_lsp_server + rust-analyzer FLAGS: -h, --help Prints help information diff --git a/crates/ra_lsp_server/src/bin/main.rs b/crates/ra_lsp_server/src/bin/main.rs index e25d54a0d..69e709a25 100644 --- a/crates/ra_lsp_server/src/bin/main.rs +++ b/crates/ra_lsp_server/src/bin/main.rs @@ -4,8 +4,8 @@ mod args; use lsp_server::Connection; -use ra_lsp_server::{cli, from_json, show_message, Result, ServerConfig}; use ra_prof; +use rust_analyzer::{cli, from_json, show_message, Result, ServerConfig}; use crate::args::HelpPrinted; @@ -51,7 +51,7 @@ fn run_server() -> Result<()> { log::info!("lifecycle: server started"); 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 = @@ -84,7 +84,7 @@ fn run_server() -> Result<()> { }) .unwrap_or_default(); - ra_lsp_server::main_loop( + rust_analyzer::main_loop( workspace_roots, initialize_params.capabilities, server_config, diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 67d8a5f6f..dc16a234d 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -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. mod handlers; diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index 9ca31cbcc..3af63d9cf 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs @@ -7,7 +7,7 @@ use lsp_types::{ PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams, WorkDoneProgressParams, }; -use ra_lsp_server::req::{ +use rust_analyzer::req::{ CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument, Formatting, OnEnter, Runnables, RunnablesParams, }; diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs index d5ea52fa9..5b90b3218 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/support.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs @@ -19,7 +19,7 @@ use serde_json::{to_string_pretty, Value}; use tempfile::TempDir; 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> { fixture: &'a str, diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index 7ff8db58a..c267bc85f 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs @@ -351,13 +351,13 @@ impl Drop for Scope { /// 2. Build with `cpu_profiler` feature. /// 3. Tun the code, the *raw* output would be in the `./out.profile` file. /// 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: /// /// ```bash /// $ 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)] pub struct CpuProfiler { diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml index 83db943fe..cb72972c5 100644 --- a/crates/ra_syntax/Cargo.toml +++ b/crates/ra_syntax/Cargo.toml @@ -22,7 +22,7 @@ ra_text_edit = { path = "../ra_text_edit" } ra_parser = { path = "../ra_parser" } # 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 smol_str = { version = "0.1.12", features = ["serde"] } serde = { version = "1", features = ["derive"] } diff --git a/crates/ra_tt/Cargo.toml b/crates/ra_tt/Cargo.toml index b8dceb92a..c9601fdcc 100644 --- a/crates/ra_tt/Cargo.toml +++ b/crates/ra_tt/Cargo.toml @@ -8,6 +8,6 @@ authors = ["rust-analyzer developers"] doctest = false [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 smol_str = { version = "0.1.12", features = ["serde"] } diff --git a/docs/dev/README.md b/docs/dev/README.md index ba24524f2..9da2eb014 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -80,7 +80,7 @@ In general, I use one of the following workflows for fixing bugs and implementing features. 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 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 @@ -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** 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: ```json { - "rust-analyzer.raLspServerPath": "ra_lsp_server" + "rust-analyzer.raLspServerPath": "rust-analyzer" } ``` After I am done with the fix, I use `cargo 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 just `cargo xtask install --server` and poke changes from my live environment. 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 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 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 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`. @@ -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: ``` -$ 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: ``` -$ cargo run --release -p ra_lsp_server -- 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/ --highlight ../chalk/chalk-engine/src/logic.rs +$ cargo run --release -p rust-analyzer -- analysis-bench ../chalk/ --complete ../chalk/chalk-engine/src/logic.rs:94:0 ``` diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md index 41c3909f7..0343b6c81 100644 --- a/docs/dev/architecture.md +++ b/docs/dev/architecture.md @@ -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 `hir`. -### `crates/ra_lsp_server` +### `crates/rust-analyzer` 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) 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 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 @@ -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. 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 `Analysis` functions and compares the results against expectation. diff --git a/docs/dev/debugging.md b/docs/dev/debugging.md index e6b082156..bece6a572 100644 --- a/docs/dev/debugging.md +++ b/docs/dev/debugging.md @@ -22,8 +22,8 @@ where **only** the `rust-analyzer` extension being debugged is enabled. ## Debug TypeScript VSCode extension -- `Run Extension` - runs the extension with the globally installed `ra_lsp_server` binary. -- `Run Extension (Dev Server)` - runs extension with the locally built LSP server (`target/debug/ra_lsp_server`). +- `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/rust-analyzer`). TypeScript debugging is configured to watch your source edits and recompile. To apply changes to an already running debug process press Ctrl+Shift+P and run the following command in your `[Extension Development Host]` @@ -47,13 +47,13 @@ To apply changes to an already running debug process press Ctrl+Shift+PCtrl+Shift+P Result<()> { } 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 { eprintln!( -- cgit v1.2.3