@@ -17,7 +17,13 @@ import {
17
17
TextEditor ,
18
18
TextLine
19
19
} from 'vscode' ;
20
- import { LanguageClient , RequestType , DocumentFormattingRequest } from 'vscode-languageclient' ;
20
+ import {
21
+ LanguageClient ,
22
+ RequestType ,
23
+ DocumentFormattingRequest ,
24
+ DocumentRangeFormattingParams ,
25
+ DocumentRangeFormattingRequest
26
+ } from 'vscode-languageclient' ;
21
27
import { TextDocumentIdentifier } from "vscode-languageserver-types" ;
22
28
import Window = vscode . window ;
23
29
import { IFeature } from '../feature' ;
@@ -221,7 +227,24 @@ class PSDocumentFormattingEditProvider implements
221
227
return this . emptyPromise ;
222
228
}
223
229
224
- let textEdits : Thenable < TextEdit [ ] > = this . executeRulesInOrder ( editor , range , options , 0 ) ;
230
+ let requestParams : DocumentRangeFormattingParams = {
231
+ textDocument : TextDocumentIdentifier . create ( document . uri . toString ( ) ) ,
232
+ range : {
233
+ start : {
234
+ line : range . start . line ,
235
+ character : range . start . character
236
+ } ,
237
+ end : {
238
+ line : range . end . line ,
239
+ character : range . end . character
240
+ }
241
+ } ,
242
+ options : this . getEditorSettings ( )
243
+ } ;
244
+
245
+ let textEdits = this . languageClient . sendRequest (
246
+ DocumentRangeFormattingRequest . type ,
247
+ requestParams ) ;
225
248
this . lockDocument ( document , textEdits ) ;
226
249
PSDocumentFormattingEditProvider . showStatusBar ( document , textEdits ) ;
227
250
return textEdits ;
0 commit comments