@@ -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"
@@ -1215,18 +1216,10 @@ class Foo {
1215
1216
},
1216
1217
expectedResult : map [string ]* testCaseResult {
1217
1218
"1" : {
1218
- list : & lsproto.CompletionList {
1219
- IsIncomplete : false ,
1220
- ItemDefaults : itemDefaults ,
1221
- Items : []* lsproto.CompletionItem {},
1222
- },
1219
+ list : nil , // !!! jsx
1223
1220
},
1224
1221
"2" : {
1225
- list : & lsproto.CompletionList {
1226
- IsIncomplete : false ,
1227
- ItemDefaults : itemDefaults ,
1228
- Items : []* lsproto.CompletionItem {},
1229
- },
1222
+ list : nil , // !!! jsx
1230
1223
},
1231
1224
},
1232
1225
},
@@ -1720,6 +1713,50 @@ x./**/;`,
1720
1713
},
1721
1714
},
1722
1715
},
1716
+ {
1717
+ name : "completionsDotDotDotInObjectLiteral1" ,
1718
+ files : map [string ]string {
1719
+ defaultMainFileName : `const foo = { b: 100 };
1720
+ const bar: {
1721
+ a: number;
1722
+ b: number;
1723
+ } = {
1724
+ a: 42,
1725
+ .../*1*/
1726
+ };` ,
1727
+ },
1728
+ expectedResult : map [string ]* testCaseResult {
1729
+ "1" : {
1730
+ list : & lsproto.CompletionList {
1731
+ IsIncomplete : false ,
1732
+ ItemDefaults : itemDefaults ,
1733
+ Items : []* lsproto.CompletionItem {
1734
+ {
1735
+ Label : "foo" ,
1736
+ Kind : variableKind ,
1737
+ SortText : sortTextLocationPriority ,
1738
+ InsertTextFormat : insertTextFormatPlainText ,
1739
+ TextEdit : & lsproto.TextEditOrInsertReplaceEdit {
1740
+ InsertReplaceEdit : & lsproto.InsertReplaceEdit {
1741
+ NewText : "foo" ,
1742
+ Insert : lsproto.Range {
1743
+ Start : lsproto.Position {Line : 6 , Character : 5 },
1744
+ End : lsproto.Position {Line : 6 , Character : 5 },
1745
+ },
1746
+ Replace : lsproto.Range {
1747
+ Start : lsproto.Position {Line : 6 , Character : 5 },
1748
+ End : lsproto.Position {Line : 6 , Character : 5 },
1749
+ },
1750
+ },
1751
+ },
1752
+ },
1753
+ },
1754
+ },
1755
+ isIncludes : true ,
1756
+ excludes : []string {"b" },
1757
+ },
1758
+ },
1759
+ },
1723
1760
}
1724
1761
for _ , testCase := range testCases {
1725
1762
t .Run (testCase .name , func (t * testing.T ) {
@@ -1779,6 +1816,13 @@ func runTest(t *testing.T, files map[string]string, expected map[string]*testCas
1779
1816
} else {
1780
1817
assert .DeepEqual (t , completionList , expectedResult .list )
1781
1818
}
1819
+ for _ , excludedLabel := range expectedResult .excludes {
1820
+ for _ , item := range completionList .Items {
1821
+ if item .Label == excludedLabel {
1822
+ t .Fatalf ("Label %s should not be included in completion list" , excludedLabel )
1823
+ }
1824
+ }
1825
+ }
1782
1826
}
1783
1827
}
1784
1828
0 commit comments