@@ -17,7 +17,13 @@ import {
1717 TextEditor ,
1818 TextLine
1919} 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' ;
2127import { TextDocumentIdentifier } from "vscode-languageserver-types" ;
2228import Window = vscode . window ;
2329import { IFeature } from '../feature' ;
@@ -221,7 +227,24 @@ class PSDocumentFormattingEditProvider implements
221227 return this . emptyPromise ;
222228 }
223229
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 ) ;
225248 this . lockDocument ( document , textEdits ) ;
226249 PSDocumentFormattingEditProvider . showStatusBar ( document , textEdits ) ;
227250 return textEdits ;
0 commit comments