Change:
There are some parts in notebook land that depend on . This service and its provider are deprecated and should be removed. As of today the following dependencies must be cleaned up first: , , The should be used instead, it will allow you to know if a agent per location exists or not

Discussion:
import { IMarkerData, IMarkerService } from 'vs/platform/markers/common/markers'; import { IRange } from 'vs/editor/common/core/range'; import { ICellExecutionError, ICellExecutionStateChangedEvent, IExecutionStateChangedEvent, INotebookExecutionStateService, NotebookExecutionType } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService'; <del> import { IInlineChatService } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; </del> import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { CellKind, NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { INotebookEditor, INotebookEditorContribution } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';

import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel'; import { URI } from 'vs/base/common/uri'; import { Event } from 'vs/base/common/event'; <ins> import { IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents'; </ins> type CellDiagnostic = { cellUri: URI;

private readonly notebookEditor: INotebookEditor, @INotebookExecutionStateService private readonly notebookExecutionStateService: INotebookExecutionStateService, @IMarkerService private readonly markerService: IMarkerService, <del> @IInlineChatService private readonly inlineChatService: IInlineChatService, </del> <ins> @IChatAgentService private readonly chatAgentService: IChatAgentService, </ins> @IConfigurationService private readonly configurationService: IConfigurationService ) { super(); this.updateEnabled(); <del> this._register(inlineChatService.onDidChangeProviders(() => this.updateEnabled())); </del> <ins> this._register(chatAgentService.onDidChangeAgents(() => this.updateEnabled())); </ins> this._register(configurationService.onDidChangeConfiguration((e) => { if (e.affectsConfiguration(NotebookSetting.cellFailureDiagnostics)) { this.updateEnabled();

private updateEnabled() { const settingEnabled = this.configurationService.getValue(NotebookSetting.cellFailureDiagnostics); <del> if (this.enabled && (!settingEnabled || Iterable.isEmpty(this.inlineChatService.getAllProvider()))) { </del> <ins> if (this.enabled && (!settingEnabled || Iterable.isEmpty(this.chatAgentService.getAgents()))) { </ins> this.enabled = false; this.clearAll(); <del> } else if (!this.enabled && settingEnabled && !Iterable.isEmpty(this.inlineChatService.getAllProvider())) { </del> <ins> } else if (!this.enabled && settingEnabled && !Iterable.isEmpty(this.chatAgentService.getAgents())) { </ins> this.enabled = true; if (!this.listening) { this.listening = true;

*--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; <del> import { Emitter } from 'vs/base/common/event'; </del> <ins> import { Emitter, Event } from 'vs/base/common/event'; </ins> import { DisposableStore } from 'vs/base/common/lifecycle'; import { ResourceMap } from 'vs/base/common/map'; import { waitForState } from 'vs/base/common/observable';

import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; import { IMarkerData, IMarkerService } from 'vs/platform/markers/common/markers'; <del> import { IInlineChatService, IInlineChatSessionProvider } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; </del> <ins> import { ChatAgentLocation, IChatAgent, IChatAgentData, IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents'; </ins> import { CellDiagnostics } from 'vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib'; import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel'; import { CellKind, NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { ICellExecutionStateChangedEvent, IExecutionStateChangedEvent, INotebookCellExecution, INotebookExecutionStateService, NotebookExecutionType } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService'; import { setupInstantiationService, TestNotebookExecutionStateService, withTestNotebook } from 'vs/workbench/contrib/notebook/test/browser/testNotebookEditor'; <ins> import { nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'; </ins> suite('notebookCellDiagnostics', () => {

testExecutionService = new TestExecutionService(); instantiationService.stub(INotebookExecutionStateService, testExecutionService); <del> const chatProviders = instantiationService.get<IInlineChatService>(IInlineChatService); disposables.add(chatProviders.addProvider({} as IInlineChatSessionProvider)); </del> <ins> const agentData = { extensionId: nullExtensionDescription.identifier, extensionDisplayName: '', extensionPublisherId: '', name: 'testEditorAgent', isDefault: true, locations: [ChatAgentLocation.Editor], metadata: {}, slashCommands: [] }; const chatAgentService = new class extends mock<IChatAgentService>() { override getAgents(): IChatAgentData[] { return [{ id: 'testEditorAgent', ...agentData }]; } override onDidChangeAgents: Event<IChatAgent | undefined> = Event.None; }; instantiationService.stub(IChatAgentService, chatAgentService); </ins> markerService = new class extends mock<ITestMarkerService>() { override markers: ResourceMap<IMarkerData[]> = new ResourceMap();

import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { mainWindow } from 'vs/base/browser/window'; import { TestCodeEditorService } from 'vs/editor/test/browser/editorTestServices'; <del> import { IInlineChatService } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { InlineChatServiceImpl } from 'vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl'; </del> import { INotebookCellOutlineProviderFactory, NotebookCellOutlineProviderFactory } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProviderFactory'; import { ILanguageDetectionService } from 'vs/workbench/services/languageDetection/common/languageDetectionWorkerService';

instantiationService.stub(IKeybindingService, new MockKeybindingService()); instantiationService.stub(INotebookCellStatusBarService, disposables.add(new NotebookCellStatusBarService())); instantiationService.stub(ICodeEditorService, disposables.add(new TestCodeEditorService(testThemeService))); <del> instantiationService.stub(IInlineChatService, instantiationService.createInstance(InlineChatServiceImpl)); </del> instantiationService.stub(INotebookCellOutlineProviderFactory, instantiationService.createInstance(NotebookCellOutlineProviderFactory)); instantiationService.stub(ILanguageDetectionService, new class MockLanguageDetectionService implements ILanguageDetectionService {