@@ -123,7 +123,7 @@ namespace Harness.LanguageService {
123123 }
124124
125125 export class LanguageServiceAdapterHost {
126- protected virtualFileSystem : Utils . VirtualFileSystem < ScriptInfo > = new Utils . VirtualFileSystem < ScriptInfo > ( /*root*/ "c:" , /*useCaseSensitiveFilenames*/ false ) ;
126+ protected virtualFileSystem : Utils . VirtualFileSystem < ScriptInfo > = new Utils . VirtualFileSystem < ScriptInfo > ( virtualFileSystemRoot , /*useCaseSensitiveFilenames*/ false ) ;
127127
128128 constructor ( protected cancellationToken = DefaultHostCancellationToken . Instance ,
129129 protected settings = ts . getDefaultCompilerOptions ( ) ) {
@@ -191,7 +191,7 @@ namespace Harness.LanguageService {
191191 }
192192 return [ ] ;
193193 }
194- getCurrentDirectory ( ) : string { return "" ; }
194+ getCurrentDirectory ( ) : string { return virtualFileSystemRoot }
195195 getDefaultLibFileName ( ) : string { return Harness . Compiler . defaultLibFileName ; }
196196 getScriptFileNames ( ) : string [ ] { return this . getFilenames ( ) ; }
197197 getScriptSnapshot ( fileName : string ) : ts . IScriptSnapshot {
@@ -211,7 +211,7 @@ namespace Harness.LanguageService {
211211 readDirectory ( path : string , extensions ?: string [ ] , exclude ?: string [ ] , include ?: string [ ] ) : string [ ] {
212212 return ts . matchFiles ( path , extensions , exclude , include ,
213213 /*useCaseSensitiveFileNames*/ false ,
214- /*currentDirectory*/ "/" ,
214+ this . getCurrentDirectory ( ) ,
215215 ( p ) => this . virtualFileSystem . getAccessibleFileSystemEntries ( p ) ) ;
216216 }
217217 readFile ( path : string , encoding ?: string ) : string {
@@ -220,19 +220,7 @@ namespace Harness.LanguageService {
220220 }
221221 resolvePath ( path : string ) : string {
222222 if ( ! ts . isRootedDiskPath ( path ) ) {
223- // An "absolute" path for fourslash is one that is contained within the tests directory
224- const components = ts . getNormalizedPathComponents ( path , this . getCurrentDirectory ( ) ) ;
225- if ( components . length ) {
226- // If this is still a relative path after normalization (i.e. currentDirectory is relative), the root will be the empty string
227- if ( ! components [ 0 ] ) {
228- components . splice ( 0 , 1 ) ;
229- if ( components [ 0 ] !== "tests" ) {
230- // If not contained within test, assume its relative to the directory containing the test files
231- return ts . normalizePath ( ts . combinePaths ( "tests/cases/fourslash" , components . join ( ts . directorySeparator ) ) ) ;
232- }
233- }
234- return ts . normalizePath ( components . join ( ts . directorySeparator ) ) ;
235- }
223+ path = ts . combinePaths ( this . getCurrentDirectory ( ) , path ) ;
236224 }
237225 return ts . normalizePath ( path ) ;
238226 }
0 commit comments