File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
src/tools/rust-analyzer/crates/ide-completion/src Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -466,7 +466,7 @@ impl CompletionContext<'_> {
466466 cov_mark:: hit!( completes_if_lifetime_without_idents) ;
467467 TextRange :: at ( self . original_token . text_range ( ) . start ( ) , TextSize :: from ( 1 ) )
468468 }
469- IDENT | LIFETIME_IDENT | UNDERSCORE => self . original_token . text_range ( ) ,
469+ IDENT | LIFETIME_IDENT | UNDERSCORE | INT_NUMBER => self . original_token . text_range ( ) ,
470470 _ if kind. is_keyword ( ) => self . original_token . text_range ( ) ,
471471 _ => TextRange :: empty ( self . position . offset ) ,
472472 }
Original file line number Diff line number Diff line change @@ -1730,6 +1730,51 @@ fn foo(a: A) { B { bar: a.$0 }; }
17301730 )
17311731 }
17321732
1733+ #[ test]
1734+ fn tuple_field_detail ( ) {
1735+ check (
1736+ r#"
1737+ struct S(i32);
1738+
1739+ fn f() -> i32 {
1740+ let s = S(0);
1741+ s.0$0
1742+ }
1743+ "# ,
1744+ SymbolKind :: Field ,
1745+ expect ! [ [ r#"
1746+ [
1747+ CompletionItem {
1748+ label: "0",
1749+ source_range: 56..57,
1750+ delete: 56..57,
1751+ insert: "0",
1752+ kind: SymbolKind(
1753+ Field,
1754+ ),
1755+ detail: "i32",
1756+ relevance: CompletionRelevance {
1757+ exact_name_match: false,
1758+ type_match: Some(
1759+ Exact,
1760+ ),
1761+ is_local: false,
1762+ is_item_from_trait: false,
1763+ is_item_from_notable_trait: false,
1764+ is_name_already_imported: false,
1765+ requires_import: false,
1766+ is_op_method: false,
1767+ is_private_editable: false,
1768+ postfix_match: None,
1769+ is_definite: false,
1770+ function: None,
1771+ },
1772+ },
1773+ ]
1774+ "# ] ] ,
1775+ ) ;
1776+ }
1777+
17331778 #[ test]
17341779 fn record_field_and_call_relevances ( ) {
17351780 check_relevance (
You can’t perform that action at this time.
0 commit comments