fix unreachable pub

This commit is contained in:
Lukas Wirth 2022-05-07 15:08:33 +02:00
parent 44c3cc100b
commit a0fc649269
2 changed files with 4 additions and 6 deletions

View File

@ -14,7 +14,7 @@
CompletionItem, Completions,
};
/// Complete mod declaration, i.e. `mod ;`
/// Complete mod declaration, i.e. `mod $0;`
pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
let mod_under_caret = match ctx.name_ctx() {
Some(NameContext { kind: NameKind::Module(mod_under_caret), .. })
@ -28,7 +28,7 @@ pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Op
let _p = profile::span("completion::complete_mod");
let mut current_module = ctx.module;
// For `mod `, `ctx.module` is its parent, but for `mod f`, it's `mod f` itself, but we're
// For `mod $0`, `ctx.module` is its parent, but for `mod f$0`, it's `mod f` itself, but we're
// interested in its parent.
if ctx.original_token.kind() == SyntaxKind::IDENT {
if let Some(module) = ctx.original_token.ancestors().nth(1).and_then(ast::Module::cast) {

View File

@ -123,7 +123,7 @@ pub(super) struct LifetimeContext {
}
#[derive(Debug)]
pub enum LifetimeKind {
pub(super) enum LifetimeKind {
LifetimeParam { is_decl: bool, param: ast::LifetimeParam },
Lifetime,
LabelRef,
@ -131,7 +131,7 @@ pub enum LifetimeKind {
}
#[derive(Debug)]
pub struct NameContext {
pub(super) struct NameContext {
#[allow(dead_code)]
pub(super) name: Option<ast::Name>,
pub(super) kind: NameKind,
@ -534,9 +534,7 @@ pub(super) fn new(
file_with_fake_ident.syntax().token_at_offset(offset).right_biased()?;
let original_token = original_file.syntax().token_at_offset(offset).left_biased()?;
dbg!(&original_token);
let token = sema.descend_into_macros_single(original_token.clone());
dbg!(&token);
let scope = sema.scope_at_offset(&token.parent()?, offset)?;
let krate = scope.krate();
let module = scope.module();