diff --git a/Cargo.lock b/Cargo.lock index ccdcfbee37..c22cbca3a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1102,6 +1102,7 @@ dependencies = [ "crossbeam-channel", "either", "env_logger", + "globset", "itertools", "jod-thread", "log", @@ -1120,7 +1121,6 @@ dependencies = [ "ra_syntax", "ra_text_edit", "ra_vfs", - "ra_vfs_glob", "rand", "relative-path", "rustc-hash", @@ -1227,14 +1227,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "ra_vfs_glob" -version = "0.1.0" -dependencies = [ - "globset", - "ra_vfs", -] - [[package]] name = "rand" version = "0.7.3" diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index be7982b2ab..da523ba8a2 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -12,6 +12,7 @@ anyhow = "1.0" crossbeam-channel = "0.4" either = "1.5" env_logger = { version = "0.7.1", default-features = false } +globset = "0.4.4" itertools = "0.8.0" jod-thread = "0.1.0" log = "0.4.3" @@ -33,7 +34,6 @@ ra_project_model = { path = "../ra_project_model" } ra_syntax = { path = "../ra_syntax" } ra_text_edit = { path = "../ra_text_edit" } ra_vfs = "0.5.0" -ra_vfs_glob = { path = "../ra_vfs_glob" } # This should only be used in CLI ra_db = { path = "../ra_db" } diff --git a/crates/ra_lsp_server/src/args.rs b/crates/ra_lsp_server/src/args.rs index 41959797cc..89e2139cec 100644 --- a/crates/ra_lsp_server/src/args.rs +++ b/crates/ra_lsp_server/src/args.rs @@ -1,3 +1,8 @@ +//! Command like parsing for rust-analyzer. +//! +//! If run started args, we run the LSP server loop. With a subcommand, we do a +//! one-time batch processing. + use anyhow::{bail, Result}; use pico_args::Arguments; use ra_lsp_server::cli::{BenchWhat, Position, Verbosity}; diff --git a/crates/ra_lsp_server/src/cli/load_cargo.rs b/crates/ra_lsp_server/src/cli/load_cargo.rs index b9a4e6abad..bb3e1513b8 100644 --- a/crates/ra_lsp_server/src/cli/load_cargo.rs +++ b/crates/ra_lsp_server/src/cli/load_cargo.rs @@ -7,9 +7,10 @@ use ra_db::{CrateGraph, FileId, SourceRootId}; use ra_ide::{AnalysisChange, AnalysisHost, FeatureFlags}; use ra_project_model::{get_rustc_cfg_options, PackageRoot, ProjectWorkspace}; use ra_vfs::{RootEntry, Vfs, VfsChange, VfsTask, Watch}; -use ra_vfs_glob::RustPackageFilterBuilder; use rustc_hash::FxHashMap; +use crate::vfs_glob::RustPackageFilterBuilder; + use anyhow::Result; fn vfs_file_to_id(f: ra_vfs::VfsFile) -> FileId { diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs index 2832b26057..958c70fe5f 100644 --- a/crates/ra_lsp_server/src/lib.rs +++ b/crates/ra_lsp_server/src/lib.rs @@ -23,6 +23,7 @@ macro_rules! print { }; } +mod vfs_glob; mod caps; mod cargo_target_spec; mod conv; diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 7ae2e1e6fd..944074118d 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -135,7 +135,7 @@ pub fn main_loop( let globs = config .exclude_globs .iter() - .map(|glob| ra_vfs_glob::Glob::new(glob)) + .map(|glob| crate::vfs_glob::Glob::new(glob)) .collect::, _>>()?; if config.use_client_watching { diff --git a/crates/ra_vfs_glob/src/lib.rs b/crates/ra_lsp_server/src/vfs_glob.rs similarity index 100% rename from crates/ra_vfs_glob/src/lib.rs rename to crates/ra_lsp_server/src/vfs_glob.rs diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index d993c5fc46..71c95d4af0 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs @@ -19,12 +19,12 @@ use ra_ide::{ }; use ra_project_model::{get_rustc_cfg_options, ProjectWorkspace}; use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot, VfsTask, Watch}; -use ra_vfs_glob::{Glob, RustPackageFilterBuilder}; use relative_path::RelativePathBuf; use crate::{ diagnostics::{CheckFixes, DiagnosticCollection}, main_loop::pending_requests::{CompletedRequest, LatestRequests}, + vfs_glob::{Glob, RustPackageFilterBuilder}, LspError, Result, }; diff --git a/crates/ra_vfs_glob/Cargo.toml b/crates/ra_vfs_glob/Cargo.toml deleted file mode 100644 index 094d6d6f44..0000000000 --- a/crates/ra_vfs_glob/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -edition = "2018" -name = "ra_vfs_glob" -version = "0.1.0" -authors = ["rust-analyzer developers"] - -[lib] -doctest = false - -[dependencies] -ra_vfs = "0.5.0" -globset = "0.4.4" diff --git a/xtask/tests/tidy-tests/docs.rs b/xtask/tests/tidy-tests/docs.rs index a8ed9793f2..b2571df258 100644 --- a/xtask/tests/tidy-tests/docs.rs +++ b/xtask/tests/tidy-tests/docs.rs @@ -73,7 +73,6 @@ fn no_docs_comments() { } let whitelist = [ - "ra_cli", "ra_db", "ra_hir", "ra_hir_expand",