Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Prepare for 2018 edition #943

Merged
merged 9 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cargo-features = ["edition"]

[package]
name = "rls"
version = "0.129.0"
edition = "2018"
authors = ["Nick Cameron <[email protected]>", "The RLS developers"]
description = "Rust Language Server - provides information about Rust programs to IDEs and other tools"
license = "Apache-2.0/MIT"
Expand Down
12 changes: 6 additions & 6 deletions src/actions/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ use std::collections::HashMap;
use std::iter;
use std::path::{Path, PathBuf};

use ls_types::{DiagnosticRelatedInformation, DiagnosticSeverity, Location, NumberOrString, Range};
use lsp_data::ls_util;
use languageserver_types::{DiagnosticRelatedInformation, DiagnosticSeverity, Location, NumberOrString, Range};
use crate::lsp_data::ls_util;
use serde_json;
use span::compiler::DiagnosticSpan;
use rls_span::compiler::DiagnosticSpan;
use url::Url;

pub use ls_types::Diagnostic;
pub use languageserver_types::Diagnostic;

#[derive(Debug)]
pub struct Suggestion {
Expand Down Expand Up @@ -344,7 +344,7 @@ impl IsWithin for Range {
#[cfg(test)]
mod diagnostic_message_test {
use super::*;
use ls_types::Position;
use languageserver_types::Position;

pub(super) fn parse_compiler_message(
compiler_message: &str,
Expand Down Expand Up @@ -735,7 +735,7 @@ help: consider borrowing here: `&string`"#,
mod diagnostic_suggestion_test {
use self::diagnostic_message_test::*;
use super::*;
use ls_types::Position;
use languageserver_types::Position;

#[test]
fn suggest_use_when_cannot_find_type() {
Expand Down
24 changes: 12 additions & 12 deletions src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
//! Actions that the RLS can perform: responding to requests, watching files,
//! etc.

use analysis::AnalysisHost;
use vfs::Vfs;
use config::FmtConfig;
use config::Config;
use rls_analysis::AnalysisHost;
use rls_vfs::Vfs;
use crate::config::FmtConfig;
use crate::config::Config;
use serde_json;
use url::Url;
use span;
use Span;
use rls_span as span;
use crate::Span;
use walkdir::WalkDir;

use actions::post_build::{BuildResults, PostBuildHandler, AnalysisQueue};
use actions::progress::{BuildProgressNotifier, BuildDiagnosticsNotifier};
use build::*;
use lsp_data;
use lsp_data::*;
use server::Output;
use crate::actions::post_build::{BuildResults, PostBuildHandler, AnalysisQueue};
use crate::actions::progress::{BuildProgressNotifier, BuildDiagnosticsNotifier};
use crate::build::*;
use crate::lsp_data;
use crate::lsp_data::*;
use crate::server::Output;

use std::collections::HashMap;
use std::path::{Path, PathBuf};
Expand Down
22 changes: 11 additions & 11 deletions src/actions/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@

//! One-way notifications that the RLS receives from the client.

use actions::{InitActionContext, FileWatch, VersionOrdering};
use vfs::Change;
use config::Config;
use crate::actions::{InitActionContext, FileWatch, VersionOrdering};
use rls_vfs::Change;
use crate::config::Config;
use serde::Deserialize;
use serde::de::Error;
use serde_json;
use Span;
use crate::Span;
use std::sync::atomic::Ordering;

use build::*;
use lsp_data::*;
use lsp_data::request::{RangeFormatting, RegisterCapability, UnregisterCapability};
use ls_types::notification::ShowMessage;
use server::Request;
use crate::build::*;
use crate::lsp_data::*;
use crate::lsp_data::request::{RangeFormatting, RegisterCapability, UnregisterCapability};
use languageserver_types::notification::ShowMessage;
use crate::server::Request;

pub use lsp_data::notification::{
pub use crate::lsp_data::notification::{
Initialized,
DidOpenTextDocument,
DidChangeTextDocument,
Expand All @@ -35,7 +35,7 @@ pub use lsp_data::notification::{
Cancel,
};

use server::{BlockingNotificationAction, Notification, Output};
use crate::server::{BlockingNotificationAction, Notification, Output};

use std::thread;

Expand Down
20 changes: 10 additions & 10 deletions src/actions/post_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::thread::{self, Thread};

use actions::diagnostics::{parse_diagnostics, Diagnostic, ParsedDiagnostics, Suggestion};
use actions::progress::DiagnosticsNotifier;
use build::BuildResult;
use ls_types::DiagnosticSeverity;
use crate::actions::diagnostics::{parse_diagnostics, Diagnostic, ParsedDiagnostics, Suggestion};
use crate::actions::progress::DiagnosticsNotifier;
use crate::build::BuildResult;
use languageserver_types::DiagnosticSeverity;
use itertools::Itertools;
use lsp_data::PublishDiagnosticsParams;
use crate::lsp_data::PublishDiagnosticsParams;

use analysis::AnalysisHost;
use data::Analysis;
use rls_analysis::AnalysisHost;
use rls_data::Analysis;
use url::Url;

pub type BuildResults = HashMap<PathBuf, Vec<(Diagnostic, Vec<Suggestion>)>>;
Expand All @@ -44,7 +44,7 @@ pub struct PostBuildHandler {
pub related_information_support: bool,
pub shown_cargo_error: Arc<AtomicBool>,
pub active_build_count: Arc<AtomicUsize>,
pub notifier: Box<DiagnosticsNotifier>,
pub notifier: Box<dyn DiagnosticsNotifier>,
pub blocked_threads: Vec<thread::Thread>,
}

Expand Down Expand Up @@ -111,7 +111,7 @@ impl PostBuildHandler {
fn reload_analysis_from_disk(&self, cwd: &Path) {
if self.use_black_list {
self.analysis
.reload_with_blacklist(&self.project_path, cwd, &::blacklist::CRATE_BLACKLIST)
.reload_with_blacklist(&self.project_path, cwd, &rls_blacklist::CRATE_BLACKLIST)
.unwrap();
} else {
self.analysis.reload(&self.project_path, cwd).unwrap();
Expand All @@ -125,7 +125,7 @@ impl PostBuildHandler {
analysis,
&self.project_path,
cwd,
&::blacklist::CRATE_BLACKLIST,
&rls_blacklist::CRATE_BLACKLIST,
)
.unwrap();
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/actions/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

use std::sync::atomic::{AtomicUsize, Ordering};

use lsp_data::{ProgressParams, PublishDiagnosticsParams, Progress, ShowMessageParams, MessageType};
use server::{Output, Notification};
use ls_types::notification::{PublishDiagnostics, ShowMessage};
use crate::lsp_data::{ProgressParams, PublishDiagnosticsParams, Progress, ShowMessageParams, MessageType};
use crate::server::{Output, Notification};
use languageserver_types::notification::{PublishDiagnostics, ShowMessage};

/// Trait for communication of build progress back to the client.
pub trait ProgressNotifier: Send {
Expand All @@ -33,7 +33,7 @@ pub enum ProgressUpdate {
// is not object-safe).
pub trait DiagnosticsNotifier: Send {
fn notify_begin_diagnostics(&self);
fn notify_publish_diagnostics(&self, PublishDiagnosticsParams);
fn notify_publish_diagnostics(&self, _: PublishDiagnosticsParams);
fn notify_error_diagnostics(&self, msg: String);
fn notify_end_diagnostics(&self);
}
Expand Down
32 changes: 16 additions & 16 deletions src/actions/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@

//! Requests that the RLS can respond to.

use actions::InitActionContext;
use data;
use crate::actions::InitActionContext;
use rls_data as data;
use url::Url;
use vfs::FileContents;
use rls_vfs::FileContents;
use racer;
use rustfmt::{format_input, FileLines, FileName, Input as FmtInput, Range as RustfmtRange};
use rustfmt_nightly::{format_input, FileLines, FileName, Input as FmtInput, Range as RustfmtRange};
use serde_json;
use span;

use actions::work_pool;
use actions::work_pool::WorkDescription;
use actions::run::collect_run_actions;
use lsp_data;
use lsp_data::*;
use server;
use server::{Ack, Output, Request, RequestAction, ResponseError};
use rls_span as span;

use crate::actions::work_pool;
use crate::actions::work_pool::WorkDescription;
use crate::actions::run::collect_run_actions;
use crate::lsp_data;
use crate::lsp_data::*;
use crate::server;
use crate::server::{Ack, Output, Request, RequestAction, ResponseError};
use jsonrpc_core::types::ErrorCode;
use analysis::SymbolQuery;
use rls_analysis::SymbolQuery;

use lsp_data::request::ApplyWorkspaceEdit;
pub use lsp_data::request::{
use crate::lsp_data::request::ApplyWorkspaceEdit;
pub use crate::lsp_data::request::{
WorkspaceSymbol,
DocumentSymbol as Symbols,
HoverRequest as Hover,
Expand Down
6 changes: 3 additions & 3 deletions src/actions/run.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use actions::InitActionContext;
use crate::actions::InitActionContext;
use ordslice::Ext;
use regex::Regex;
use span::{Column, Position, Range, Row, ZeroIndexed};
use vfs::FileContents;
use rls_span::{Column, Position, Range, Row, ZeroIndexed};
use rls_vfs::FileContents;

use std::{collections::HashMap, iter, path::Path};

Expand Down
2 changes: 1 addition & 1 deletion src/actions/work_pool.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rayon;
use server::DEFAULT_REQUEST_TIMEOUT;
use crate::server::DEFAULT_REQUEST_TIMEOUT;
use std::{fmt, panic};
use std::time::{Duration, Instant};
use std::sync::{mpsc, Mutex};
Expand Down
18 changes: 9 additions & 9 deletions src/build/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ use cargo::util::{homedir, important_paths, CargoResult, Config as CargoConfig,
use failure;
use serde_json;

use actions::progress::ProgressUpdate;
use data::Analysis;
use build::{BufWriter, BuildResult, CompilationContext, Internals, PackageArg};
use build::environment::{self, Environment, EnvironmentLock};
use config::Config;
use vfs::Vfs;
use crate::actions::progress::ProgressUpdate;
use rls_data::Analysis;
use crate::build::{BufWriter, BuildResult, CompilationContext, Internals, PackageArg};
use crate::build::environment::{self, Environment, EnvironmentLock};
use crate::config::Config;
use rls_vfs::Vfs;

use std::collections::{BTreeMap, HashMap, HashSet};
use std::env;
Expand Down Expand Up @@ -386,7 +386,7 @@ impl Executor for RlsExecutor {
.or_else(|| env::current_exe().ok().and_then(|x| x.to_str().map(String::from)))
.expect("Couldn't set executable for RLS rustc shim");
cmd.program(rustc_shim);
cmd.env(::RUSTC_SHIM_ENV_VAR_NAME, "1");
cmd.env(crate::RUSTC_SHIM_ENV_VAR_NAME, "1");

// Add args and envs to cmd.
let mut args: Vec<_> = cargo_args
Expand Down Expand Up @@ -430,14 +430,14 @@ impl Executor for RlsExecutor {
cmd.get_envs(),
);

if ::blacklist::CRATE_BLACKLIST.contains(&&*crate_name) {
if rls_blacklist::CRATE_BLACKLIST.contains(&&*crate_name) {
// By running the original command (rather than using our shim), we
// avoid producing save-analysis data.
trace!("crate is blacklisted");
return cargo_cmd.exec();
}
// Only include public symbols in externally compiled deps data
let mut save_config = ::data::config::Config::default();
let mut save_config = rls_data::config::Config::default();
save_config.pub_only = true;
save_config.reachable_only = true;
let save_config = serde_json::to_string(&save_config)?;
Expand Down
14 changes: 7 additions & 7 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

pub use self::cargo::make_cargo_config;

use actions::progress::{ProgressNotifier, ProgressUpdate};
use actions::post_build::PostBuildHandler;
use crate::actions::progress::{ProgressNotifier, ProgressUpdate};
use crate::actions::post_build::PostBuildHandler;
use cargo::util::important_paths;
use config::Config;
use data::Analysis;
use vfs::Vfs;
use crate::config::Config;
use rls_data::Analysis;
use rls_vfs::Vfs;

use self::environment::EnvironmentLock;

Expand Down Expand Up @@ -185,7 +185,7 @@ struct PendingBuild {
build_dir: PathBuf,
priority: BuildPriority,
built_files: HashMap<PathBuf, FileVersion>,
notifier: Box<ProgressNotifier>,
notifier: Box<dyn ProgressNotifier>,
pbh: PostBuildHandler,
}

Expand Down Expand Up @@ -259,7 +259,7 @@ impl BuildQueue {
&self,
new_build_dir: &Path,
mut priority: BuildPriority,
notifier: Box<ProgressNotifier>,
notifier: Box<dyn ProgressNotifier>,
pbh: PostBuildHandler
) {
trace!("request_build {:?}", priority);
Expand Down
Loading