Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
02842368
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
02842368
编写于
5月 31, 2019
作者:
R
Rachel Macfarlane
提交者:
GitHub
5月 31, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #74668, old comment API not adding comments
上级
d89187ed
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
0 deletion
+49
-0
src/vs/workbench/api/browser/mainThreadComments.ts
src/vs/workbench/api/browser/mainThreadComments.ts
+23
-0
src/vs/workbench/browser/web.simpleservices.ts
src/vs/workbench/browser/web.simpleservices.ts
+2
-0
src/vs/workbench/contrib/comments/browser/commentNode.ts
src/vs/workbench/contrib/comments/browser/commentNode.ts
+5
-0
src/vs/workbench/contrib/comments/browser/commentService.ts
src/vs/workbench/contrib/comments/browser/commentService.ts
+9
-0
src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts
...workbench/contrib/comments/browser/commentThreadWidget.ts
+10
-0
未找到文件。
src/vs/workbench/api/browser/mainThreadComments.ts
浏览文件 @
02842368
...
...
@@ -469,6 +469,9 @@ export class MainThreadComments extends Disposable implements MainThreadComments
private
_handlers
=
new
Map
<
number
,
string
>
();
private
_commentControllers
=
new
Map
<
number
,
MainThreadCommentController
>
();
private
_activeCommentThread
?:
MainThreadCommentThread
;
private
_input
?:
modes
.
CommentInput
;
private
_openPanelListener
:
IDisposable
|
null
;
constructor
(
...
...
@@ -483,6 +486,26 @@ export class MainThreadComments extends Disposable implements MainThreadComments
this
.
_disposables
=
[];
this
.
_activeCommentThreadDisposables
=
[];
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostComments
);
this
.
_disposables
.
push
(
this
.
_commentService
.
onDidChangeActiveCommentThread
(
async
thread
=>
{
let
handle
=
(
thread
as
MainThreadCommentThread
).
controllerHandle
;
let
controller
=
this
.
_commentControllers
.
get
(
handle
);
if
(
!
controller
)
{
return
;
}
this
.
_activeCommentThreadDisposables
=
dispose
(
this
.
_activeCommentThreadDisposables
);
this
.
_activeCommentThread
=
thread
as
MainThreadCommentThread
;
controller
.
activeCommentThread
=
this
.
_activeCommentThread
;
this
.
_activeCommentThreadDisposables
.
push
(
this
.
_activeCommentThread
.
onDidChangeInput
(
input
=>
{
// todo, dispose
this
.
_input
=
input
;
this
.
_proxy
.
$onCommentWidgetInputChange
(
handle
,
URI
.
parse
(
this
.
_activeCommentThread
!
.
resource
),
this
.
_activeCommentThread
!
.
range
,
this
.
_input
?
this
.
_input
.
value
:
undefined
);
}));
await
this
.
_proxy
.
$onCommentWidgetInputChange
(
controller
.
handle
,
URI
.
parse
(
this
.
_activeCommentThread
!
.
resource
),
this
.
_activeCommentThread
.
range
,
this
.
_input
?
this
.
_input
.
value
:
undefined
);
}));
}
$registerCommentController
(
handle
:
number
,
id
:
string
,
label
:
string
):
void
{
...
...
src/vs/workbench/browser/web.simpleservices.ts
浏览文件 @
02842368
...
...
@@ -619,6 +619,7 @@ export class SimpleCommentService implements ICommentService {
onDidSetAllCommentThreads
:
Event
<
IWorkspaceCommentThreadsEvent
>
=
Event
.
None
;
onDidUpdateCommentThreads
:
Event
<
ICommentThreadChangedEvent
>
=
Event
.
None
;
onDidChangeActiveCommentingRange
:
Event
<
{
range
:
Range
;
commentingRangesInfo
:
CommentingRanges
;
}
>
=
Event
.
None
;
onDidChangeActiveCommentThread
:
Event
<
any
>
=
Event
.
None
;
onDidSetDataProvider
:
Event
<
void
>
=
Event
.
None
;
onDidDeleteDataProvider
:
Event
<
string
>
=
Event
.
None
;
setDocumentComments
:
any
;
...
...
@@ -649,6 +650,7 @@ export class SimpleCommentService implements ICommentService {
deleteReaction
:
any
;
getReactionGroup
:
any
;
toggleReaction
:
any
;
setActiveCommentThread
:
any
;
}
registerSingleton
(
ICommentService
,
SimpleCommentService
,
true
);
//#endregion
...
...
src/vs/workbench/contrib/comments/browser/commentNode.ts
浏览文件 @
02842368
...
...
@@ -424,12 +424,14 @@ export class CommentNode extends Disposable {
uri
:
this
.
_commentEditor
.
getModel
()
!
.
uri
,
value
:
this
.
comment
.
body
.
value
};
this
.
commentService
.
setActiveCommentThread
(
commentThread
);
this
.
_commentEditorDisposables
.
push
(
this
.
_commentEditor
.
onDidFocusEditorWidget
(()
=>
{
commentThread
.
input
=
{
uri
:
this
.
_commentEditor
!
.
getModel
()
!
.
uri
,
value
:
this
.
comment
.
body
.
value
};
this
.
commentService
.
setActiveCommentThread
(
commentThread
);
}));
this
.
_commentEditorDisposables
.
push
(
this
.
_commentEditor
.
onDidChangeModelContent
(
e
=>
{
...
...
@@ -439,6 +441,7 @@ export class CommentNode extends Disposable {
let
input
=
commentThread
.
input
;
input
.
value
=
newVal
;
commentThread
.
input
=
input
;
this
.
commentService
.
setActiveCommentThread
(
commentThread
);
}
}
}));
...
...
@@ -486,6 +489,7 @@ export class CommentNode extends Disposable {
uri
:
this
.
_commentEditor
.
getModel
()
!
.
uri
,
value
:
newBody
};
this
.
commentService
.
setActiveCommentThread
(
commentThread
);
let
commandId
=
this
.
comment
.
editCommand
.
id
;
let
args
=
this
.
comment
.
editCommand
.
arguments
||
[];
...
...
@@ -523,6 +527,7 @@ export class CommentNode extends Disposable {
if
(
result
.
confirmed
)
{
try
{
if
(
this
.
comment
.
deleteCommand
)
{
this
.
commentService
.
setActiveCommentThread
(
this
.
commentThread
);
let
commandId
=
this
.
comment
.
deleteCommand
.
id
;
let
args
=
this
.
comment
.
deleteCommand
.
arguments
||
[];
...
...
src/vs/workbench/contrib/comments/browser/commentService.ts
浏览文件 @
02842368
...
...
@@ -38,6 +38,7 @@ export interface ICommentService {
readonly
onDidSetResourceCommentInfos
:
Event
<
IResourceCommentThreadEvent
>
;
readonly
onDidSetAllCommentThreads
:
Event
<
IWorkspaceCommentThreadsEvent
>
;
readonly
onDidUpdateCommentThreads
:
Event
<
ICommentThreadChangedEvent
>
;
readonly
onDidChangeActiveCommentThread
:
Event
<
CommentThread
|
null
>
;
readonly
onDidChangeActiveCommentingRange
:
Event
<
{
range
:
Range
,
commentingRangesInfo
:
CommentingRanges
}
>
;
readonly
onDidSetDataProvider
:
Event
<
void
>
;
readonly
onDidDeleteDataProvider
:
Event
<
string
>
;
...
...
@@ -69,6 +70,7 @@ export interface ICommentService {
deleteReaction
(
owner
:
string
,
resource
:
URI
,
comment
:
Comment
,
reaction
:
CommentReaction
):
Promise
<
void
>
;
getReactionGroup
(
owner
:
string
):
CommentReaction
[]
|
undefined
;
toggleReaction
(
owner
:
string
,
resource
:
URI
,
thread
:
CommentThread2
,
comment
:
Comment
,
reaction
:
CommentReaction
):
Promise
<
void
>
;
setActiveCommentThread
(
commentThread
:
CommentThread
|
null
):
void
;
}
export
class
CommentService
extends
Disposable
implements
ICommentService
{
...
...
@@ -89,6 +91,9 @@ export class CommentService extends Disposable implements ICommentService {
private
readonly
_onDidUpdateCommentThreads
:
Emitter
<
ICommentThreadChangedEvent
>
=
this
.
_register
(
new
Emitter
<
ICommentThreadChangedEvent
>
());
readonly
onDidUpdateCommentThreads
:
Event
<
ICommentThreadChangedEvent
>
=
this
.
_onDidUpdateCommentThreads
.
event
;
private
readonly
_onDidChangeActiveCommentThread
=
this
.
_register
(
new
Emitter
<
CommentThread
|
null
>
());
readonly
onDidChangeActiveCommentThread
=
this
.
_onDidChangeActiveCommentThread
.
event
;
private
readonly
_onDidChangeActiveCommentingRange
:
Emitter
<
{
range
:
Range
,
commentingRangesInfo
:
CommentingRanges
...
...
@@ -109,6 +114,10 @@ export class CommentService extends Disposable implements ICommentService {
super
();
}
setActiveCommentThread
(
commentThread
:
CommentThread
|
null
)
{
this
.
_onDidChangeActiveCommentThread
.
fire
(
commentThread
);
}
setDocumentComments
(
resource
:
URI
,
commentInfos
:
ICommentInfo
[]):
void
{
this
.
_onDidSetResourceCommentInfos
.
fire
({
resource
,
commentInfos
});
}
...
...
src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts
浏览文件 @
02842368
...
...
@@ -211,6 +211,10 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this
.
_bodyElement
=
<
HTMLDivElement
>
dom
.
$
(
'
.body
'
);
container
.
appendChild
(
this
.
_bodyElement
);
dom
.
addDisposableListener
(
this
.
_bodyElement
,
dom
.
EventType
.
FOCUS_IN
,
e
=>
{
this
.
commentService
.
setActiveCommentThread
(
this
.
_commentThread
);
});
}
protected
_fillHead
(
container
:
HTMLElement
):
void
{
...
...
@@ -265,6 +269,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
}
else
{
const
deleteCommand
=
(
this
.
_commentThread
as
modes
.
CommentThread2
).
deleteCommand
;
if
(
deleteCommand
)
{
this
.
commentService
.
setActiveCommentThread
(
this
.
_commentThread
);
return
this
.
commandService
.
executeCommand
(
deleteCommand
.
id
,
...(
deleteCommand
.
arguments
||
[]));
}
else
if
(
this
.
_commentEditor
.
getValue
()
===
''
)
{
this
.
commentService
.
disposeCommentThread
(
this
.
_owner
,
this
.
_commentThread
.
threadId
!
);
...
...
@@ -516,6 +521,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
uri
:
this
.
_commentEditor
.
getModel
()
!
.
uri
,
value
:
this
.
_commentEditor
.
getValue
()
};
this
.
commentService
.
setActiveCommentThread
(
this
.
_commentThread
);
}));
this
.
_commentThreadDisposables
.
push
(
this
.
_commentEditor
.
getModel
()
!
.
onDidChangeContent
(()
=>
{
...
...
@@ -526,6 +532,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
newInput
.
value
=
modelContent
;
thread
.
input
=
newInput
;
}
this
.
commentService
.
setActiveCommentThread
(
this
.
_commentThread
);
}));
this
.
_commentThreadDisposables
.
push
((
this
.
_commentThread
as
modes
.
CommentThread2
).
onDidChangeInput
(
input
=>
{
...
...
@@ -727,6 +734,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
uri
:
this
.
_commentEditor
.
getModel
()
!
.
uri
,
value
:
this
.
_commentEditor
.
getValue
()
};
this
.
commentService
.
setActiveCommentThread
(
this
.
_commentThread
);
await
this
.
commandService
.
executeCommand
(
acceptInputCommand
.
id
,
...(
acceptInputCommand
.
arguments
||
[]));
}));
...
...
@@ -751,6 +759,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
uri
:
this
.
_commentEditor
.
getModel
()
!
.
uri
,
value
:
this
.
_commentEditor
.
getValue
()
};
this
.
commentService
.
setActiveCommentThread
(
this
.
_commentThread
);
await
this
.
commandService
.
executeCommand
(
command
.
id
,
...(
command
.
arguments
||
[]));
}));
});
...
...
@@ -821,6 +830,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
uri
:
this
.
_commentEditor
.
getModel
()
!
.
uri
,
value
:
this
.
_commentEditor
.
getValue
()
};
this
.
commentService
.
setActiveCommentThread
(
this
.
_commentThread
);
let
commandId
=
commentThread
.
acceptInputCommand
.
id
;
let
args
=
commentThread
.
acceptInputCommand
.
arguments
||
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录