UNPKG

@codingame/monaco-vscode-extensions-service-override

Version:

VSCode public API plugged on the monaco editor - extensions service-override

184 lines (183 loc) 11.2 kB
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation"; import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI, UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IRange } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range"; import * as languages from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages"; import { ExtensionIdentifier } from "@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions"; import { IExtHostContext } from "../../services/extensions/common/extHostCustomers.js"; import { ICommentController } from "@codingame/monaco-vscode-comments-service-override/vscode/vs/workbench/contrib/comments/browser/commentService"; import { ICommentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/comments/browser/commentService.service"; import { CommentProviderFeatures, ExtHostCommentsShape, MainThreadCommentsShape, CommentThreadChanges } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol"; import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service"; import { MarshalledId } from "@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds"; import { ICellRange } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookRange"; import { IViewsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service"; import { MarshalledCommentThread } from "../../common/comments.js"; import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service"; export declare class MainThreadCommentThread<T> implements languages.CommentThread<T> { commentThreadHandle: number; controllerHandle: number; extensionId: string; threadId: string; resource: string; private _range; private _canReply; private _isTemplate; editorId?: string | undefined; private _input?; get input(): languages.CommentInput | undefined; set input(value: languages.CommentInput | undefined); private readonly _onDidChangeInput; get onDidChangeInput(): Event<languages.CommentInput | undefined>; private _label; get label(): string | undefined; set label(label: string | undefined); private _contextValue; get contextValue(): string | undefined; set contextValue(context: string | undefined); private readonly _onDidChangeLabel; readonly onDidChangeLabel: Event<string | undefined>; private _comments; get comments(): ReadonlyArray<languages.Comment> | undefined; set comments(newComments: ReadonlyArray<languages.Comment> | undefined); private readonly _onDidChangeComments; get onDidChangeComments(): Event<readonly languages.Comment[] | undefined>; set range(range: T | undefined); get range(): T | undefined; private readonly _onDidChangeCanReply; get onDidChangeCanReply(): Event<boolean>; set canReply(state: boolean | languages.CommentAuthorInformation); get canReply(): boolean | languages.CommentAuthorInformation; private _collapsibleState; get collapsibleState(): languages.CommentThreadCollapsibleState | undefined; set collapsibleState(newState: languages.CommentThreadCollapsibleState | undefined); private _initialCollapsibleState; get initialCollapsibleState(): languages.CommentThreadCollapsibleState | undefined; private set initialCollapsibleState(value); private readonly _onDidChangeCollapsibleState; onDidChangeCollapsibleState: Event<languages.CommentThreadCollapsibleState | undefined>; private readonly _onDidChangeInitialCollapsibleState; onDidChangeInitialCollapsibleState: Event<languages.CommentThreadCollapsibleState | undefined>; private _isDisposed; get isDisposed(): boolean; isDocumentCommentThread(): this is languages.CommentThread<IRange>; private _state; get state(): languages.CommentThreadState | undefined; set state(newState: languages.CommentThreadState | undefined); private _applicability; get applicability(): languages.CommentThreadApplicability | undefined; set applicability(value: languages.CommentThreadApplicability | undefined); private readonly _onDidChangeApplicability; readonly onDidChangeApplicability: Event<languages.CommentThreadApplicability | undefined>; get isTemplate(): boolean; private readonly _onDidChangeState; onDidChangeState: Event<languages.CommentThreadState | undefined>; constructor(commentThreadHandle: number, controllerHandle: number, extensionId: string, threadId: string, resource: string, _range: T | undefined, comments: languages.Comment[] | undefined, _canReply: boolean | languages.CommentAuthorInformation, _isTemplate: boolean, editorId?: string | undefined); batchUpdate(changes: CommentThreadChanges<T>): void; hasComments(): boolean; dispose(): void; toJSON(): MarshalledCommentThread; } export declare class MainThreadCommentController extends Disposable implements ICommentController { private readonly _proxy; private readonly _handle; private readonly _uniqueId; private readonly _id; private readonly _label; private _features; private readonly _commentService; private readonly _uriIdentityService; get handle(): number; get id(): string; get contextValue(): string; get proxy(): ExtHostCommentsShape; get label(): string; private _reactions; get reactions(): languages.CommentReaction[] | undefined; set reactions(reactions: languages.CommentReaction[] | undefined); get options(): languages.CommentOptions | undefined; private readonly _threads; activeEditingCommentThread?: MainThreadCommentThread<IRange | ICellRange>; get features(): CommentProviderFeatures; get owner(): string; constructor(_proxy: ExtHostCommentsShape, _handle: number, _uniqueId: string, _id: string, _label: string, _features: CommentProviderFeatures, _commentService: ICommentService, _uriIdentityService: IUriIdentityService); get activeComment(): { thread: languages.CommentThread; comment?: languages.Comment; } | undefined; private _activeComment; setActiveCommentAndThread(commentInfo: { thread: languages.CommentThread; comment?: languages.Comment; } | undefined): Promise<void>; updateFeatures(features: CommentProviderFeatures): void; createCommentThread(extensionId: string, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange | ICellRange | undefined, comments: languages.Comment[], isTemplate: boolean, editorId?: string): languages.CommentThread<IRange | ICellRange>; updateCommentThread(commentThreadHandle: number, threadId: string, resource: UriComponents, changes: CommentThreadChanges): void; deleteCommentThread(commentThreadHandle: number): void; deleteCommentThreadMain(commentThreadId: string): void; updateInput(input: string): void; updateCommentingRanges(resourceHints?: languages.CommentingRangeResourceHint): void; private getKnownThread; getDocumentComments(resource: URI, token: CancellationToken): Promise<{ uniqueOwner: string; label: string; threads: languages.CommentThread<IRange>[]; commentingRanges: { resource: URI; ranges: IRange[]; fileComments: boolean; }; }>; getNotebookComments(resource: URI, token: CancellationToken): Promise<{ uniqueOwner: string; label: string; threads: languages.CommentThread<ICellRange>[]; }>; toggleReaction(uri: URI, thread: languages.CommentThread, comment: languages.Comment, reaction: languages.CommentReaction, token: CancellationToken): Promise<void>; getAllComments(): MainThreadCommentThread<IRange | ICellRange>[]; createCommentThreadTemplate(resource: UriComponents, range: IRange | undefined, editorId?: string): Promise<void>; updateCommentThreadTemplate(threadHandle: number, range: IRange): Promise<void>; toJSON(): { $mid: MarshalledId; handle: number; }; } export declare class MainThreadComments extends Disposable implements MainThreadCommentsShape { private readonly _commentService; private readonly _viewsService; private readonly _viewDescriptorService; private readonly _uriIdentityService; private readonly _editorService; private readonly _instantiationService; private readonly _proxy; private _handlers; private _commentControllers; private _activeEditingCommentThread?; private readonly _activeEditingCommentThreadDisposables; private readonly _openViewListener; private readonly _onChangeContainerListener; private readonly _onChangeContainerLocationListener; constructor(extHostContext: IExtHostContext, _commentService: ICommentService, _viewsService: IViewsService, _viewDescriptorService: IViewDescriptorService, _uriIdentityService: IUriIdentityService, _editorService: IEditorService, _instantiationService: IInstantiationService); $registerCommentController(handle: number, id: string, label: string, extensionId: string): void; $unregisterCommentController(handle: number): void; $updateCommentControllerFeatures(handle: number, features: CommentProviderFeatures): void; $createCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange | ICellRange | undefined, comments: languages.Comment[], extensionId: ExtensionIdentifier, isTemplate: boolean, editorId?: string): languages.CommentThread<IRange | ICellRange> | undefined; $updateCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, changes: CommentThreadChanges): void; $deleteCommentThread(handle: number, commentThreadHandle: number): void; $updateCommentingRanges(handle: number, resourceHints?: languages.CommentingRangeResourceHint): void; $revealCommentThread(handle: number, commentThreadHandle: number, commentUniqueIdInThread: number, options: languages.CommentThreadRevealOptions): Promise<void>; $hideCommentThread(handle: number, commentThreadHandle: number): Promise<void>; private registerView; private setComments; private registerViewOpenedListener; /** * If the comments view has never been opened, the constructor for it has not yet run so it has * no listeners for comment threads being set or updated. Listen for the view opening for the * first time and send it comments then. */ private registerViewListeners; private getHandler; }