Add text edit to implicit 'static hints

This commit is contained in:
Lukas Wirth 2024-10-23 09:58:20 +02:00
parent bfaad1431b
commit 47d2359afa

View file

@ -9,6 +9,7 @@ use syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
SyntaxKind, SyntaxKind,
}; };
use text_edit::TextEdit;
use crate::{InlayHint, InlayHintPosition, InlayHintsConfig, InlayKind, LifetimeElisionHints}; use crate::{InlayHint, InlayHintPosition, InlayHintsConfig, InlayKind, LifetimeElisionHints};
@ -38,7 +39,7 @@ pub(super) fn hints(
range: t.text_range(), range: t.text_range(),
kind: InlayKind::Lifetime, kind: InlayKind::Lifetime,
label: "'static".into(), label: "'static".into(),
text_edit: None, text_edit: Some(TextEdit::insert(t.text_range().start(), "'static ".into())),
position: InlayHintPosition::After, position: InlayHintPosition::After,
pad_left: false, pad_left: false,
pad_right: true, pad_right: true,