Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
This commit is contained in:
@@ -84,7 +84,7 @@ impl Args {
|
||||
if matches.contains(["-h", "--help"]) {
|
||||
eprintln!(
|
||||
"\
|
||||
ra-cli-parse
|
||||
rust-analyzer parse
|
||||
|
||||
USAGE:
|
||||
rust-analyzer parse [FLAGS]
|
||||
@@ -104,7 +104,7 @@ FLAGS:
|
||||
if matches.contains(["-h", "--help"]) {
|
||||
eprintln!(
|
||||
"\
|
||||
ra-cli-symbols
|
||||
rust-analyzer symbols
|
||||
|
||||
USAGE:
|
||||
rust-analyzer highlight [FLAGS]
|
||||
@@ -123,7 +123,7 @@ FLAGS:
|
||||
if matches.contains(["-h", "--help"]) {
|
||||
eprintln!(
|
||||
"\
|
||||
ra-cli-highlight
|
||||
rust-analyzer highlight
|
||||
|
||||
USAGE:
|
||||
rust-analyzer highlight [FLAGS]
|
||||
@@ -143,7 +143,7 @@ FLAGS:
|
||||
if matches.contains(["-h", "--help"]) {
|
||||
eprintln!(
|
||||
"\
|
||||
ra-cli-analysis-stats
|
||||
rust-analyzer analysis-stats
|
||||
|
||||
USAGE:
|
||||
rust-analyzer analysis-stats [FLAGS] [OPTIONS] [PATH]
|
||||
@@ -193,7 +193,7 @@ ARGS:
|
||||
if matches.contains(["-h", "--help"]) {
|
||||
eprintln!(
|
||||
"\
|
||||
rust-analyzer-analysis-bench
|
||||
rust-analyzer analysis-bench
|
||||
|
||||
USAGE:
|
||||
rust-analyzer analysis-bench [FLAGS] [OPTIONS]
|
||||
@@ -236,7 +236,7 @@ ARGS:
|
||||
if matches.contains(["-h", "--help"]) {
|
||||
eprintln!(
|
||||
"\
|
||||
ra-cli-diagnostics
|
||||
rust-analyzer diagnostics
|
||||
|
||||
USAGE:
|
||||
rust-analyzer diagnostics [FLAGS] [PATH]
|
||||
@@ -269,7 +269,7 @@ ARGS:
|
||||
_ => {
|
||||
eprintln!(
|
||||
"\
|
||||
ra-cli
|
||||
rust-analyzer
|
||||
|
||||
USAGE:
|
||||
rust-analyzer <SUBCOMMAND>
|
||||
@@ -281,6 +281,8 @@ SUBCOMMANDS:
|
||||
analysis-bench
|
||||
analysis-stats
|
||||
highlight
|
||||
diagnostics
|
||||
proc-macro
|
||||
parse
|
||||
symbols"
|
||||
);
|
||||
|
||||
@@ -51,7 +51,7 @@ fn main() -> Result<()> {
|
||||
cli::diagnostics(path.as_ref(), load_output_dirs, with_proc_macro, all)?
|
||||
}
|
||||
|
||||
args::Command::ProcMacro => run_proc_macro_sv()?,
|
||||
args::Command::ProcMacro => run_proc_macro_srv()?,
|
||||
args::Command::RunServer => run_server()?,
|
||||
args::Command::Version => println!("rust-analyzer {}", env!("REV")),
|
||||
}
|
||||
@@ -65,7 +65,7 @@ fn setup_logging() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_proc_macro_sv() -> Result<()> {
|
||||
fn run_proc_macro_srv() -> Result<()> {
|
||||
ra_proc_macro_srv::cli::run();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ pub(crate) fn load_cargo(
|
||||
ProcMacroClient::dummy()
|
||||
} else {
|
||||
let path = std::env::current_exe()?;
|
||||
ProcMacroClient::extern_process(&path, &["proc-macro"]).unwrap()
|
||||
ProcMacroClient::extern_process(path, &["proc-macro"]).unwrap()
|
||||
};
|
||||
let host = load(&source_roots, ws, &mut vfs, receiver, extern_dirs, &proc_macro_client);
|
||||
Ok((host, source_roots))
|
||||
|
||||
@@ -24,7 +24,9 @@ use crate::{
|
||||
world::WorldSnapshot,
|
||||
Result,
|
||||
};
|
||||
use semantic_tokens::{ATTRIBUTE, BUILTIN_TYPE, ENUM_MEMBER, LIFETIME, TYPE_ALIAS, UNION};
|
||||
use semantic_tokens::{
|
||||
ATTRIBUTE, BUILTIN_TYPE, ENUM_MEMBER, LIFETIME, TYPE_ALIAS, UNION, UNRESOLVED_REFERENCE,
|
||||
};
|
||||
|
||||
pub trait Conv {
|
||||
type Output;
|
||||
@@ -381,6 +383,7 @@ impl Conv for Highlight {
|
||||
HighlightTag::Comment => SemanticTokenType::COMMENT,
|
||||
HighlightTag::Attribute => ATTRIBUTE,
|
||||
HighlightTag::Keyword => SemanticTokenType::KEYWORD,
|
||||
HighlightTag::UnresolvedReference => UNRESOLVED_REFERENCE,
|
||||
};
|
||||
|
||||
for modifier in self.modifiers.iter() {
|
||||
|
||||
@@ -10,6 +10,8 @@ pub(crate) const ENUM_MEMBER: SemanticTokenType = SemanticTokenType::new("enumMe
|
||||
pub(crate) const LIFETIME: SemanticTokenType = SemanticTokenType::new("lifetime");
|
||||
pub(crate) const TYPE_ALIAS: SemanticTokenType = SemanticTokenType::new("typeAlias");
|
||||
pub(crate) const UNION: SemanticTokenType = SemanticTokenType::new("union");
|
||||
pub(crate) const UNRESOLVED_REFERENCE: SemanticTokenType =
|
||||
SemanticTokenType::new("unresolvedReference");
|
||||
|
||||
pub(crate) const CONSTANT: SemanticTokenModifier = SemanticTokenModifier::new("constant");
|
||||
pub(crate) const CONTROL_FLOW: SemanticTokenModifier = SemanticTokenModifier::new("controlFlow");
|
||||
@@ -43,6 +45,7 @@ pub(crate) const SUPPORTED_TYPES: &[SemanticTokenType] = &[
|
||||
LIFETIME,
|
||||
TYPE_ALIAS,
|
||||
UNION,
|
||||
UNRESOLVED_REFERENCE,
|
||||
];
|
||||
|
||||
pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[
|
||||
|
||||
@@ -148,20 +148,17 @@ impl WorldState {
|
||||
|
||||
let proc_macro_client = match &config.proc_macro_srv {
|
||||
None => ProcMacroClient::dummy(),
|
||||
Some((path, args)) => {
|
||||
let path = std::path::Path::new(path);
|
||||
match ProcMacroClient::extern_process(path, args) {
|
||||
Ok(it) => it,
|
||||
Err(err) => {
|
||||
log::error!(
|
||||
"Fail to run ra_proc_macro_srv from path {}, error : {}",
|
||||
path.to_string_lossy(),
|
||||
err
|
||||
);
|
||||
ProcMacroClient::dummy()
|
||||
}
|
||||
Some((path, args)) => match ProcMacroClient::extern_process(path.into(), args) {
|
||||
Ok(it) => it,
|
||||
Err(err) => {
|
||||
log::error!(
|
||||
"Fail to run ra_proc_macro_srv from path {}, error: {:?}",
|
||||
path,
|
||||
err
|
||||
);
|
||||
ProcMacroClient::dummy()
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
workspaces
|
||||
@@ -184,7 +181,7 @@ impl WorldState {
|
||||
let mut analysis_host = AnalysisHost::new(lru_capacity);
|
||||
analysis_host.apply_change(change);
|
||||
WorldState {
|
||||
config: config,
|
||||
config,
|
||||
roots: folder_roots,
|
||||
workspaces: Arc::new(workspaces),
|
||||
analysis_host,
|
||||
|
||||
Reference in New Issue
Block a user