From 89f90db49492390d0131099b49f0cfcbda23bc41 Mon Sep 17 00:00:00 2001 From: Josh Spicer <23246594+joshspicer@users.noreply.github.com> Date: Fri, 27 Mar 2026 17:10:25 +0000 Subject: [PATCH] sessions: use proper DI for fileService and pathService in AgenticPromptsService (#305727) refactor: streamline access to file and path services in PromptsService --- src/vs/sessions/contrib/chat/browser/promptsService.ts | 6 ++---- .../chat/common/promptSyntax/service/promptsServiceImpl.ts | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/vs/sessions/contrib/chat/browser/promptsService.ts b/src/vs/sessions/contrib/chat/browser/promptsService.ts index bcce55f35dc..b77212599ea 100644 --- a/src/vs/sessions/contrib/chat/browser/promptsService.ts +++ b/src/vs/sessions/contrib/chat/browser/promptsService.ts @@ -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 { - 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 []; } diff --git a/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts b/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts index 62b0430152f..4e617edc4ae 100644 --- a/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts +++ b/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts @@ -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,