mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
remove job tokens
This commit is contained in:
parent
c4b0d3cd56
commit
998f2ae762
4 changed files with 61 additions and 66 deletions
|
@ -148,14 +148,14 @@ impl AnalysisImpl {
|
|||
pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> {
|
||||
self.root(file_id).lines(file_id)
|
||||
}
|
||||
pub fn world_symbols(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> {
|
||||
pub fn world_symbols(&self, query: Query) -> Vec<(FileId, FileSymbol)> {
|
||||
let mut buf = Vec::new();
|
||||
if query.libs {
|
||||
self.data.libs.iter().for_each(|it| it.symbols(&mut buf));
|
||||
} else {
|
||||
self.data.root.symbols(&mut buf);
|
||||
}
|
||||
query.search(&buf, token)
|
||||
query.search(&buf)
|
||||
}
|
||||
pub fn parent_module(&self, file_id: FileId) -> Cancelable<Vec<(FileId, FileSymbol)>> {
|
||||
let root = self.root(file_id);
|
||||
|
@ -205,7 +205,6 @@ impl AnalysisImpl {
|
|||
&self,
|
||||
file_id: FileId,
|
||||
offset: TextUnit,
|
||||
token: &JobToken,
|
||||
) -> Vec<(FileId, FileSymbol)> {
|
||||
let root = self.root(file_id);
|
||||
let module_tree = root.module_tree();
|
||||
|
@ -227,7 +226,7 @@ impl AnalysisImpl {
|
|||
return vec;
|
||||
} else {
|
||||
// If that fails try the index based approach.
|
||||
return self.index_resolve(name_ref, token);
|
||||
return self.index_resolve(name_ref);
|
||||
}
|
||||
}
|
||||
if let Some(name) = find_node_at_offset::<ast::Name>(syntax, offset) {
|
||||
|
@ -258,7 +257,7 @@ impl AnalysisImpl {
|
|||
vec![]
|
||||
}
|
||||
|
||||
pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, _token: &JobToken) -> Vec<(FileId, TextRange)> {
|
||||
pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit) -> Vec<(FileId, TextRange)> {
|
||||
let root = self.root(file_id);
|
||||
let file = root.syntax(file_id);
|
||||
let syntax = file.syntax();
|
||||
|
@ -380,7 +379,6 @@ impl AnalysisImpl {
|
|||
&self,
|
||||
file_id: FileId,
|
||||
offset: TextUnit,
|
||||
token: &JobToken,
|
||||
) -> Option<(FnDescriptor, Option<usize>)> {
|
||||
let root = self.root(file_id);
|
||||
let file = root.syntax(file_id);
|
||||
|
@ -391,7 +389,7 @@ impl AnalysisImpl {
|
|||
let name_ref = calling_node.name_ref()?;
|
||||
|
||||
// Resolve the function's NameRef (NOTE: this isn't entirely accurate).
|
||||
let file_symbols = self.index_resolve(name_ref, token);
|
||||
let file_symbols = self.index_resolve(name_ref);
|
||||
for (_, fs) in file_symbols {
|
||||
if fs.kind == FN_DEF {
|
||||
if let Some(fn_def) = find_node_at_offset(syntax, fs.node_range.start()) {
|
||||
|
@ -442,12 +440,12 @@ impl AnalysisImpl {
|
|||
None
|
||||
}
|
||||
|
||||
fn index_resolve(&self, name_ref: ast::NameRef, token: &JobToken) -> Vec<(FileId, FileSymbol)> {
|
||||
fn index_resolve(&self, name_ref: ast::NameRef) -> Vec<(FileId, FileSymbol)> {
|
||||
let name = name_ref.text();
|
||||
let mut query = Query::new(name.to_string());
|
||||
query.exact();
|
||||
query.limit(4);
|
||||
self.world_symbols(query, token)
|
||||
self.world_symbols(query)
|
||||
}
|
||||
|
||||
fn resolve_module(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue