@@ -4,7 +4,6 @@ import path = require('path');
44import { C_MODE , CPP_MODE , OBJECTIVE_C_MODE , JAVA_MODE } from './clangMode' ;
55import { getBinPath } from './clangPath' ;
66import sax = require( 'sax' ) ;
7- import buffer = require( 'buffer' )
87
98export class ClangDocumentFormattingEditProvider implements vscode . DocumentFormattingEditProvider , vscode . DocumentRangeFormattingEditProvider {
109 private defaultConfigure = {
@@ -29,7 +28,7 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
2928 var edits : vscode . TextEdit [ ] = [ ] ;
3029 var currentEdit : { length : number , offset : number , text : string } ;
3130
32- var codeBuffer = new buffer . Buffer ( codeContent ) ;
31+ var codeBuffer = new Buffer ( codeContent ) ;
3332 // encoding position cache
3433 var codeByteOffsetCache = {
3534 byte : 0 ,
@@ -181,9 +180,9 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
181180 var length = document . offsetAt ( range . end ) - offset ;
182181
183182 // fix charater length to byte length
184- length = buffer . Buffer . byteLength ( codeContent . substr ( offset , length ) , 'utf8' ) ;
183+ length = Buffer . byteLength ( codeContent . substr ( offset , length ) , 'utf8' ) ;
185184 // fix charater offset to byte offset
186- offset = buffer . Buffer . byteLength ( codeContent . substr ( 0 , offset ) , 'utf8' ) ;
185+ offset = Buffer . byteLength ( codeContent . substr ( 0 , offset ) , 'utf8' ) ;
187186
188187 formatArgs . push ( `-offset=${ offset } ` , `-length=${ length } ` )
189188 }
0 commit comments