Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e877e5c8
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,发现更多精彩内容 >>
提交
e877e5c8
编写于
11月 29, 2018
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
comment thread can be updated by draft mode change.
上级
9da787b9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
8 deletion
+39
-8
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+5
-0
src/vs/workbench/api/node/extHostComments.ts
src/vs/workbench/api/node/extHostComments.ts
+3
-2
src/vs/workbench/parts/comments/electron-browser/commentNode.ts
.../workbench/parts/comments/electron-browser/commentNode.ts
+10
-2
src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts
...ch/parts/comments/electron-browser/commentThreadWidget.ts
+16
-2
src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts
...s/comments/electron-browser/commentsEditorContribution.ts
+5
-2
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
e877e5c8
...
...
@@ -1223,6 +1223,11 @@ export interface CommentThreadChangedEvent {
* Changed comment threads.
*/
readonly
changed
:
CommentThread
[];
/**
* changed draft mode.
*/
readonly
draftMode
:
DraftMode
;
}
/**
...
...
src/vs/workbench/api/node/extHostComments.ts
浏览文件 @
e877e5c8
...
...
@@ -180,7 +180,8 @@ export class ExtHostComments implements ExtHostCommentsShape {
this
.
_proxy
.
$onDidCommentThreadsChange
(
handle
,
{
changed
:
event
.
changed
.
map
(
thread
=>
convertToCommentThread
(
provider
,
thread
,
this
.
_commandsConverter
)),
added
:
event
.
added
.
map
(
thread
=>
convertToCommentThread
(
provider
,
thread
,
this
.
_commandsConverter
)),
removed
:
event
.
removed
.
map
(
thread
=>
convertToCommentThread
(
provider
,
thread
,
this
.
_commandsConverter
))
removed
:
event
.
removed
.
map
(
thread
=>
convertToCommentThread
(
provider
,
thread
,
this
.
_commandsConverter
)),
draftMode
:
!!
(
provider
as
vscode
.
DocumentCommentProvider
).
startDraft
&&
!!
(
provider
as
vscode
.
DocumentCommentProvider
).
finishDraft
?
(
event
.
inDraftMode
?
modes
.
DraftMode
.
InDraft
:
modes
.
DraftMode
.
NotInDraft
)
:
modes
.
DraftMode
.
NotSupported
});
});
}
...
...
@@ -190,7 +191,7 @@ function convertCommentInfo(owner: number, provider: vscode.DocumentCommentProvi
return
{
threads
:
vscodeCommentInfo
.
threads
.
map
(
x
=>
convertToCommentThread
(
provider
,
x
,
commandsConverter
)),
commentingRanges
:
vscodeCommentInfo
.
commentingRanges
?
vscodeCommentInfo
.
commentingRanges
.
map
(
range
=>
extHostTypeConverter
.
Range
.
from
(
range
))
:
[],
draftMode
:
provider
.
startDraft
?
(
vscodeCommentInfo
.
inDraftMode
?
modes
.
DraftMode
.
InDraft
:
modes
.
DraftMode
.
NotInDraft
)
:
modes
.
DraftMode
.
NotSupported
draftMode
:
provider
.
startDraft
&&
provider
.
finishDraft
?
(
vscodeCommentInfo
.
inDraftMode
?
modes
.
DraftMode
.
InDraft
:
modes
.
DraftMode
.
NotInDraft
)
:
modes
.
DraftMode
.
NotSupported
};
}
...
...
src/vs/workbench/parts/comments/electron-browser/commentNode.ts
浏览文件 @
e877e5c8
...
...
@@ -46,6 +46,7 @@ export class CommentNode extends Disposable {
private
_commentEditorModel
:
ITextModel
;
private
_updateCommentButton
:
Button
;
private
_errorEditingContainer
:
HTMLElement
;
private
_isPendingLabel
:
HTMLElement
;
private
_deleteAction
:
Action
;
private
_onDidDelete
=
new
Emitter
<
CommentNode
>
();
...
...
@@ -99,9 +100,10 @@ export class CommentNode extends Disposable {
const
author
=
dom
.
append
(
header
,
dom
.
$
(
'
strong.author
'
));
author
.
innerText
=
this
.
comment
.
userName
;
this
.
_isPendingLabel
=
dom
.
append
(
header
,
dom
.
$
(
'
span.isPending
'
));
if
(
this
.
comment
.
isDraft
)
{
const
isPendingLabel
=
dom
.
append
(
header
,
dom
.
$
(
'
span.isPending
'
));
isPendingLabel
.
innerText
=
'
Pending
'
;
this
.
_isPendingLabel
.
innerText
=
'
Pending
'
;
}
const
actions
:
Action
[]
=
[];
...
...
@@ -281,6 +283,12 @@ export class CommentNode extends Disposable {
this
.
_body
.
appendChild
(
this
.
_md
);
}
if
(
newComment
.
isDraft
)
{
this
.
_isPendingLabel
.
innerText
=
'
Pending
'
;
}
else
{
this
.
_isPendingLabel
.
innerText
=
''
;
}
this
.
comment
=
newComment
;
}
...
...
src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts
浏览文件 @
e877e5c8
...
...
@@ -71,6 +71,7 @@ export class ReviewZoneWidget extends ZoneWidget {
private
_globalToDispose
:
IDisposable
[];
private
_markdownRenderer
:
MarkdownRenderer
;
private
_styleElement
:
HTMLStyleElement
;
private
_formActions
:
HTMLElement
;
private
_error
:
HTMLElement
;
public
get
owner
():
string
{
...
...
@@ -105,6 +106,7 @@ export class ReviewZoneWidget extends ZoneWidget {
this
.
_isCollapsed
=
commentThread
.
collapsibleState
!==
modes
.
CommentThreadCollapsibleState
.
Expanded
;
this
.
_globalToDispose
=
[];
this
.
_localToDispose
=
[];
this
.
_formActions
=
null
;
this
.
create
();
this
.
_styleElement
=
dom
.
createStyleSheet
(
this
.
domNode
);
...
...
@@ -262,6 +264,16 @@ export class ReviewZoneWidget extends ZoneWidget {
this
.
createThreadLabel
();
}
updateDraftMode
(
draftMode
:
modes
.
DraftMode
)
{
this
.
_draftMode
=
draftMode
;
if
(
this
.
_formActions
)
{
let
model
=
this
.
_commentEditor
.
getModel
();
dom
.
clearNode
(
this
.
_formActions
);
this
.
createCommentWidgetActions
(
this
.
_formActions
,
model
);
}
}
protected
_doLayout
(
heightInPixel
:
number
,
widthInPixel
:
number
):
void
{
this
.
_commentEditor
.
layout
({
height
:
(
this
.
_commentEditor
.
hasWidgetFocus
()
?
5
:
1
)
*
18
,
width
:
widthInPixel
-
54
/* margin 20px * 10 + scrollbar 14px*/
});
}
...
...
@@ -332,8 +344,8 @@ export class ReviewZoneWidget extends ZoneWidget {
this
.
_error
=
dom
.
append
(
this
.
_commentForm
,
dom
.
$
(
'
.validation-error.hidden
'
));
const
formActions
=
dom
.
append
(
this
.
_commentForm
,
dom
.
$
(
'
.form-actions
'
));
this
.
createCommentWidgetActions
(
formActions
,
model
);
this
.
_
formActions
=
dom
.
append
(
this
.
_commentForm
,
dom
.
$
(
'
.form-actions
'
));
this
.
createCommentWidgetActions
(
this
.
_
formActions
,
model
);
this
.
_resizeObserver
=
new
MutationObserver
(
this
.
_refresh
.
bind
(
this
));
...
...
@@ -401,6 +413,8 @@ export class ReviewZoneWidget extends ZoneWidget {
submitdraftButton
.
enabled
=
true
;
submitdraftButton
.
onDidClick
(
async
()
=>
{
let
lineNumber
=
this
.
_commentGlyph
.
getPosition
().
position
.
lineNumber
;
await
this
.
createComment
(
lineNumber
);
await
this
.
commentService
.
finishDraft
(
this
.
_owner
);
});
...
...
src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts
浏览文件 @
e877e5c8
...
...
@@ -380,11 +380,13 @@ export class ReviewController implements IEditorContribution {
return
;
}
let
draftMode
=
commentInfo
[
0
].
draftMode
;
let
added
=
e
.
added
.
filter
(
thread
=>
thread
.
resource
.
toString
()
===
editorURI
.
toString
());
let
removed
=
e
.
removed
.
filter
(
thread
=>
thread
.
resource
.
toString
()
===
editorURI
.
toString
());
let
changed
=
e
.
changed
.
filter
(
thread
=>
thread
.
resource
.
toString
()
===
editorURI
.
toString
());
let
draftMode
=
e
.
draftMode
;
commentInfo
.
forEach
(
info
=>
info
.
draftMode
=
draftMode
);
this
.
_commentWidgets
.
filter
(
ZoneWidget
=>
ZoneWidget
.
owner
===
e
.
owner
).
forEach
(
widget
=>
widget
.
updateDraftMode
(
draftMode
));
removed
.
forEach
(
thread
=>
{
let
matchedZones
=
this
.
_commentWidgets
.
filter
(
zoneWidget
=>
zoneWidget
.
owner
===
e
.
owner
&&
zoneWidget
.
commentThread
.
threadId
===
thread
.
threadId
);
...
...
@@ -408,6 +410,7 @@ export class ReviewController implements IEditorContribution {
this
.
_commentWidgets
.
push
(
zoneWidget
);
this
.
_commentInfos
.
filter
(
info
=>
info
.
owner
===
e
.
owner
)[
0
].
threads
.
push
(
thread
);
});
}));
this
.
beginCompute
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录