mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +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,
|
||||
parse_only: bool,
|
||||
db: &RootDatabase,
|
||||
position: FilePosition,
|
||||
resolve_context: FilePosition,
|
||||
selections: Vec<FileRange>,
|
||||
) -> Result<Vec<SourceFileEdit>, SsrError> {
|
||||
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)?;
|
||||
if parse_only {
|
||||
return Ok(Vec::new());
|
||||
|
|
|
@ -141,14 +141,14 @@ impl Resolver<'_, '_> {
|
|||
impl<'db> ResolutionScope<'db> {
|
||||
pub(crate) fn new(
|
||||
sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>,
|
||||
lookup_context: FilePosition,
|
||||
resolve_context: FilePosition,
|
||||
) -> ResolutionScope<'db> {
|
||||
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.
|
||||
let node = file
|
||||
.syntax()
|
||||
.token_at_offset(lookup_context.offset)
|
||||
.token_at_offset(resolve_context.offset)
|
||||
.left_biased()
|
||||
.map(|token| token.parent())
|
||||
.unwrap_or_else(|| file.syntax().clone());
|
||||
|
@ -156,7 +156,7 @@ impl<'db> ResolutionScope<'db> {
|
|||
let scope = sema.scope(&node);
|
||||
ResolutionScope {
|
||||
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