Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/chat/browser/codeBlockPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import { getSimpleEditorOptions } from 'vs/workbench/contrib/codeEditor/browser/
import { IMarkdownVulnerability } from '../common/annotations';
import { ResourceLabel } from 'vs/workbench/browser/labels';
import { FileKind } from 'vs/platform/files/common/files';
import { ResourceContextKey } from 'vs/workbench/common/contextkeys';

const $ = dom.$;

Expand Down Expand Up @@ -146,6 +147,8 @@ export class CodeBlockPart extends Disposable {
private readonly disposableStore = this._register(new DisposableStore());
private isDisposed = false;

private resourceContextKey: ResourceContextKey;

constructor(
private readonly options: ChatEditorOptions,
readonly menuId: MenuId,
Expand All @@ -160,6 +163,7 @@ export class CodeBlockPart extends Disposable {
super();
this.element = $('.interactive-result-code-block');

this.resourceContextKey = this._register(instantiationService.createInstance(ResourceContextKey));
this.contextKeyService = this._register(contextKeyService.createScoped(this.element));
const scopedInstantiationService = this._register(instantiationService.createChild(new ServiceCollection([IContextKeyService, this.contextKeyService])));
const editorElement = dom.append(this.element, $('.interactive-result-editor'));
Expand Down Expand Up @@ -413,6 +417,7 @@ export class CodeBlockPart extends Disposable {
element: data.element,
languageId: textModel.getLanguageId()
} satisfies ICodeBlockActionContext;
this.resourceContextKey.set(textModel.uri);
}

private getVulnerabilitiesLabel(): string {
Expand Down