2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { DisposableStore } from '../../../../../base/common/lifecycle.js';
7
>
import { Schemas } from '../../../../../base/common/network.js';
8
>
import { URI } from '../../../../../base/common/uri.js';
9
>
import { VSBuffer } from '../../../../../base/common/buffer.js';
10
>
import { FileService } from '../../../../files/common/fileService.js';
11
>
import { IFileService } from '../../../../files/common/files.js';
12
>
import { InMemoryFileSystemProvider } from '../../../../files/common/inMemoryFilesystemProvider.js';
13
>
import { NullLogService } from '../../../../log/common/log.js';
14
>
15
>
/** The in-memory project (workspace) root the discovery tests scan. */
16
>
export const claudeTestWorkspace = URI.from({ scheme: Schemas.inMemory, path: '/workspace' });
17
>
18
>
/** The in-memory user-home root the discovery tests scan. */
19
>
export const claudeTestUserHome = URI.from({ scheme: Schemas.inMemory, path: '/home' });
20
>
21
>
/**
22
>
* Creates a {@link FileService} backed by an in-memory provider for the
23
>
* `inmemory` scheme, registering both with `disposables` for cleanup.
24
>
*/
25
>
export function createInMemoryFileService(disposables: DisposableStore): IFileService {
26
>
const fileService = disposables.add(new FileService(new NullLogService()));
27
>
disposables.add(fileService.registerProvider(Schemas.inMemory, disposables.add(new InMemoryFileSystemProvider())));
28
>
return fileService;
29
>
}
30
>
31
>
/** Writes `content` to the in-memory `path` and returns its URI. */
32
export async function seedFile(fileService: IFileService, path: string, content = ''): Promise<URI> {
33
const uri = URI.from({ scheme: Schemas.inMemory, path });