@@ -26,6 +26,7 @@ type testCase struct {
26
26
type testCaseResult struct {
27
27
list * lsproto.CompletionList
28
28
isIncludes bool
29
+ excludes []string
29
30
}
30
31
31
32
const defaultMainFileName = "/index.ts"
@@ -1214,18 +1215,10 @@ class Foo {
1214
1215
},
1215
1216
expectedResult : map [string ]* testCaseResult {
1216
1217
"1" : {
1217
- list : & lsproto.CompletionList {
1218
- IsIncomplete : false ,
1219
- ItemDefaults : itemDefaults ,
1220
- Items : []* lsproto.CompletionItem {},
1221
- },
1218
+ list : nil , // !!! jsx
1222
1219
},
1223
1220
"2" : {
1224
- list : & lsproto.CompletionList {
1225
- IsIncomplete : false ,
1226
- ItemDefaults : itemDefaults ,
1227
- Items : []* lsproto.CompletionItem {},
1228
- },
1221
+ list : nil , // !!! jsx
1229
1222
},
1230
1223
},
1231
1224
},
@@ -1729,6 +1722,50 @@ x./**/;`,
1729
1722
},
1730
1723
},
1731
1724
},
1725
+ {
1726
+ name : "completionsDotDotDotInObjectLiteral1" ,
1727
+ files : map [string ]string {
1728
+ defaultMainFileName : `const foo = { b: 100 };
1729
+ const bar: {
1730
+ a: number;
1731
+ b: number;
1732
+ } = {
1733
+ a: 42,
1734
+ .../*1*/
1735
+ };` ,
1736
+ },
1737
+ expectedResult : map [string ]* testCaseResult {
1738
+ "1" : {
1739
+ list : & lsproto.CompletionList {
1740
+ IsIncomplete : false ,
1741
+ ItemDefaults : itemDefaults ,
1742
+ Items : []* lsproto.CompletionItem {
1743
+ {
1744
+ Label : "foo" ,
1745
+ Kind : variableKind ,
1746
+ SortText : sortTextLocationPriority ,
1747
+ InsertTextFormat : insertTextFormatPlainText ,
1748
+ TextEdit : & lsproto.TextEditOrInsertReplaceEdit {
1749
+ InsertReplaceEdit : & lsproto.InsertReplaceEdit {
1750
+ NewText : "foo" ,
1751
+ Insert : lsproto.Range {
1752
+ Start : lsproto.Position {Line : 6 , Character : 5 },
1753
+ End : lsproto.Position {Line : 6 , Character : 5 },
1754
+ },
1755
+ Replace : lsproto.Range {
1756
+ Start : lsproto.Position {Line : 6 , Character : 5 },
1757
+ End : lsproto.Position {Line : 6 , Character : 5 },
1758
+ },
1759
+ },
1760
+ },
1761
+ },
1762
+ },
1763
+ },
1764
+ isIncludes : true ,
1765
+ excludes : []string {"b" },
1766
+ },
1767
+ },
1768
+ },
1732
1769
}
1733
1770
for _ , testCase := range testCases {
1734
1771
t .Run (testCase .name , func (t * testing.T ) {
@@ -1788,6 +1825,13 @@ func runTest(t *testing.T, files map[string]string, expected map[string]*testCas
1788
1825
} else {
1789
1826
assert .DeepEqual (t , completionList , expectedResult .list )
1790
1827
}
1828
+ for _ , excludedLabel := range expectedResult .excludes {
1829
+ for _ , item := range completionList .Items {
1830
+ if item .Label == excludedLabel {
1831
+ t .Fatalf ("Label %s should not be included in completion list" , excludedLabel )
1832
+ }
1833
+ }
1834
+ }
1791
1835
}
1792
1836
}
1793
1837
0 commit comments