@@ -54,7 +54,7 @@ internal class DelegatedCompletionItemResolver(
54
54
55
55
if ( resolvedCompletionItem is not null )
56
56
{
57
- resolvedCompletionItem = await PostProcessCompletionItemAsync ( resolutionContext , resolvedCompletionItem , cancellationToken ) . ConfigureAwait ( false ) ;
57
+ resolvedCompletionItem = await PostProcessCompletionItemAsync ( resolutionContext , resolvedCompletionItem , clientCapabilities , cancellationToken ) . ConfigureAwait ( false ) ;
58
58
}
59
59
60
60
return resolvedCompletionItem ;
@@ -63,6 +63,7 @@ internal class DelegatedCompletionItemResolver(
63
63
private async Task < VSInternalCompletionItem > PostProcessCompletionItemAsync (
64
64
DelegatedCompletionResolutionContext context ,
65
65
VSInternalCompletionItem resolvedCompletionItem ,
66
+ VSInternalClientCapabilities clientCapabilities ,
66
67
CancellationToken cancellationToken )
67
68
{
68
69
if ( context . ProjectedKind != RazorLanguageKind . CSharp )
@@ -71,7 +72,7 @@ private async Task<VSInternalCompletionItem> PostProcessCompletionItemAsync(
71
72
return resolvedCompletionItem ;
72
73
}
73
74
74
- if ( ! resolvedCompletionItem . VsResolveTextEditOnCommit )
75
+ if ( clientCapabilities . SupportsVisualStudioExtensions && ! resolvedCompletionItem . VsResolveTextEditOnCommit )
75
76
{
76
77
// Resolve doesn't typically handle text edit resolution; however, in VS cases it does.
77
78
return resolvedCompletionItem ;
@@ -89,12 +90,15 @@ private async Task<VSInternalCompletionItem> PostProcessCompletionItemAsync(
89
90
return resolvedCompletionItem ;
90
91
}
91
92
92
- var formattingOptions = await _clientConnection
93
- . SendRequestAsync < TextDocumentIdentifierAndVersion , FormattingOptions ? > (
94
- LanguageServerConstants . RazorGetFormattingOptionsEndpointName ,
95
- documentContext . GetTextDocumentIdentifierAndVersion ( ) ,
96
- cancellationToken )
97
- . ConfigureAwait ( false ) ;
93
+ // In VS we call into the VS layer to get formatting options, as the editor decides based on a multiple sources
94
+ var formattingOptions = clientCapabilities . SupportsVisualStudioExtensions
95
+ ? await _clientConnection
96
+ . SendRequestAsync < TextDocumentIdentifierAndVersion , FormattingOptions ? > (
97
+ LanguageServerConstants . RazorGetFormattingOptionsEndpointName ,
98
+ documentContext . GetTextDocumentIdentifierAndVersion ( ) ,
99
+ cancellationToken )
100
+ . ConfigureAwait ( false )
101
+ : _optionsMonitor . CurrentValue . ToFormattingOptions ( ) ;
98
102
99
103
if ( formattingOptions is null )
100
104
{
0 commit comments