33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { basename } from 'vs/base/common/path' ;
76import { URI } from 'vs/base/common/uri' ;
87import { IModeService } from 'vs/editor/common/services/modeService' ;
9- import * as pfs from 'vs/base/node/pfs' ;
108import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
119import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
1210import { IWorkbenchThemeService , IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService' ;
@@ -17,6 +15,8 @@ import { IGrammar, StackElement } from 'vscode-textmate';
1715import { TokenizationRegistry , TokenMetadata } from 'vs/editor/common/modes' ;
1816import { ThemeRule , findMatchingThemeRule } from 'vs/workbench/services/textMate/common/TMHelper' ;
1917import { Color } from 'vs/base/common/color' ;
18+ import { IFileService } from 'vs/platform/files/common/files' ;
19+ import { basename } from 'vs/base/common/resources' ;
2020
2121interface IToken {
2222 c : string ;
@@ -230,12 +230,12 @@ class Snapper {
230230CommandsRegistry . registerCommand ( '_workbench.captureSyntaxTokens' , function ( accessor : ServicesAccessor , resource : URI ) {
231231
232232 let process = ( resource : URI ) => {
233- let filePath = resource . fsPath ;
234- let fileName = basename ( filePath ) ;
233+ let fileService = accessor . get ( IFileService ) ;
234+ let fileName = basename ( resource ) ;
235235 let snapper = accessor . get ( IInstantiationService ) . createInstance ( Snapper ) ;
236236
237- return pfs . readFile ( filePath ) . then ( content => {
238- return snapper . captureSyntaxTokens ( fileName , content . toString ( ) ) ;
237+ return fileService . resolveContent ( resource ) . then ( content => {
238+ return snapper . captureSyntaxTokens ( fileName , content . value ) ;
239239 } ) ;
240240 } ;
241241
0 commit comments