Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for editing and deleting document comments #58078

Closed
RMacfarlane opened this issue Sep 6, 2018 · 0 comments
Closed

API for editing and deleting document comments #58078

RMacfarlane opened this issue Sep 6, 2018 · 0 comments
Assignees
Labels
api api-proposal feature-request Request for new features or functionality on-testplan

Comments

@RMacfarlane
Copy link
Contributor

RMacfarlane commented Sep 6, 2018

Extensions should be able to handle edits and deletes to comments within the editor. The DocumentCommentProvider can be extended to add these new methods, mimicking the other methods on the provider.

	interface DocumentCommentProvider {
		provideDocumentComments(document: TextDocument, token: CancellationToken): Promise<CommentInfo>;
		createNewCommentThread(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
		replyToCommentThread(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;

		/**
		 * Called when a user edits the comment body to the be new text text.
		 */
		editComment?(document: TextDocument, comment: Comment, text: string, token: CancellationToken): Promise<Comment>;

		/**
		 * Called when a user deletes the comment.
		 */
		deleteComment?(document: TextDocument, comment: Comment, token: CancellationToken): Promise<void>;

		onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
	}

Additionally, comments themselves need a flag indicating whether or not they can be edited or deleted.

	interface Comment {
		<existing properties>
		/**
		 * Whether the current user has permission to edit the comment.
		 *
		 * This will be treated as false if the comment is provided by a `WorkspaceCommentProvider`, or
		 * if it is provided by a `DocumentCommentProvider` and  no `editComment` method is given.
		 */
		canEdit?: boolean;

		/**
		 * Whether the current user has permission to delete the comment.
		 *
		 * This will be treated as false if the comment is provided by a `WorkspaceCommentProvider`, or
		 * if it is provided by a `DocumentCommentProvider` and  no `deleteComment` method is given.
		 */
		canDelete?: boolean;

	}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api-proposal feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests

1 participant