11import * as vscode from 'vscode' ;
22import cp = require( 'child_process' ) ;
33import path = require( 'path' ) ;
4- import { MODES } from './clangMode' ;
4+ import { MODES } from './clangMode' ;
55import { getBinPath } from './clangPath' ;
66import sax = require( 'sax' ) ;
77
@@ -35,7 +35,7 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
3535 byte : 0 ,
3636 offset : 0
3737 } ;
38- var byteToOffset = function ( editInfo : { length : number , offset : number } ) {
38+ var byteToOffset = function ( editInfo : { length : number , offset : number } ) {
3939 var offset = editInfo . offset ;
4040 var length = editInfo . length ;
4141
@@ -122,11 +122,11 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
122122
123123 // replace placeholders, if present
124124 return execPath
125- . replace ( / \$ { workspaceRoot} / g, vscode . workspace . rootPath )
126- . replace ( / \$ { cwd} / g, process . cwd ( ) )
127- . replace ( / \$ { env\. ( [ ^ } ] + ) } / g, ( sub : string , envName : string ) => {
128- return process . env [ envName ] ;
129- } ) ;
125+ . replace ( / \$ { workspaceRoot} / g, vscode . workspace . rootPath )
126+ . replace ( / \$ { cwd} / g, process . cwd ( ) )
127+ . replace ( / \$ { env\. ( [ ^ } ] + ) } / g, ( sub : string , envName : string ) => {
128+ return process . env [ envName ] ;
129+ } ) ;
130130 }
131131
132132 private getStyle ( document : vscode . TextDocument ) {
@@ -158,7 +158,7 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
158158 }
159159
160160 private getAssumedFilename ( document : vscode . TextDocument ) {
161- let assumedFilename = vscode . workspace . getConfiguration ( 'clang-format' ) . get < string > ( 'assumeFilename' ) ;
161+ let assumedFilename = vscode . workspace . getConfiguration ( 'clang-format' ) . get < string > ( 'assumeFilename' ) ;
162162 if ( assumedFilename === "" ) {
163163 return document . fileName ;
164164 }
@@ -212,15 +212,15 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
212212 formatArgs . push ( `-offset=${ offset } ` , `-length=${ length } ` )
213213 }
214214
215- var workingPath = vscode . workspace . rootPath ; ;
216- if ( ! document . isUntitled ) {
215+ var workingPath = vscode . workspace . rootPath ;
216+ if ( ! document . isUntitled ) {
217217 workingPath = path . dirname ( document . fileName ) ;
218218 }
219219
220220 var child = cp . execFile ( formatCommandBinPath , formatArgs , { cwd : workingPath } , childCompleted ) ;
221221 child . stdin . end ( codeContent ) ;
222222
223- if ( token ) {
223+ if ( token ) {
224224 token . onCancellationRequested ( ( ) => {
225225 child . kill ( ) ;
226226 reject ( "Cancelation requested" ) ;
@@ -229,7 +229,7 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
229229 } ) ;
230230 }
231231
232- public formatDocument ( document : vscode . TextDocument ) : Thenable < vscode . TextEdit [ ] > {
232+ public formatDocument ( document : vscode . TextDocument ) : Thenable < vscode . TextEdit [ ] > {
233233 return this . doFormatDocument ( document , null , null , null ) ;
234234 }
235235
0 commit comments