Add completion without body.

Add completion for Fn, Const, TypeAlias without body.
This commit is contained in:
Duong Quoc Khanh 2023-02-09 17:37:11 +09:00
parent 58136b01ba
commit 74cd8ecc7e
No known key found for this signature in database
GPG key ID: DA52A74E804A00E7

View file

@ -675,10 +675,10 @@ fn classify_name_ref(
{
if let Some(item) = ast::Item::cast(n) {
let is_inbetween = match &item {
ast::Item::Const(it) => it.body().is_none(),
ast::Item::Const(it) => it.body().is_none() && it.semicolon_token().is_none(),
ast::Item::Enum(it) => it.variant_list().is_none(),
ast::Item::ExternBlock(it) => it.extern_item_list().is_none(),
ast::Item::Fn(it) => it.body().is_none(),
ast::Item::Fn(it) => it.body().is_none() && it.semicolon_token().is_none(),
ast::Item::Impl(it) => it.assoc_item_list().is_none(),
ast::Item::Module(it) => {
it.item_list().is_none() && it.semicolon_token().is_none()
@ -688,7 +688,7 @@ fn classify_name_ref(
it.field_list().is_none() && it.semicolon_token().is_none()
}
ast::Item::Trait(it) => it.assoc_item_list().is_none(),
ast::Item::TypeAlias(it) => it.ty().is_none(),
ast::Item::TypeAlias(it) => it.ty().is_none() && it.semicolon_token().is_none(),
ast::Item::Union(it) => it.record_field_list().is_none(),
_ => false,
};