forked from microsoft/vscode-pull-request-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache.ts
More file actions
28 lines (22 loc) · 1023 Bytes
/
Copy pathcache.ts
File metadata and controls
28 lines (22 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { vscode } from './message';
import { PullRequest } from '../../src/github/views';
export function getState(): PullRequest {
return vscode.getState();
}
export function setState(pullRequest: PullRequest | undefined): void {
const oldPullRequest = getState();
if (oldPullRequest && oldPullRequest.number && oldPullRequest.number === pullRequest?.number) {
pullRequest.pendingCommentText = oldPullRequest.pendingCommentText;
}
if (pullRequest) {
vscode.setState(pullRequest);
}
}
export function updateState(data: Partial<PullRequest> | undefined): void {
const pullRequest = vscode.getState();
vscode.setState(Object.assign(pullRequest, data));
}