@codingame/monaco-vscode-comments-service-override 2.2.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/comments.d.ts +5 -0
- package/comments.js +11 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +24 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js +205 -0
package/comments.d.ts
ADDED
package/comments.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
+
import { ICommentService, CommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
|
|
3
|
+
import './vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js';
|
|
4
|
+
|
|
5
|
+
function getServiceOverride() {
|
|
6
|
+
return {
|
|
7
|
+
[( ICommentService.toString())]: new SyncDescriptor(CommentService, [], true)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { getServiceOverride as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './comments.js';
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './comments.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codingame/monaco-vscode-comments-service-override",
|
|
3
|
+
"version": "2.2.0-next.1",
|
|
4
|
+
"keywords": [],
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "CodinGame",
|
|
7
|
+
"url": "http://www.codingame.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git@github.com:CodinGame/monaco-vscode-api.git"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"private": false,
|
|
16
|
+
"description": "VSCode public API plugged on the monaco editor - comments service-override",
|
|
17
|
+
"main": "index.js",
|
|
18
|
+
"module": "index.js",
|
|
19
|
+
"types": "index.d.ts",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.2.0-next.1",
|
|
22
|
+
"vscode-marked": "npm:marked@=3.0.2"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
4
|
+
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
|
|
5
|
+
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
6
|
+
import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
8
|
+
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
9
|
+
import { NumberBadge, IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
|
|
10
|
+
import { COMMENTS_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsTreeViewer';
|
|
11
|
+
import { CommentThreadState } from 'vscode/vscode/vs/editor/common/languages';
|
|
12
|
+
import { registerAction2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
13
|
+
import { CONTEXT_KEY_HAS_COMMENTS, CONTEXT_KEY_SOME_COMMENTS_EXPANDED } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsView';
|
|
14
|
+
import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
15
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
16
|
+
|
|
17
|
+
registerAction2(class Collapse extends ViewAction {
|
|
18
|
+
constructor() {
|
|
19
|
+
super({
|
|
20
|
+
viewId: COMMENTS_VIEW_ID,
|
|
21
|
+
id: 'comments.collapse',
|
|
22
|
+
title: ( localizeWithPath(
|
|
23
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
24
|
+
'collapseAll',
|
|
25
|
+
"Collapse All"
|
|
26
|
+
)),
|
|
27
|
+
f1: false,
|
|
28
|
+
icon: Codicon.collapseAll,
|
|
29
|
+
menu: {
|
|
30
|
+
id: MenuId.ViewTitle,
|
|
31
|
+
group: 'navigation',
|
|
32
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ContextKeyExpr.equals('view', COMMENTS_VIEW_ID)), CONTEXT_KEY_HAS_COMMENTS)), CONTEXT_KEY_SOME_COMMENTS_EXPANDED)),
|
|
33
|
+
order: 100
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
runInView(_accessor, view) {
|
|
38
|
+
view.collapseAll();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
registerAction2(class Expand extends ViewAction {
|
|
42
|
+
constructor() {
|
|
43
|
+
super({
|
|
44
|
+
viewId: COMMENTS_VIEW_ID,
|
|
45
|
+
id: 'comments.expand',
|
|
46
|
+
title: ( localizeWithPath(
|
|
47
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
48
|
+
'expandAll',
|
|
49
|
+
"Expand All"
|
|
50
|
+
)),
|
|
51
|
+
f1: false,
|
|
52
|
+
icon: Codicon.expandAll,
|
|
53
|
+
menu: {
|
|
54
|
+
id: MenuId.ViewTitle,
|
|
55
|
+
group: 'navigation',
|
|
56
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ContextKeyExpr.equals('view', COMMENTS_VIEW_ID)), CONTEXT_KEY_HAS_COMMENTS)), ContextKeyExpr.not(CONTEXT_KEY_SOME_COMMENTS_EXPANDED.key))),
|
|
57
|
+
order: 100
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
runInView(_accessor, view) {
|
|
62
|
+
view.expandAll();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
( Registry.as(Extensions.Configuration)).registerConfiguration({
|
|
66
|
+
id: 'comments',
|
|
67
|
+
order: 20,
|
|
68
|
+
title: ( localizeWithPath(
|
|
69
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
70
|
+
'commentsConfigurationTitle',
|
|
71
|
+
"Comments"
|
|
72
|
+
)),
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
'comments.openPanel': {
|
|
76
|
+
enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'],
|
|
77
|
+
default: 'openOnSessionStartWithComments',
|
|
78
|
+
description: ( localizeWithPath(
|
|
79
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
80
|
+
'openComments',
|
|
81
|
+
"Controls when the comments panel should open."
|
|
82
|
+
)),
|
|
83
|
+
restricted: false,
|
|
84
|
+
markdownDeprecationMessage: ( localizeWithPath(
|
|
85
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
86
|
+
'comments.openPanel.deprecated',
|
|
87
|
+
"This setting is deprecated in favor of `comments.openView`."
|
|
88
|
+
))
|
|
89
|
+
},
|
|
90
|
+
'comments.openView': {
|
|
91
|
+
enum: ['never', 'file', 'firstFile', 'firstFileUnresolved'],
|
|
92
|
+
enumDescriptions: [( localizeWithPath(
|
|
93
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
94
|
+
'comments.openView.never',
|
|
95
|
+
"The comments view will never be opened."
|
|
96
|
+
)), ( localizeWithPath(
|
|
97
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
98
|
+
'comments.openView.file',
|
|
99
|
+
"The comments view will open when a file with comments is active."
|
|
100
|
+
)), ( localizeWithPath(
|
|
101
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
102
|
+
'comments.openView.firstFile',
|
|
103
|
+
"If the comments view has not been opened yet during this session it will open the first time during a session that a file with comments is active."
|
|
104
|
+
)), ( localizeWithPath(
|
|
105
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
106
|
+
'comments.openView.firstFileUnresolved',
|
|
107
|
+
"If the comments view has not been opened yet during this session and the comment is not resolved, it will open the first time during a session that a file with comments is active."
|
|
108
|
+
))],
|
|
109
|
+
default: 'firstFile',
|
|
110
|
+
description: ( localizeWithPath(
|
|
111
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
112
|
+
'comments.openView',
|
|
113
|
+
"Controls when the comments view should open."
|
|
114
|
+
)),
|
|
115
|
+
restricted: false
|
|
116
|
+
},
|
|
117
|
+
'comments.useRelativeTime': {
|
|
118
|
+
type: 'boolean',
|
|
119
|
+
default: true,
|
|
120
|
+
description: ( localizeWithPath(
|
|
121
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
122
|
+
'useRelativeTime',
|
|
123
|
+
"Determines if relative time will be used in comment timestamps (ex. '1 day ago')."
|
|
124
|
+
))
|
|
125
|
+
},
|
|
126
|
+
'comments.visible': {
|
|
127
|
+
type: 'boolean',
|
|
128
|
+
default: true,
|
|
129
|
+
description: ( localizeWithPath(
|
|
130
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
131
|
+
'comments.visible',
|
|
132
|
+
"Controls the visibility of the comments bar and comment threads in editors that have commenting ranges and comments. Comments are still accessible via the Comments view and will cause commenting to be toggled on in the same way running the command \"Comments: Toggle Editor Commenting\" toggles comments."
|
|
133
|
+
))
|
|
134
|
+
},
|
|
135
|
+
'comments.maxHeight': {
|
|
136
|
+
type: 'boolean',
|
|
137
|
+
default: true,
|
|
138
|
+
description: ( localizeWithPath(
|
|
139
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
140
|
+
'comments.maxHeight',
|
|
141
|
+
"Controls whether the comments widget scrolls or expands."
|
|
142
|
+
))
|
|
143
|
+
},
|
|
144
|
+
'comments.collapseOnResolve': {
|
|
145
|
+
type: 'boolean',
|
|
146
|
+
default: true,
|
|
147
|
+
description: ( localizeWithPath(
|
|
148
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
149
|
+
'collapseOnResolve',
|
|
150
|
+
"Controls whether the comment thread should collapse when the thread is resolved."
|
|
151
|
+
))
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
let UnresolvedCommentsBadge = class UnresolvedCommentsBadge extends Disposable {
|
|
156
|
+
constructor(_commentService, activityService) {
|
|
157
|
+
super();
|
|
158
|
+
this._commentService = _commentService;
|
|
159
|
+
this.activityService = activityService;
|
|
160
|
+
this.activity = this._register(( new MutableDisposable()));
|
|
161
|
+
this.totalUnresolved = 0;
|
|
162
|
+
this._register(this._commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged, this));
|
|
163
|
+
this._register(this._commentService.onDidUpdateCommentThreads(this.onCommentsUpdated, this));
|
|
164
|
+
}
|
|
165
|
+
onAllCommentsChanged(e) {
|
|
166
|
+
let unresolved = 0;
|
|
167
|
+
for (const thread of e.commentThreads) {
|
|
168
|
+
if (thread.state === CommentThreadState.Unresolved) {
|
|
169
|
+
unresolved++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
this.updateBadge(unresolved);
|
|
173
|
+
}
|
|
174
|
+
onCommentsUpdated() {
|
|
175
|
+
let unresolved = 0;
|
|
176
|
+
for (const resource of this._commentService.commentsModel.resourceCommentThreads) {
|
|
177
|
+
for (const thread of resource.commentThreads) {
|
|
178
|
+
if (thread.threadState === CommentThreadState.Unresolved) {
|
|
179
|
+
unresolved++;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
this.updateBadge(unresolved);
|
|
184
|
+
}
|
|
185
|
+
updateBadge(unresolved) {
|
|
186
|
+
if (unresolved === this.totalUnresolved) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this.totalUnresolved = unresolved;
|
|
190
|
+
const message = ( localizeWithPath(
|
|
191
|
+
'vs/workbench/contrib/comments/browser/comments.contribution',
|
|
192
|
+
'totalUnresolvedComments',
|
|
193
|
+
'{0} Unresolved Comments',
|
|
194
|
+
this.totalUnresolved
|
|
195
|
+
));
|
|
196
|
+
this.activity.value = this.activityService.showViewActivity(COMMENTS_VIEW_ID, { badge: ( new NumberBadge(this.totalUnresolved, () => message)) });
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
UnresolvedCommentsBadge = ( __decorate([
|
|
200
|
+
( __param(0, ICommentService)),
|
|
201
|
+
( __param(1, IActivityService))
|
|
202
|
+
], UnresolvedCommentsBadge));
|
|
203
|
+
( Registry.as(Extensions$1.Workbench)).registerWorkbenchContribution(UnresolvedCommentsBadge, 4 );
|
|
204
|
+
|
|
205
|
+
export { UnresolvedCommentsBadge };
|