mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
SSR: Rename position and lookup_context to resolve_context
This commit is contained in:
parent
cf55806257
commit
fcb6b166fb
2 changed files with 6 additions and 6 deletions
|
@ -59,11 +59,11 @@ pub fn parse_search_replace(
|
||||||
rule: &str,
|
rule: &str,
|
||||||
parse_only: bool,
|
parse_only: bool,
|
||||||
db: &RootDatabase,
|
db: &RootDatabase,
|
||||||
position: FilePosition,
|
resolve_context: FilePosition,
|
||||||
selections: Vec<FileRange>,
|
selections: Vec<FileRange>,
|
||||||
) -> Result<Vec<SourceFileEdit>, SsrError> {
|
) -> Result<Vec<SourceFileEdit>, SsrError> {
|
||||||
let rule: SsrRule = rule.parse()?;
|
let rule: SsrRule = rule.parse()?;
|
||||||
let mut match_finder = MatchFinder::in_context(db, position, selections);
|
let mut match_finder = MatchFinder::in_context(db, resolve_context, selections);
|
||||||
match_finder.add_rule(rule)?;
|
match_finder.add_rule(rule)?;
|
||||||
if parse_only {
|
if parse_only {
|
||||||
return Ok(Vec::new());
|
return Ok(Vec::new());
|
||||||
|
|
|
@ -141,14 +141,14 @@ impl Resolver<'_, '_> {
|
||||||
impl<'db> ResolutionScope<'db> {
|
impl<'db> ResolutionScope<'db> {
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>,
|
sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>,
|
||||||
lookup_context: FilePosition,
|
resolve_context: FilePosition,
|
||||||
) -> ResolutionScope<'db> {
|
) -> ResolutionScope<'db> {
|
||||||
use ra_syntax::ast::AstNode;
|
use ra_syntax::ast::AstNode;
|
||||||
let file = sema.parse(lookup_context.file_id);
|
let file = sema.parse(resolve_context.file_id);
|
||||||
// Find a node at the requested position, falling back to the whole file.
|
// Find a node at the requested position, falling back to the whole file.
|
||||||
let node = file
|
let node = file
|
||||||
.syntax()
|
.syntax()
|
||||||
.token_at_offset(lookup_context.offset)
|
.token_at_offset(resolve_context.offset)
|
||||||
.left_biased()
|
.left_biased()
|
||||||
.map(|token| token.parent())
|
.map(|token| token.parent())
|
||||||
.unwrap_or_else(|| file.syntax().clone());
|
.unwrap_or_else(|| file.syntax().clone());
|
||||||
|
@ -156,7 +156,7 @@ impl<'db> ResolutionScope<'db> {
|
||||||
let scope = sema.scope(&node);
|
let scope = sema.scope(&node);
|
||||||
ResolutionScope {
|
ResolutionScope {
|
||||||
scope,
|
scope,
|
||||||
hygiene: hir::Hygiene::new(sema.db, lookup_context.file_id.into()),
|
hygiene: hir::Hygiene::new(sema.db, resolve_context.file_id.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue