3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
- import { SuggestWidgetPreviewModel } from 'vs/editor/contrib/inlineCompletions/suggestWidgetPreviewModel' ;
6
+ import { minimizeInlineCompletion , SuggestWidgetPreviewModel } from 'vs/editor/contrib/inlineCompletions/suggestWidgetPreviewModel' ;
7
7
import { SuggestController } from 'vs/editor/contrib/suggest/suggestController' ;
8
8
import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2' ;
9
9
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection' ;
@@ -28,6 +28,7 @@ import { GhostTextContext } from 'vs/editor/contrib/inlineCompletions/test/utils
28
28
import { Range } from 'vs/editor/common/core/range' ;
29
29
import { runWithFakedTimers } from 'vs/base/test/common/timeTravelScheduler' ;
30
30
import { SharedInlineCompletionCache } from 'vs/editor/contrib/inlineCompletions/ghostTextModel' ;
31
+ import { createTextModel } from 'vs/editor/test/common/editorTestUtils' ;
31
32
32
33
suite ( 'Suggest Widget Model' , ( ) => {
33
34
test ( 'Active' , async ( ) => {
@@ -83,6 +84,19 @@ suite('Suggest Widget Model', () => {
83
84
}
84
85
) ;
85
86
} ) ;
87
+
88
+ test ( 'minimizeInlineCompletion' , async ( ) => {
89
+ const model = createTextModel ( 'fun' ) ;
90
+ const result = minimizeInlineCompletion ( model , { range : new Range ( 1 , 1 , 1 , 4 ) , text : 'function' } ) ! ;
91
+
92
+ assert . deepStrictEqual ( {
93
+ range : result . range . toString ( ) ,
94
+ text : result . text
95
+ } , {
96
+ range : '[1,4 -> 1,4]' ,
97
+ text : 'ction'
98
+ } ) ;
99
+ } ) ;
86
100
} ) ;
87
101
88
102
const provider : CompletionItemProvider = {
0 commit comments