mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-24 21:05:12 +00:00
Fix the tests
This commit is contained in:
parent
5aebf54fd4
commit
a7d75463c7
@ -13,7 +13,7 @@ use crate::completion::{
|
||||
};
|
||||
|
||||
pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
|
||||
if ctx.mod_under_caret.is_some() {
|
||||
if ctx.mod_declaration_under_caret.is_some() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ use super::{
|
||||
|
||||
/// Complete mod declaration, i.e. `mod <|> ;`
|
||||
pub(super) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
|
||||
let mod_under_caret = match &ctx.mod_under_caret {
|
||||
let mod_under_caret = match &ctx.mod_declaration_under_caret {
|
||||
Some(mod_under_caret) if mod_under_caret.item_list().is_some() => return None,
|
||||
Some(mod_under_caret) => mod_under_caret,
|
||||
None => return None,
|
||||
|
@ -13,7 +13,7 @@ pub(super) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
|
||||
None => return,
|
||||
};
|
||||
|
||||
if ctx.attribute_under_caret.is_some() || ctx.mod_under_caret.is_some() {
|
||||
if ctx.attribute_under_caret.is_some() || ctx.mod_declaration_under_caret.is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
|
||||
if ctx.record_lit_syntax.is_some()
|
||||
|| ctx.record_pat_syntax.is_some()
|
||||
|| ctx.attribute_under_caret.is_some()
|
||||
|| ctx.mod_under_caret.is_some()
|
||||
|| ctx.mod_declaration_under_caret.is_some()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ pub(crate) struct CompletionContext<'a> {
|
||||
pub(super) is_path_type: bool,
|
||||
pub(super) has_type_args: bool,
|
||||
pub(super) attribute_under_caret: Option<ast::Attr>,
|
||||
pub(super) mod_under_caret: Option<ast::Module>,
|
||||
pub(super) mod_declaration_under_caret: Option<ast::Module>,
|
||||
pub(super) unsafe_is_prev: bool,
|
||||
pub(super) if_is_prev: bool,
|
||||
pub(super) block_expr_parent: bool,
|
||||
@ -153,7 +153,7 @@ impl<'a> CompletionContext<'a> {
|
||||
has_type_args: false,
|
||||
dot_receiver_is_ambiguous_float_literal: false,
|
||||
attribute_under_caret: None,
|
||||
mod_under_caret: None,
|
||||
mod_declaration_under_caret: None,
|
||||
unsafe_is_prev: false,
|
||||
in_loop_body: false,
|
||||
ref_pat_parent: false,
|
||||
@ -241,7 +241,9 @@ impl<'a> CompletionContext<'a> {
|
||||
self.is_match_arm = is_match_arm(syntax_element.clone());
|
||||
self.has_item_list_or_source_file_parent =
|
||||
has_item_list_or_source_file_parent(syntax_element.clone());
|
||||
self.mod_under_caret = find_node_at_offset(&file_with_fake_ident, offset);
|
||||
self.mod_declaration_under_caret =
|
||||
find_node_at_offset::<ast::Module>(&file_with_fake_ident, offset)
|
||||
.filter(|module| module.item_list().is_none());
|
||||
}
|
||||
|
||||
fn fill(
|
||||
|
Loading…
Reference in New Issue
Block a user