Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
de81ccf0
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,发现更多精彩内容 >>
提交
de81ccf0
编写于
3月 27, 2019
作者:
R
Rachel Macfarlane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #71155, pressing escape while comment is focused should hide it
上级
5c0fc719
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
43 deletion
+29
-43
src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts
...workbench/contrib/comments/browser/commentThreadWidget.ts
+20
-16
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
...ch/contrib/comments/browser/commentsEditorContribution.ts
+8
-27
src/vs/workbench/contrib/comments/common/commentThreadWidget.ts
.../workbench/contrib/comments/common/commentThreadWidget.ts
+1
-0
未找到文件。
src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts
浏览文件 @
de81ccf0
...
...
@@ -199,25 +199,27 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this
.
_actionbarWidget
=
new
ActionBar
(
actionsContainer
,
{});
this
.
_disposables
.
push
(
this
.
_actionbarWidget
);
this
.
_collapseAction
=
new
Action
(
'
review.expand
'
,
nls
.
localize
(
'
label.collapse
'
,
"
Collapse
"
),
COLLAPSE_ACTION_CLASS
,
true
,
()
=>
{
if
(
this
.
_commentThread
.
comments
.
length
===
0
)
{
if
((
this
.
_commentThread
as
modes
.
CommentThread2
).
commentThreadHandle
===
undefined
)
{
this
.
dispose
();
return
Promise
.
resolve
();
}
else
{
const
deleteCommand
=
(
this
.
_commentThread
as
modes
.
CommentThread2
).
deleteCommand
;
if
(
deleteCommand
)
{
return
this
.
commandService
.
executeCommand
(
deleteCommand
.
id
,
...(
deleteCommand
.
arguments
||
[]));
}
this
.
_collapseAction
=
new
Action
(
'
review.expand
'
,
nls
.
localize
(
'
label.collapse
'
,
"
Collapse
"
),
COLLAPSE_ACTION_CLASS
,
true
,
()
=>
this
.
collapse
());
this
.
_actionbarWidget
.
push
(
this
.
_collapseAction
,
{
label
:
false
,
icon
:
true
});
}
public
collapse
():
Promise
<
void
>
{
if
(
this
.
_commentThread
.
comments
.
length
===
0
)
{
if
((
this
.
_commentThread
as
modes
.
CommentThread2
).
commentThreadHandle
===
undefined
)
{
this
.
dispose
();
return
Promise
.
resolve
();
}
else
{
const
deleteCommand
=
(
this
.
_commentThread
as
modes
.
CommentThread2
).
deleteCommand
;
if
(
deleteCommand
)
{
return
this
.
commandService
.
executeCommand
(
deleteCommand
.
id
,
...(
deleteCommand
.
arguments
||
[]));
}
}
}
this
.
_isCollapsed
=
true
;
this
.
hide
();
return
Promise
.
resolve
();
});
this
.
_actionbarWidget
.
push
(
this
.
_collapseAction
,
{
label
:
false
,
icon
:
true
});
this
.
_isCollapsed
=
true
;
this
.
hide
();
return
Promise
.
resolve
();
}
public
getGlyphPosition
():
number
{
...
...
@@ -1001,6 +1003,8 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
hide
()
{
this
.
_isCollapsed
=
true
;
// Focus the container so that the comment editor will be blurred before it is hidden
this
.
editor
.
focus
();
super
.
hide
();
}
...
...
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
浏览文件 @
de81ccf0
...
...
@@ -16,7 +16,6 @@ import { IEditorContribution, IModelChangedEvent } from 'vs/editor/common/editor
import
{
IRange
,
Range
}
from
'
vs/editor/common/core/range
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
peekViewResultsBackground
,
peekViewResultsSelectionBackground
,
peekViewTitleBackground
}
from
'
vs/editor/contrib/referenceSearch/referencesWidget
'
;
import
{
IContextKey
,
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
KeybindingsRegistry
,
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
editorForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
...
...
@@ -36,8 +35,6 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import
{
ctxCommentEditorFocused
,
SimpleCommentEditor
}
from
'
vs/workbench/contrib/comments/browser/simpleCommentEditor
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
export
const
ctxCommentThreadVisible
=
new
RawContextKey
<
boolean
>
(
'
commentThreadVisible
'
,
false
);
export
const
ID
=
'
editor.contrib.review
'
;
export
class
ReviewViewZone
implements
IViewZone
{
...
...
@@ -161,7 +158,6 @@ export class ReviewController implements IEditorContribution {
private
editor
:
ICodeEditor
;
private
_newCommentWidget
?:
ReviewZoneWidget
;
private
_commentWidgets
:
ReviewZoneWidget
[];
private
_commentThreadVisible
:
IContextKey
<
boolean
>
;
private
_commentInfos
:
ICommentInfo
[];
private
_commentingRangeDecorator
:
CommentingRangeDecorator
;
private
mouseDownInfo
:
{
lineNumber
:
number
}
|
null
=
null
;
...
...
@@ -176,7 +172,6 @@ export class ReviewController implements IEditorContribution {
constructor
(
editor
:
ICodeEditor
,
@
IContextKeyService
readonly
contextKeyService
:
IContextKeyService
,
@
ICommentService
private
readonly
commentService
:
ICommentService
,
@
ICommandService
private
readonly
_commandService
:
ICommandService
,
@
INotificationService
private
readonly
notificationService
:
INotificationService
,
...
...
@@ -193,7 +188,6 @@ export class ReviewController implements IEditorContribution {
this
.
_pendingNewCommentCache
=
{};
this
.
_computePromise
=
null
;
this
.
_commentThreadVisible
=
ctxCommentThreadVisible
.
bindTo
(
contextKeyService
);
this
.
_commentingRangeDecorator
=
new
CommentingRangeDecorator
();
this
.
globalToDispose
.
push
(
this
.
commentService
.
onDidDeleteDataProvider
(
ownerId
=>
{
...
...
@@ -458,7 +452,6 @@ export class ReviewController implements IEditorContribution {
}
// add new comment
this
.
_commentThreadVisible
.
set
(
true
);
this
.
_newCommentWidget
=
this
.
instantiationService
.
createInstance
(
ReviewZoneWidget
,
this
.
editor
,
ownerId
,
{
extensionId
:
extensionId
,
threadId
:
null
,
...
...
@@ -687,8 +680,6 @@ export class ReviewController implements IEditorContribution {
}
public
closeWidget
():
void
{
this
.
_commentThreadVisible
.
reset
();
if
(
this
.
_newCommentWidget
)
{
this
.
_newCommentWidget
.
dispose
();
this
.
_newCommentWidget
=
undefined
;
...
...
@@ -783,12 +774,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
closeReviewPanel
'
,
id
:
'
workbench.action.hideComment
'
,
weight
:
KeybindingWeight
.
EditorContrib
,
primary
:
KeyCode
.
Escape
,
secondary
:
[
KeyMod
.
Shift
|
KeyCode
.
Escape
],
when
:
ctxCommentThreadVisible
,
handler
:
closeReviewPanel
when
:
ctxCommentEditorFocused
,
handler
:
(
accessor
,
args
)
=>
{
const
activeCodeEditor
=
accessor
.
get
(
ICodeEditorService
).
getFocusedCodeEditor
();
if
(
activeCodeEditor
instanceof
SimpleCommentEditor
)
{
activeCodeEditor
.
getParentThread
().
collapse
();
}
}
});
export
function
getActiveEditor
(
accessor
:
ServicesAccessor
):
IActiveCodeEditor
|
null
{
...
...
@@ -809,21 +805,6 @@ export function getActiveEditor(accessor: ServicesAccessor): IActiveCodeEditor |
return
activeTextEditorWidget
;
}
function
closeReviewPanel
(
accessor
:
ServicesAccessor
,
args
:
any
)
{
const
outerEditor
=
getActiveEditor
(
accessor
);
if
(
!
outerEditor
)
{
return
;
}
const
controller
=
ReviewController
.
get
(
outerEditor
);
if
(
!
controller
)
{
return
;
}
controller
.
closeWidget
();
}
registerThemingParticipant
((
theme
,
collector
)
=>
{
const
peekViewBackground
=
theme
.
getColor
(
peekViewResultsBackground
);
if
(
peekViewBackground
)
{
...
...
src/vs/workbench/contrib/comments/common/commentThreadWidget.ts
浏览文件 @
de81ccf0
...
...
@@ -5,4 +5,5 @@
export
interface
ICommentThreadWidget
{
submitComment
:
()
=>
Promise
<
void
>
;
collapse
:
()
=>
void
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录