Describe the current lifetime/label completion specifics

This commit is contained in:
Lukas Wirth 2021-07-22 20:16:17 +02:00
parent d5947d9d48
commit 1f558faa8d
3 changed files with 10 additions and 3 deletions

View file

@ -1,4 +1,12 @@
//! Completes lifetimes and labels.
//!
//! These completions work a bit differently in that they are only shown when what the user types
//! has a `'` preceding it, as our fake syntax tree is invalid otherwise(due to us not inserting a
//! lifetime but an ident for obvious reasons).
//! Due to this all the tests for lifetimes and labels live in this module for the time being as
//! there is no value in lifting these out into the outline module test since they will either not
//! show up for normal completions, or they won't show completions other than lifetimes depending
//! on the fixture input.
use hir::ScopeDef;
use crate::{completions::Completions, context::CompletionContext};

View file

@ -35,7 +35,6 @@ struct Foo<'lt, T, const C: usize> where $0 {}
#[test]
fn bound_for_type_pred() {
// FIXME: only show traits, macros and modules
check(
r#"
struct Foo<'lt, T, const C: usize> where T: $0 {}
@ -54,7 +53,8 @@ struct Foo<'lt, T, const C: usize> where T: $0 {}
#[test]
fn bound_for_lifetime_pred() {
// FIXME: should only show lifetimes here
// FIXME: should only show lifetimes here, that is we shouldn't get any completions here when not typing
// a `'`
check(
r#"
struct Foo<'lt, T, const C: usize> where 'lt: $0 {}

View file

@ -142,7 +142,6 @@ fn foo<'lt, T, const C: usize>() {
#[test]
fn completes_types_and_const_in_arg_list() {
// FIXME: we should complete the lifetime here for now
check_with(
r#"
trait Trait2 {