sessions: use proper DI for fileService and pathService in AgenticPromptsService (#305727)

refactor: streamline access to file and path services in PromptsService
This commit is contained in:
Josh Spicer
2026-03-27 17:10:25 +00:00
committed by GitHub
parent 00515ed0a3
commit 89f90db494
2 changed files with 4 additions and 6 deletions

View File

@@ -38,8 +38,7 @@ export class AgenticPromptsService extends PromptsService {
private getCopilotRoot(): URI {
if (!this._copilotRoot) {
const pathService = this.instantiationService.invokeFunction(accessor => accessor.get(IPathService));
this._copilotRoot = joinPath(pathService.userHome({ preferLocal: true }), '.copilot');
this._copilotRoot = joinPath(this.pathService.userHome({ preferLocal: true }), '.copilot');
}
return this._copilotRoot;
}
@@ -62,9 +61,8 @@ export class AgenticPromptsService extends PromptsService {
* Each subdirectory containing a SKILL.md is treated as a skill.
*/
private async discoverBuiltinSkills(): Promise<readonly IAgentSkill[]> {
const fileService = this.instantiationService.invokeFunction(accessor => accessor.get(IFileService));
try {
const stat = await fileService.resolve(BUILTIN_SKILLS_URI);
const stat = await this.fileService.resolve(BUILTIN_SKILLS_URI);
if (!stat.children) {
return [];
}

View File

@@ -175,13 +175,13 @@ export class PromptsService extends Disposable implements IPromptsService {
@IInstantiationService protected readonly instantiationService: IInstantiationService,
@IUserDataProfileService private readonly userDataService: IUserDataProfileService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IFileService private readonly fileService: IFileService,
@IFileService protected readonly fileService: IFileService,
@IFilesConfigurationService private readonly filesConfigService: IFilesConfigurationService,
@IStorageService private readonly storageService: IStorageService,
@IExtensionService private readonly extensionService: IExtensionService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IWorkspaceContextService private readonly workspaceService: IWorkspaceContextService,
@IPathService private readonly pathService: IPathService,
@IPathService protected readonly pathService: IPathService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IAgentPluginService private readonly agentPluginService: IAgentPluginService,
@IWorkspaceTrustManagementService private readonly workspaceTrustService: IWorkspaceTrustManagementService,