17
17
using Microsoft . VisualStudio . LanguageServer . ContainedLanguage ;
18
18
using Microsoft . VisualStudio . LanguageServer . Protocol ;
19
19
using Microsoft . VisualStudio . Razor . LanguageClient . Cohost ;
20
-
20
+ using Microsoft . VisualStudio . Razor . Settings ;
21
21
using RazorLSPConstants = Microsoft . VisualStudio . Razor . LanguageClient . RazorLSPConstants ;
22
22
using Response = Microsoft . CodeAnalysis . Razor . Remote . RemoteResponse < Microsoft . CodeAnalysis . Razor . Protocol . AutoInsert . RemoteInsertTextEdit ? > ;
23
23
@@ -32,6 +32,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor.LanguageClient.Cohost;
32
32
#pragma warning restore RS0030 // Do not use banned APIs
33
33
internal class CohostOnAutoInsertEndpoint (
34
34
IRemoteServiceInvoker remoteServiceInvoker ,
35
+ IClientSettingsManager clientSettingsManager ,
35
36
#pragma warning disable RS0030 // Do not use banned APIs
36
37
[ ImportMany ] IEnumerable < IOnAutoInsertTriggerCharacterProvider > onAutoInsertTriggerCharacterProviders ,
37
38
#pragma warning restore RS0030 // Do not use banned APIs
@@ -41,6 +42,7 @@ internal class CohostOnAutoInsertEndpoint(
41
42
: AbstractRazorCohostDocumentRequestHandler < VSInternalDocumentOnAutoInsertParams , VSInternalDocumentOnAutoInsertResponseItem ? > , IDynamicRegistrationProvider
42
43
{
43
44
private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker ;
45
+ private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager ;
44
46
private readonly IEnumerable < IOnAutoInsertTriggerCharacterProvider > _onAutoInsertTriggerCharacterProviders = onAutoInsertTriggerCharacterProviders ;
45
47
private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer ;
46
48
private readonly LSPRequestInvoker _requestInvoker = requestInvoker ;
@@ -81,6 +83,12 @@ internal class CohostOnAutoInsertEndpoint(
81
83
82
84
_logger . LogDebug ( $ "Resolving auto-insertion for { razorDocument . FilePath } ") ;
83
85
86
+ var clientSettings = _clientSettingsManager . GetClientSettings ( ) ;
87
+ var enableAutoClosingTags = clientSettings . AdvancedSettings . AutoClosingTags ;
88
+ var formatOnType = clientSettings . AdvancedSettings . FormatOnType ;
89
+ var indentWithTabs = clientSettings . ClientSpaceSettings . IndentWithTabs ;
90
+ var indentSize = clientSettings . ClientSpaceSettings . IndentSize ;
91
+
84
92
_logger . LogDebug ( $ "Calling OOP to resolve insertion at { request . Position } invoked by typing '{ request . Character } '") ;
85
93
var data = await _remoteServiceInvoker . TryInvokeAsync < IRemoteAutoInsertService , Response > (
86
94
razorDocument . Project . Solution ,
@@ -90,7 +98,10 @@ internal class CohostOnAutoInsertEndpoint(
90
98
razorDocument . Id ,
91
99
request . Position . ToLinePosition ( ) ,
92
100
request . Character ,
93
- autoCloseTags : true , // TODO: get value from client options
101
+ autoCloseTags : enableAutoClosingTags ,
102
+ formatOnType : formatOnType ,
103
+ indentWithTabs : indentWithTabs ,
104
+ indentSize : indentSize ,
94
105
cancellationToken ) ,
95
106
cancellationToken ) . ConfigureAwait ( false ) ;
96
107
0 commit comments