@@ -1471,6 +1471,62 @@ public async Task EditRangeShouldNotEndAtCursorPosition(bool mutatingLspWorkspac
14711471 Assert . Equal ( new ( ) { Start = new ( 2 , 0 ) , End = new ( 2 , 8 ) } , results . ItemDefaults . EditRange . Value . First ) ;
14721472 }
14731473
1474+ [ Theory , CombinatorialData ]
1475+ public async Task TestHasInsertTextModeIfSupportedAsync ( bool mutatingLspWorkspace )
1476+ {
1477+ var markup =
1478+ @"class A
1479+ {
1480+ void M()
1481+ {
1482+ {|caret:|}
1483+ }
1484+ }" ;
1485+ var capabilities = CreateCoreCompletionCapabilities ( ) ;
1486+ capabilities . TextDocument . Completion . CompletionItem = new LSP . CompletionItemSetting
1487+ {
1488+ InsertTextModeSupport = new LSP . InsertTextModeSupportSetting { ValueSet = [ LSP . InsertTextMode . AsIs ] }
1489+ } ;
1490+
1491+ await using var testLspServer = await CreateTestLspServerAsync ( markup , mutatingLspWorkspace , capabilities ) ;
1492+ var completionParams = CreateCompletionParams (
1493+ testLspServer . GetLocations ( "caret" ) . Single ( ) ,
1494+ invokeKind : LSP . VSInternalCompletionInvokeKind . Explicit ,
1495+ triggerCharacter : "\0 " ,
1496+ triggerKind : LSP . CompletionTriggerKind . Invoked ) ;
1497+
1498+ var results = await RunGetCompletionsAsync ( testLspServer , completionParams ) . ConfigureAwait ( false ) ;
1499+ Assert . Equal ( LSP . InsertTextMode . AsIs , results . ItemDefaults . InsertTextMode ) ;
1500+ }
1501+
1502+ [ Theory , CombinatorialData ]
1503+ public async Task TestDoesNotHaveInsertTextModeIfNotSupportedAsync ( bool mutatingLspWorkspace )
1504+ {
1505+ var markup =
1506+ @"class A
1507+ {
1508+ void M()
1509+ {
1510+ {|caret:|}
1511+ }
1512+ }" ;
1513+ var capabilities = CreateCoreCompletionCapabilities ( ) ;
1514+ capabilities . TextDocument . Completion . CompletionItem = new LSP . CompletionItemSetting
1515+ {
1516+ InsertTextModeSupport = new LSP . InsertTextModeSupportSetting { ValueSet = [ ] }
1517+ } ;
1518+
1519+ await using var testLspServer = await CreateTestLspServerAsync ( markup , mutatingLspWorkspace , capabilities ) ;
1520+ var completionParams = CreateCompletionParams (
1521+ testLspServer . GetLocations ( "caret" ) . Single ( ) ,
1522+ invokeKind : LSP . VSInternalCompletionInvokeKind . Explicit ,
1523+ triggerCharacter : "\0 " ,
1524+ triggerKind : LSP . CompletionTriggerKind . Invoked ) ;
1525+
1526+ var results = await RunGetCompletionsAsync ( testLspServer , completionParams ) . ConfigureAwait ( false ) ;
1527+ Assert . Null ( results . ItemDefaults . InsertTextMode ) ;
1528+ }
1529+
14741530 internal static Task < LSP . CompletionList > RunGetCompletionsAsync ( TestLspServer testLspServer , LSP . CompletionParams completionParams )
14751531 {
14761532 return testLspServer . ExecuteRequestAsync < LSP . CompletionParams , LSP . CompletionList > ( LSP . Methods . TextDocumentCompletionName ,
0 commit comments