mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 04:23:25 +00:00
rename all things
This commit is contained in:
parent
ba0bfeee12
commit
b5021411a8
478 changed files with 219 additions and 204 deletions
|
@ -3,5 +3,5 @@ gen-kinds = "run --package tools -- gen-kinds"
|
||||||
gen-tests = "run --package tools -- gen-tests"
|
gen-tests = "run --package tools -- gen-tests"
|
||||||
install-code = "run --package tools -- install-code"
|
install-code = "run --package tools -- install-code"
|
||||||
|
|
||||||
render-test = "run --package cli -- render-test"
|
render-test = "run --package ra_cli -- render-test"
|
||||||
parse = "run --package cli -- parse"
|
parse = "run --package ra_cli -- parse"
|
||||||
|
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
languageserver-types = "0.49.0"
|
languageserver-types = "0.50.0"
|
||||||
log = "0.4.3"
|
log = "0.4.3"
|
||||||
|
|
||||||
failure = "0.1.2"
|
failure = "0.1.2"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libanalysis"
|
name = "ra_analysis"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ once_cell = "0.1.5"
|
||||||
rayon = "1.0.2"
|
rayon = "1.0.2"
|
||||||
fst = "0.3.1"
|
fst = "0.3.1"
|
||||||
im = "12.0.0"
|
im = "12.0.0"
|
||||||
libsyntax2 = { path = "../libsyntax2" }
|
ra_syntax = { path = "../ra_syntax" }
|
||||||
libeditor = { path = "../libeditor" }
|
ra_editor = { path = "../ra_editor" }
|
||||||
salsa = { path = "../salsa" }
|
salsa = { path = "../salsa" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
|
@ -2,7 +2,7 @@ use std::{
|
||||||
collections::BTreeMap,
|
collections::BTreeMap,
|
||||||
};
|
};
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
SmolStr,
|
SmolStr,
|
||||||
ast::{self, NameOwner},
|
ast::{self, NameOwner},
|
||||||
};
|
};
|
|
@ -9,8 +9,8 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use relative_path::RelativePath;
|
use relative_path::RelativePath;
|
||||||
use libeditor::{self, FileSymbol, LineIndex, find_node_at_offset, LocalEdit};
|
use ra_editor::{self, FileSymbol, LineIndex, find_node_at_offset, LocalEdit};
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
TextUnit, TextRange, SmolStr, File, AstNode,
|
TextUnit, TextRange, SmolStr, File, AstNode,
|
||||||
SyntaxKind::*,
|
SyntaxKind::*,
|
||||||
ast::{self, NameOwner},
|
ast::{self, NameOwner},
|
||||||
|
@ -228,7 +228,7 @@ impl AnalysisImpl {
|
||||||
let module_tree = root.module_tree();
|
let module_tree = root.module_tree();
|
||||||
let syntax = root.syntax(file_id);
|
let syntax = root.syntax(file_id);
|
||||||
|
|
||||||
let mut res = libeditor::diagnostics(&syntax)
|
let mut res = ra_editor::diagnostics(&syntax)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|d| Diagnostic { range: d.range, message: d.msg, fix: None })
|
.map(|d| Diagnostic { range: d.range, message: d.msg, fix: None })
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
@ -277,10 +277,10 @@ impl AnalysisImpl {
|
||||||
let file = self.file_syntax(file_id);
|
let file = self.file_syntax(file_id);
|
||||||
let offset = range.start();
|
let offset = range.start();
|
||||||
let actions = vec![
|
let actions = vec![
|
||||||
("flip comma", libeditor::flip_comma(&file, offset).map(|f| f())),
|
("flip comma", ra_editor::flip_comma(&file, offset).map(|f| f())),
|
||||||
("add `#[derive]`", libeditor::add_derive(&file, offset).map(|f| f())),
|
("add `#[derive]`", ra_editor::add_derive(&file, offset).map(|f| f())),
|
||||||
("add impl", libeditor::add_impl(&file, offset).map(|f| f())),
|
("add impl", ra_editor::add_impl(&file, offset).map(|f| f())),
|
||||||
("introduce variable", libeditor::introduce_variable(&file, range).map(|f| f())),
|
("introduce variable", ra_editor::introduce_variable(&file, range).map(|f| f())),
|
||||||
];
|
];
|
||||||
actions.into_iter()
|
actions.into_iter()
|
||||||
.filter_map(|(name, local_edit)| {
|
.filter_map(|(name, local_edit)| {
|
|
@ -2,8 +2,8 @@ extern crate parking_lot;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
extern crate once_cell;
|
extern crate once_cell;
|
||||||
extern crate libsyntax2;
|
extern crate ra_syntax;
|
||||||
extern crate libeditor;
|
extern crate ra_editor;
|
||||||
extern crate fst;
|
extern crate fst;
|
||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
extern crate relative_path;
|
extern crate relative_path;
|
||||||
|
@ -28,10 +28,10 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use relative_path::{RelativePath, RelativePathBuf};
|
use relative_path::{RelativePath, RelativePathBuf};
|
||||||
use libsyntax2::{File, TextRange, TextUnit, AtomEdit};
|
use ra_syntax::{File, TextRange, TextUnit, AtomEdit};
|
||||||
use imp::{AnalysisImpl, AnalysisHostImpl, FileResolverImp};
|
use imp::{AnalysisImpl, AnalysisHostImpl, FileResolverImp};
|
||||||
|
|
||||||
pub use libeditor::{
|
pub use ra_editor::{
|
||||||
StructureNode, LineIndex, FileSymbol,
|
StructureNode, LineIndex, FileSymbol,
|
||||||
Runnable, RunnableKind, HighlightedRange, CompletionItem,
|
Runnable, RunnableKind, HighlightedRange, CompletionItem,
|
||||||
};
|
};
|
||||||
|
@ -170,26 +170,26 @@ impl Analysis {
|
||||||
self.imp.file_line_index(file_id)
|
self.imp.file_line_index(file_id)
|
||||||
}
|
}
|
||||||
pub fn extend_selection(&self, file: &File, range: TextRange) -> TextRange {
|
pub fn extend_selection(&self, file: &File, range: TextRange) -> TextRange {
|
||||||
libeditor::extend_selection(file, range).unwrap_or(range)
|
ra_editor::extend_selection(file, range).unwrap_or(range)
|
||||||
}
|
}
|
||||||
pub fn matching_brace(&self, file: &File, offset: TextUnit) -> Option<TextUnit> {
|
pub fn matching_brace(&self, file: &File, offset: TextUnit) -> Option<TextUnit> {
|
||||||
libeditor::matching_brace(file, offset)
|
ra_editor::matching_brace(file, offset)
|
||||||
}
|
}
|
||||||
pub fn syntax_tree(&self, file_id: FileId) -> String {
|
pub fn syntax_tree(&self, file_id: FileId) -> String {
|
||||||
let file = self.imp.file_syntax(file_id);
|
let file = self.imp.file_syntax(file_id);
|
||||||
libeditor::syntax_tree(&file)
|
ra_editor::syntax_tree(&file)
|
||||||
}
|
}
|
||||||
pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange {
|
pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange {
|
||||||
let file = self.imp.file_syntax(file_id);
|
let file = self.imp.file_syntax(file_id);
|
||||||
SourceChange::from_local_edit(file_id, "join lines", libeditor::join_lines(&file, range))
|
SourceChange::from_local_edit(file_id, "join lines", ra_editor::join_lines(&file, range))
|
||||||
}
|
}
|
||||||
pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> {
|
pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> {
|
||||||
let file = self.imp.file_syntax(file_id);
|
let file = self.imp.file_syntax(file_id);
|
||||||
Some(SourceChange::from_local_edit(file_id, "add semicolon", libeditor::on_eq_typed(&file, offset)?))
|
Some(SourceChange::from_local_edit(file_id, "add semicolon", ra_editor::on_eq_typed(&file, offset)?))
|
||||||
}
|
}
|
||||||
pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
|
pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
|
||||||
let file = self.imp.file_syntax(file_id);
|
let file = self.imp.file_syntax(file_id);
|
||||||
libeditor::file_structure(&file)
|
ra_editor::file_structure(&file)
|
||||||
}
|
}
|
||||||
pub fn symbol_search(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> {
|
pub fn symbol_search(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> {
|
||||||
self.imp.world_symbols(query, token)
|
self.imp.world_symbols(query, token)
|
||||||
|
@ -208,15 +208,15 @@ impl Analysis {
|
||||||
}
|
}
|
||||||
pub fn runnables(&self, file_id: FileId) -> Vec<Runnable> {
|
pub fn runnables(&self, file_id: FileId) -> Vec<Runnable> {
|
||||||
let file = self.imp.file_syntax(file_id);
|
let file = self.imp.file_syntax(file_id);
|
||||||
libeditor::runnables(&file)
|
ra_editor::runnables(&file)
|
||||||
}
|
}
|
||||||
pub fn highlight(&self, file_id: FileId) -> Vec<HighlightedRange> {
|
pub fn highlight(&self, file_id: FileId) -> Vec<HighlightedRange> {
|
||||||
let file = self.imp.file_syntax(file_id);
|
let file = self.imp.file_syntax(file_id);
|
||||||
libeditor::highlight(&file)
|
ra_editor::highlight(&file)
|
||||||
}
|
}
|
||||||
pub fn completions(&self, file_id: FileId, offset: TextUnit) -> Option<Vec<CompletionItem>> {
|
pub fn completions(&self, file_id: FileId, offset: TextUnit) -> Option<Vec<CompletionItem>> {
|
||||||
let file = self.imp.file_syntax(file_id);
|
let file = self.imp.file_syntax(file_id);
|
||||||
libeditor::scope_completion(&file, offset)
|
ra_editor::scope_completion(&file, offset)
|
||||||
}
|
}
|
||||||
pub fn assists(&self, file_id: FileId, range: TextRange) -> Vec<SourceChange> {
|
pub fn assists(&self, file_id: FileId, range: TextRange) -> Vec<SourceChange> {
|
||||||
self.imp.assists(file_id, range)
|
self.imp.assists(file_id, range)
|
|
@ -1,6 +1,6 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use libsyntax2::File;
|
use ra_syntax::File;
|
||||||
use libeditor::LineIndex;
|
use ra_editor::LineIndex;
|
||||||
use {
|
use {
|
||||||
FileId,
|
FileId,
|
||||||
db::{Query, QueryCtx, QueryRegistry},
|
db::{Query, QueryCtx, QueryRegistry},
|
|
@ -6,8 +6,8 @@ use std::{
|
||||||
|
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use libeditor::LineIndex;
|
use ra_editor::LineIndex;
|
||||||
use libsyntax2::File;
|
use ra_syntax::File;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
FileId,
|
FileId,
|
|
@ -2,8 +2,8 @@ use std::{
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
hash::{Hash, Hasher},
|
hash::{Hash, Hasher},
|
||||||
};
|
};
|
||||||
use libeditor::{FileSymbol, file_symbols};
|
use ra_editor::{FileSymbol, file_symbols};
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
File,
|
File,
|
||||||
SyntaxKind::{self, *},
|
SyntaxKind::{self, *},
|
||||||
};
|
};
|
|
@ -1,5 +1,5 @@
|
||||||
extern crate libanalysis;
|
|
||||||
extern crate relative_path;
|
extern crate relative_path;
|
||||||
|
extern crate ra_analysis;
|
||||||
extern crate test_utils;
|
extern crate test_utils;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -8,7 +8,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use relative_path::{RelativePath, RelativePathBuf};
|
use relative_path::{RelativePath, RelativePathBuf};
|
||||||
use libanalysis::{Analysis, AnalysisHost, FileId, FileResolver, JobHandle, CrateGraph, CrateId};
|
use ra_analysis::{Analysis, AnalysisHost, FileId, FileResolver, JobHandle, CrateGraph, CrateId};
|
||||||
use test_utils::assert_eq_dbg;
|
use test_utils::assert_eq_dbg;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "cli"
|
name = "ra_cli"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -7,6 +7,6 @@ publish = false
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.32.0"
|
clap = "2.32.0"
|
||||||
failure = "0.1.1"
|
failure = "0.1.1"
|
||||||
libsyntax2 = { path = "../libsyntax2" }
|
ra_syntax = { path = "../ra_syntax" }
|
||||||
libeditor = { path = "../libeditor" }
|
ra_editor = { path = "../ra_editor" }
|
||||||
tools = { path = "../tools" }
|
tools = { path = "../tools" }
|
|
@ -1,8 +1,8 @@
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate failure;
|
extern crate failure;
|
||||||
extern crate libsyntax2;
|
extern crate ra_syntax;
|
||||||
extern crate libeditor;
|
extern crate ra_editor;
|
||||||
extern crate tools;
|
extern crate tools;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -11,13 +11,13 @@ use std::{
|
||||||
};
|
};
|
||||||
use clap::{App, Arg, SubCommand};
|
use clap::{App, Arg, SubCommand};
|
||||||
use tools::collect_tests;
|
use tools::collect_tests;
|
||||||
use libsyntax2::File;
|
use ra_syntax::File;
|
||||||
use libeditor::{syntax_tree, file_structure};
|
use ra_editor::{syntax_tree, file_structure};
|
||||||
|
|
||||||
type Result<T> = ::std::result::Result<T, failure::Error>;
|
type Result<T> = ::std::result::Result<T, failure::Error>;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let matches = App::new("libsyntax2-cli")
|
let matches = App::new("ra-cli")
|
||||||
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("render-test")
|
SubCommand::with_name("render-test")
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libeditor"
|
name = "ra_editor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -9,7 +9,7 @@ itertools = "0.7.8"
|
||||||
superslice = "0.1.0"
|
superslice = "0.1.0"
|
||||||
join_to_string = "0.1.1"
|
join_to_string = "0.1.1"
|
||||||
|
|
||||||
libsyntax2 = { path = "../libsyntax2" }
|
ra_syntax = { path = "../ra_syntax" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
test_utils = { path = "../test_utils" }
|
test_utils = { path = "../test_utils" }
|
|
@ -1,6 +1,6 @@
|
||||||
use join_to_string::join;
|
use join_to_string::join;
|
||||||
|
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
File, TextUnit, TextRange,
|
File, TextUnit, TextRange,
|
||||||
ast::{self, AstNode, AttrsOwner, TypeParamsOwner, NameOwner},
|
ast::{self, AstNode, AttrsOwner, TypeParamsOwner, NameOwner},
|
||||||
SyntaxKind::{COMMA, WHITESPACE},
|
SyntaxKind::{COMMA, WHITESPACE},
|
|
@ -1,6 +1,6 @@
|
||||||
use std::collections::{HashSet, HashMap};
|
use std::collections::{HashSet, HashMap};
|
||||||
|
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
File, TextUnit, AstNode, SyntaxNodeRef, SyntaxKind::*,
|
File, TextUnit, AstNode, SyntaxNodeRef, SyntaxKind::*,
|
||||||
ast::{self, LoopBodyOwner, ModuleItemOwner},
|
ast::{self, LoopBodyOwner, ModuleItemOwner},
|
||||||
algo::{
|
algo::{
|
|
@ -1,5 +1,5 @@
|
||||||
use {TextRange, TextUnit};
|
use {TextRange, TextUnit};
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
AtomEdit,
|
AtomEdit,
|
||||||
text_utils::contains_offset_nonstrict,
|
text_utils::contains_offset_nonstrict,
|
||||||
};
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
File, TextRange, SyntaxNodeRef, TextUnit,
|
File, TextRange, SyntaxNodeRef, TextUnit,
|
||||||
SyntaxKind::*,
|
SyntaxKind::*,
|
||||||
algo::{find_leaf_at_offset, LeafAtOffset, find_covering_node, ancestors, Direction, siblings},
|
algo::{find_leaf_at_offset, LeafAtOffset, find_covering_node, ancestors, Direction, siblings},
|
|
@ -1,4 +1,4 @@
|
||||||
extern crate libsyntax2;
|
extern crate ra_syntax;
|
||||||
extern crate superslice;
|
extern crate superslice;
|
||||||
extern crate itertools;
|
extern crate itertools;
|
||||||
extern crate join_to_string;
|
extern crate join_to_string;
|
||||||
|
@ -17,13 +17,13 @@ mod scope;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_utils;
|
mod test_utils;
|
||||||
|
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
File, TextUnit, TextRange, SyntaxNodeRef,
|
File, TextUnit, TextRange, SyntaxNodeRef,
|
||||||
ast::{self, AstNode, NameOwner},
|
ast::{self, AstNode, NameOwner},
|
||||||
algo::{walk, find_leaf_at_offset, ancestors},
|
algo::{walk, find_leaf_at_offset, ancestors},
|
||||||
SyntaxKind::{self, *},
|
SyntaxKind::{self, *},
|
||||||
};
|
};
|
||||||
pub use libsyntax2::AtomEdit;
|
pub use ra_syntax::AtomEdit;
|
||||||
pub use self::{
|
pub use self::{
|
||||||
line_index::{LineIndex, LineCol},
|
line_index::{LineIndex, LineCol},
|
||||||
extend_selection::extend_selection,
|
extend_selection::extend_selection,
|
||||||
|
@ -124,7 +124,7 @@ pub fn diagnostics(file: &File) -> Vec<Diagnostic> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn syntax_tree(file: &File) -> String {
|
pub fn syntax_tree(file: &File) -> String {
|
||||||
::libsyntax2::utils::dump_tree(file.syntax())
|
::ra_syntax::utils::dump_tree(file.syntax())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn runnables(file: &File) -> Vec<Runnable> {
|
pub fn runnables(file: &File) -> Vec<Runnable> {
|
|
@ -3,7 +3,7 @@ use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
};
|
};
|
||||||
|
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
SyntaxNodeRef, SyntaxNode, SmolStr, AstNode,
|
SyntaxNodeRef, SyntaxNode, SmolStr, AstNode,
|
||||||
ast::{self, NameOwner, LoopBodyOwner, ArgListOwner},
|
ast::{self, NameOwner, LoopBodyOwner, ArgListOwner},
|
||||||
algo::{ancestors, generate, walk::preorder}
|
algo::{ancestors, generate, walk::preorder}
|
||||||
|
@ -244,7 +244,7 @@ struct ScopeData {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use libsyntax2::File;
|
use ra_syntax::File;
|
||||||
use {find_node_at_offset, test_utils::extract_offset};
|
use {find_node_at_offset, test_utils::extract_offset};
|
||||||
|
|
||||||
fn do_check(code: &str, expected: &[&str]) {
|
fn do_check(code: &str, expected: &[&str]) {
|
|
@ -1,4 +1,4 @@
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
AstNode, SyntaxNode, SyntaxNodeRef, SmolStr,
|
AstNode, SyntaxNode, SyntaxNodeRef, SmolStr,
|
||||||
ast::{self, AstChildren},
|
ast::{self, AstChildren},
|
||||||
};
|
};
|
||||||
|
@ -86,7 +86,7 @@ fn collect_imports(tree: ast::UseTree, acc: &mut Vec<Entry>) {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use libsyntax2::{File, ast::ModuleItemOwner};
|
use ra_syntax::{File, ast::ModuleItemOwner};
|
||||||
|
|
||||||
fn do_check(code: &str, expected: &[&str]) {
|
fn do_check(code: &str, expected: &[&str]) {
|
||||||
let file = File::parse(&code);
|
let file = File::parse(&code);
|
|
@ -1,4 +1,4 @@
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
SyntaxKind, SyntaxNodeRef, AstNode, File, SmolStr,
|
SyntaxKind, SyntaxNodeRef, AstNode, File, SmolStr,
|
||||||
ast::{self, NameOwner},
|
ast::{self, NameOwner},
|
||||||
algo::{
|
algo::{
|
|
@ -1,4 +1,4 @@
|
||||||
use libsyntax2::{File, TextUnit, TextRange};
|
use ra_syntax::{File, TextUnit, TextRange};
|
||||||
pub use _test_utils::*;
|
pub use _test_utils::*;
|
||||||
use LocalEdit;
|
use LocalEdit;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
TextUnit, TextRange, SyntaxNodeRef, File, AstNode, SyntaxKind,
|
TextUnit, TextRange, SyntaxNodeRef, File, AstNode, SyntaxKind,
|
||||||
ast,
|
ast,
|
||||||
algo::{
|
algo::{
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "m"
|
name = "ra_lsp_server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
|
|
||||||
|
@ -15,16 +15,16 @@ crossbeam-channel = "0.2.4"
|
||||||
flexi_logger = "0.9.1"
|
flexi_logger = "0.9.1"
|
||||||
log = "0.4.3"
|
log = "0.4.3"
|
||||||
url_serde = "0.2.0"
|
url_serde = "0.2.0"
|
||||||
languageserver-types = "0.49.0"
|
languageserver-types = "0.50.0"
|
||||||
walkdir = "2.2.0"
|
walkdir = "2.2.0"
|
||||||
im = "12.0.0"
|
im = "12.0.0"
|
||||||
cargo_metadata = "0.6.0"
|
cargo_metadata = "0.6.0"
|
||||||
text_unit = { version = "0.1.2", features = ["serde"] }
|
text_unit = { version = "0.1.2", features = ["serde"] }
|
||||||
smol_str = { version = "0.1.5", features = ["serde"] }
|
smol_str = { version = "0.1.5", features = ["serde"] }
|
||||||
|
|
||||||
libsyntax2 = { path = "../libsyntax2" }
|
ra_syntax = { path = "../ra_syntax" }
|
||||||
libeditor = { path = "../libeditor" }
|
ra_editor = { path = "../ra_editor" }
|
||||||
libanalysis = { path = "../libanalysis" }
|
ra_analysis = { path = "../ra_analysis" }
|
||||||
gen_lsp_server = { path = "../gen_lsp_server" }
|
gen_lsp_server = { path = "../gen_lsp_server" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
|
@ -3,9 +3,9 @@ use languageserver_types::{
|
||||||
TextDocumentIdentifier, VersionedTextDocumentIdentifier, TextDocumentItem,
|
TextDocumentIdentifier, VersionedTextDocumentIdentifier, TextDocumentItem,
|
||||||
TextDocumentPositionParams, TextDocumentEdit,
|
TextDocumentPositionParams, TextDocumentEdit,
|
||||||
};
|
};
|
||||||
use libeditor::{LineIndex, LineCol, Edit, AtomEdit};
|
use ra_editor::{LineIndex, LineCol, Edit, AtomEdit};
|
||||||
use libsyntax2::{SyntaxKind, TextUnit, TextRange};
|
use ra_syntax::{SyntaxKind, TextUnit, TextRange};
|
||||||
use libanalysis::{FileId, SourceChange, SourceFileEdit, FileSystemEdit};
|
use ra_analysis::{FileId, SourceChange, SourceFileEdit, FileSystemEdit};
|
||||||
|
|
||||||
use {
|
use {
|
||||||
Result,
|
Result,
|
|
@ -18,9 +18,9 @@ extern crate relative_path;
|
||||||
extern crate cargo_metadata;
|
extern crate cargo_metadata;
|
||||||
|
|
||||||
extern crate gen_lsp_server;
|
extern crate gen_lsp_server;
|
||||||
extern crate libeditor;
|
extern crate ra_editor;
|
||||||
extern crate libanalysis;
|
extern crate ra_analysis;
|
||||||
extern crate libsyntax2;
|
extern crate ra_syntax;
|
||||||
|
|
||||||
mod caps;
|
mod caps;
|
||||||
pub mod req;
|
pub mod req;
|
|
@ -4,11 +4,11 @@ extern crate log;
|
||||||
extern crate failure;
|
extern crate failure;
|
||||||
extern crate flexi_logger;
|
extern crate flexi_logger;
|
||||||
extern crate gen_lsp_server;
|
extern crate gen_lsp_server;
|
||||||
extern crate m;
|
extern crate ra_lsp_server;
|
||||||
|
|
||||||
use flexi_logger::{Logger, Duplicate};
|
use flexi_logger::{Logger, Duplicate};
|
||||||
use gen_lsp_server::{run_server, stdio_transport};
|
use gen_lsp_server::{run_server, stdio_transport};
|
||||||
use m::Result;
|
use ra_lsp_server::Result;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
::std::env::set_var("RUST_BACKTRACE", "short");
|
::std::env::set_var("RUST_BACKTRACE", "short");
|
||||||
|
@ -34,12 +34,12 @@ fn main_inner() -> Result<()> {
|
||||||
let (receiver, sender, threads) = stdio_transport();
|
let (receiver, sender, threads) = stdio_transport();
|
||||||
let cwd = ::std::env::current_dir()?;
|
let cwd = ::std::env::current_dir()?;
|
||||||
run_server(
|
run_server(
|
||||||
m::server_capabilities(),
|
ra_lsp_server::server_capabilities(),
|
||||||
|params, r, s| {
|
|params, r, s| {
|
||||||
let root = params.root_uri
|
let root = params.root_uri
|
||||||
.and_then(|it| it.to_file_path().ok())
|
.and_then(|it| it.to_file_path().ok())
|
||||||
.unwrap_or(cwd);
|
.unwrap_or(cwd);
|
||||||
m::main_loop(false, root, r, s)
|
ra_lsp_server::main_loop(false, root, r, s)
|
||||||
},
|
},
|
||||||
receiver,
|
receiver,
|
||||||
sender,
|
sender,
|
|
@ -7,8 +7,8 @@ use languageserver_types::{
|
||||||
CompletionItem, InsertTextFormat, CompletionItemKind,
|
CompletionItem, InsertTextFormat, CompletionItemKind,
|
||||||
};
|
};
|
||||||
use serde_json::to_value;
|
use serde_json::to_value;
|
||||||
use libanalysis::{Query, FileId, RunnableKind, JobToken};
|
use ra_analysis::{Query, FileId, RunnableKind, JobToken};
|
||||||
use libsyntax2::{
|
use ra_syntax::{
|
||||||
text_utils::contains_offset_nonstrict,
|
text_utils::contains_offset_nonstrict,
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ use serde::{Serialize, de::DeserializeOwned};
|
||||||
use crossbeam_channel::{unbounded, Sender, Receiver};
|
use crossbeam_channel::{unbounded, Sender, Receiver};
|
||||||
use rayon::{self, ThreadPool};
|
use rayon::{self, ThreadPool};
|
||||||
use languageserver_types::{NumberOrString};
|
use languageserver_types::{NumberOrString};
|
||||||
use libanalysis::{FileId, JobHandle, JobToken, LibraryData};
|
use ra_analysis::{FileId, JobHandle, JobToken, LibraryData};
|
||||||
use gen_lsp_server::{
|
use gen_lsp_server::{
|
||||||
RawRequest, RawNotification, RawMessage, RawResponse, ErrorCode,
|
RawRequest, RawNotification, RawMessage, RawResponse, ErrorCode,
|
||||||
handle_shutdown,
|
handle_shutdown,
|
|
@ -1,5 +1,5 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use libanalysis::FileId;
|
use ra_analysis::FileId;
|
||||||
|
|
||||||
pub struct Subscriptions {
|
pub struct Subscriptions {
|
||||||
subs: HashSet<FileId>,
|
subs: HashSet<FileId>,
|
|
@ -1,7 +1,7 @@
|
||||||
use std::path::{PathBuf, Path, Component};
|
use std::path::{PathBuf, Path, Component};
|
||||||
use im;
|
use im;
|
||||||
use relative_path::RelativePath;
|
use relative_path::RelativePath;
|
||||||
use libanalysis::{FileId, FileResolver};
|
use ra_analysis::{FileId, FileResolver};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum Root {
|
pub enum Root {
|
|
@ -3,7 +3,7 @@ use std::{
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
use cargo_metadata::{metadata_run, CargoOpt};
|
use cargo_metadata::{metadata_run, CargoOpt};
|
||||||
use libsyntax2::SmolStr;
|
use ra_syntax::SmolStr;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
Result,
|
Result,
|
|
@ -6,7 +6,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use languageserver_types::Url;
|
use languageserver_types::Url;
|
||||||
use libanalysis::{FileId, AnalysisHost, Analysis, CrateGraph, CrateId, LibraryData, FileResolver};
|
use ra_analysis::{FileId, AnalysisHost, Analysis, CrateGraph, CrateId, LibraryData, FileResolver};
|
||||||
|
|
||||||
use {
|
use {
|
||||||
Result,
|
Result,
|
|
@ -6,11 +6,11 @@ extern crate serde;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
extern crate gen_lsp_server;
|
extern crate gen_lsp_server;
|
||||||
extern crate flexi_logger;
|
extern crate flexi_logger;
|
||||||
extern crate m;
|
extern crate ra_lsp_server;
|
||||||
|
|
||||||
mod support;
|
mod support;
|
||||||
|
|
||||||
use m::req::{Runnables, RunnablesParams};
|
use ra_lsp_server::req::{Runnables, RunnablesParams};
|
||||||
|
|
||||||
use support::project;
|
use support::project;
|
||||||
|
|
|
@ -21,7 +21,7 @@ use serde::Serialize;
|
||||||
use serde_json::{Value, from_str, to_string_pretty};
|
use serde_json::{Value, from_str, to_string_pretty};
|
||||||
use gen_lsp_server::{RawMessage, RawRequest, RawNotification};
|
use gen_lsp_server::{RawMessage, RawRequest, RawNotification};
|
||||||
|
|
||||||
use m::{main_loop, req, thread_watcher::{ThreadWatcher, Worker}};
|
use ra_lsp_server::{main_loop, req, thread_watcher::{ThreadWatcher, Worker}};
|
||||||
|
|
||||||
pub fn project(fixture: &str) -> Server {
|
pub fn project(fixture: &str) -> Server {
|
||||||
static INIT: Once = Once::new();
|
static INIT: Once = Once::new();
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libsyntax2"
|
name = "ra_syntax"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "libsyntax2-fuzz"
|
name = "ra_syntax-fuzz"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["Automatically generated"]
|
authors = ["Automatically generated"]
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -8,7 +8,7 @@ publish = false
|
||||||
[package.metadata]
|
[package.metadata]
|
||||||
cargo-fuzz = true
|
cargo-fuzz = true
|
||||||
|
|
||||||
[dependencies.libsyntax2]
|
[dependencies.ra_syntax]
|
||||||
path = ".."
|
path = ".."
|
||||||
[dependencies.libfuzzer-sys]
|
[dependencies.libfuzzer-sys]
|
||||||
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
|
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
|
|
@ -1,9 +1,9 @@
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#[macro_use] extern crate libfuzzer_sys;
|
#[macro_use] extern crate libfuzzer_sys;
|
||||||
extern crate libsyntax2;
|
extern crate ra_syntax;
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| {
|
fuzz_target!(|data: &[u8]| {
|
||||||
if let Ok(text) = std::str::from_utf8(data) {
|
if let Ok(text) = std::str::from_utf8(data) {
|
||||||
libsyntax2::utils::check_fuzz_invariants(text)
|
ra_syntax::utils::check_fuzz_invariants(text)
|
||||||
}
|
}
|
||||||
});
|
});
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue