Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
5a3c4d19
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,发现更多精彩内容 >>
提交
5a3c4d19
编写于
4月 20, 2018
作者:
P
Peng Lyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commentProvider can control collapse state of a thread
上级
e1c6d458
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
83 addition
and
19 deletion
+83
-19
extensions/git-extended/src/review/reviewMode.ts
extensions/git-extended/src/review/reviewMode.ts
+6
-2
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+17
-5
src/vs/editor/standalone/browser/standaloneLanguages.ts
src/vs/editor/standalone/browser/standaloneLanguages.ts
+2
-1
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+17
-5
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+12
-0
src/vs/workbench/api/electron-browser/mainThreadComments.ts
src/vs/workbench/api/electron-browser/mainThreadComments.ts
+4
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+3
-1
src/vs/workbench/api/node/extHostComments.ts
src/vs/workbench/api/node/extHostComments.ts
+1
-0
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+12
-0
src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts
...s/comments/electron-browser/commentsEditorContribution.ts
+9
-5
未找到文件。
extensions/git-extended/src/review/reviewMode.ts
浏览文件 @
5a3c4d19
...
@@ -214,6 +214,9 @@ export class ReviewMode implements vscode.DecorationProvider {
...
@@ -214,6 +214,9 @@ export class ReviewMode implements vscode.DecorationProvider {
// No old threads match this thread, it is new
// No old threads match this thread, it is new
if
(
matchingCommentThread
.
length
===
0
)
{
if
(
matchingCommentThread
.
length
===
0
)
{
added
.
push
(
thread
);
added
.
push
(
thread
);
if
(
thread
.
resource
.
scheme
===
'
file
'
)
{
thread
.
collapsibleState
=
vscode
.
CommentThreadCollapsibleState
.
Collapsed
;
}
}
}
// Check if comment has been updated
// Check if comment has been updated
...
@@ -267,7 +270,7 @@ export class ReviewMode implements vscode.DecorationProvider {
...
@@ -267,7 +270,7 @@ export class ReviewMode implements vscode.DecorationProvider {
return
Promise
.
resolve
(
null
);
return
Promise
.
resolve
(
null
);
}
}
private
commentsToCommentThreads
(
comments
:
Comment
[]):
vscode
.
CommentThread
[]
{
private
commentsToCommentThreads
(
comments
:
Comment
[]
,
collapsibleState
:
vscode
.
CommentThreadCollapsibleState
=
vscode
.
CommentThreadCollapsibleState
.
Expanded
):
vscode
.
CommentThread
[]
{
if
(
!
comments
||
!
comments
.
length
)
{
if
(
!
comments
||
!
comments
.
length
)
{
return
[];
return
[];
}
}
...
@@ -297,6 +300,7 @@ export class ReviewMode implements vscode.DecorationProvider {
...
@@ -297,6 +300,7 @@ export class ReviewMode implements vscode.DecorationProvider {
gravatar
:
comment
.
user
.
avatar_url
gravatar
:
comment
.
user
.
avatar_url
};
};
}),
}),
collapsibleState
:
collapsibleState
,
reply
:
this
.
_reply
reply
:
this
.
_reply
});
});
}
}
...
@@ -361,7 +365,7 @@ export class ReviewMode implements vscode.DecorationProvider {
...
@@ -361,7 +365,7 @@ export class ReviewMode implements vscode.DecorationProvider {
}
}
return
{
return
{
threads
:
this
.
commentsToCommentThreads
(
matchingComments
),
threads
:
this
.
commentsToCommentThreads
(
matchingComments
,
document
.
uri
.
scheme
===
'
file
'
?
vscode
.
CommentThreadCollapsibleState
.
Collapsed
:
vscode
.
CommentThreadCollapsibleState
.
Expanded
),
commentingRanges
:
ranges
,
commentingRanges
:
ranges
,
reply
:
this
.
_reply
reply
:
this
.
_reply
};
};
...
...
src/vs/editor/common/modes.ts
浏览文件 @
5a3c4d19
...
@@ -944,12 +944,24 @@ export interface CommentInfo {
...
@@ -944,12 +944,24 @@ export interface CommentInfo {
reply
?:
Command
;
reply
?:
Command
;
}
}
export
enum
CommentThreadCollapsibleState
{
/**
* Determines an item is collapsed
*/
Collapsed
=
0
,
/**
* Determines an item is expanded
*/
Expanded
=
1
}
export
interface
CommentThread
{
export
interface
CommentThread
{
readonly
threadId
:
string
;
threadId
:
string
;
readonly
resource
:
string
;
resource
:
string
;
readonly
range
:
IRange
;
range
:
IRange
;
readonly
comments
:
Comment
[];
comments
:
Comment
[];
readonly
reply
:
Command
;
collapsibleState
?:
CommentThreadCollapsibleState
;
reply
?:
Command
;
}
}
export
interface
NewCommentAction
{
export
interface
NewCommentAction
{
...
...
src/vs/editor/standalone/browser/standaloneLanguages.ts
浏览文件 @
5a3c4d19
...
@@ -793,6 +793,7 @@ export function createMonacoLanguagesAPI(): typeof monaco.languages {
...
@@ -793,6 +793,7 @@ export function createMonacoLanguagesAPI(): typeof monaco.languages {
CompletionItemKind
:
CompletionItemKind
,
CompletionItemKind
:
CompletionItemKind
,
SymbolKind
:
modes
.
SymbolKind
,
SymbolKind
:
modes
.
SymbolKind
,
IndentAction
:
IndentAction
,
IndentAction
:
IndentAction
,
SuggestTriggerKind
:
modes
.
SuggestTriggerKind
SuggestTriggerKind
:
modes
.
SuggestTriggerKind
,
CommentThreadCollapsibleState
:
modes
.
CommentThreadCollapsibleState
};
};
}
}
src/vs/monaco.d.ts
浏览文件 @
5a3c4d19
...
@@ -5035,12 +5035,24 @@ declare namespace monaco.languages {
...
@@ -5035,12 +5035,24 @@ declare namespace monaco.languages {
reply
?:
Command
;
reply
?:
Command
;
}
}
export
enum
CommentThreadCollapsibleState
{
/**
* Determines an item is collapsed
*/
Collapsed
=
0
,
/**
* Determines an item is expanded
*/
Expanded
=
1
,
}
export
interface
CommentThread
{
export
interface
CommentThread
{
readonly
threadId
:
string
;
threadId
:
string
;
readonly
resource
:
string
;
resource
:
string
;
readonly
range
:
IRange
;
range
:
IRange
;
readonly
comments
:
Comment
[];
comments
:
Comment
[];
readonly
reply
:
Command
;
collapsibleState
?:
CommentThreadCollapsibleState
;
reply
?:
Command
;
}
}
export
interface
NewCommentAction
{
export
interface
NewCommentAction
{
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
5a3c4d19
...
@@ -776,11 +776,23 @@ declare module 'vscode' {
...
@@ -776,11 +776,23 @@ declare module 'vscode' {
reply
?:
Command
;
reply
?:
Command
;
}
}
export
enum
CommentThreadCollapsibleState
{
/**
* Determines an item is collapsed
*/
Collapsed
=
0
,
/**
* Determines an item is expanded
*/
Expanded
=
1
}
interface
CommentThread
{
interface
CommentThread
{
threadId
:
string
;
threadId
:
string
;
resource
:
Uri
;
resource
:
Uri
;
range
:
Range
;
range
:
Range
;
comments
:
Comment
[];
comments
:
Comment
[];
collapsibleState
?:
CommentThreadCollapsibleState
;
reply
?:
Command
;
reply
?:
Command
;
}
}
...
...
src/vs/workbench/api/electron-browser/mainThreadComments.ts
浏览文件 @
5a3c4d19
...
@@ -47,6 +47,10 @@ export class MainThreadComments extends Disposable implements MainThreadComments
...
@@ -47,6 +47,10 @@ export class MainThreadComments extends Disposable implements MainThreadComments
return
;
return
;
}
}
if
(
!
outerEditor
.
getModel
())
{
return
;
}
const
outerEditorURI
=
outerEditor
.
getModel
().
uri
;
const
outerEditorURI
=
outerEditor
.
getModel
().
uri
;
this
.
provideComments
(
outerEditorURI
).
then
(
commentInfos
=>
{
this
.
provideComments
(
outerEditorURI
).
then
(
commentInfos
=>
{
this
.
_commentService
.
setComments
(
outerEditorURI
,
commentInfos
);
this
.
_commentService
.
setComments
(
outerEditorURI
,
commentInfos
);
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
5a3c4d19
...
@@ -686,7 +686,9 @@ export function createApiFactory(
...
@@ -686,7 +686,9 @@ export function createApiFactory(
FileType
:
extHostTypes
.
FileType
,
FileType
:
extHostTypes
.
FileType
,
FoldingRangeList
:
extHostTypes
.
FoldingRangeList
,
FoldingRangeList
:
extHostTypes
.
FoldingRangeList
,
FoldingRange
:
extHostTypes
.
FoldingRange
,
FoldingRange
:
extHostTypes
.
FoldingRange
,
FoldingRangeType
:
extHostTypes
.
FoldingRangeType
FoldingRangeType
:
extHostTypes
.
FoldingRangeType
,
CommentThreadCollapsibleState
:
extHostTypes
.
CommentThreadCollapsibleState
};
};
};
};
}
}
...
...
src/vs/workbench/api/node/extHostComments.ts
浏览文件 @
5a3c4d19
...
@@ -103,6 +103,7 @@ function convertCommentThread(vscodeCommentThread: vscode.CommentThread, command
...
@@ -103,6 +103,7 @@ function convertCommentThread(vscodeCommentThread: vscode.CommentThread, command
resource
:
vscodeCommentThread
.
resource
.
toString
(),
resource
:
vscodeCommentThread
.
resource
.
toString
(),
range
:
extHostTypeConverter
.
fromRange
(
vscodeCommentThread
.
range
),
range
:
extHostTypeConverter
.
fromRange
(
vscodeCommentThread
.
range
),
comments
:
vscodeCommentThread
.
comments
.
map
(
convertComment
),
comments
:
vscodeCommentThread
.
comments
.
map
(
convertComment
),
collapsibleState
:
vscodeCommentThread
.
collapsibleState
,
reply
:
vscodeCommentThread
.
reply
?
commandsConverter
.
toInternal
(
vscodeCommentThread
.
reply
)
:
null
reply
:
vscodeCommentThread
.
reply
?
commandsConverter
.
toInternal
(
vscodeCommentThread
.
reply
)
:
null
};
};
}
}
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
5a3c4d19
...
@@ -1868,3 +1868,15 @@ export enum FoldingRangeType {
...
@@ -1868,3 +1868,15 @@ export enum FoldingRangeType {
}
}
//#endregion
//#endregion
export
enum
CommentThreadCollapsibleState
{
/**
* Determines an item is collapsed
*/
Collapsed
=
0
,
/**
* Determines an item is expanded
*/
Expanded
=
1
}
\ No newline at end of file
src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts
浏览文件 @
5a3c4d19
...
@@ -102,6 +102,9 @@ export class CommentNode {
...
@@ -102,6 +102,9 @@ export class CommentNode {
}
}
}
}
const
EXPAND_ACTION_CLASS
=
'
expand-review-action octicon octicon-chevron-down
'
;
const
COLLAPSE_ACTION_CLASS
=
'
expand-review-action octicon octicon-chevron-up
'
;
export
class
ReviewZoneWidget
extends
ZoneWidget
{
export
class
ReviewZoneWidget
extends
ZoneWidget
{
private
_headElement
:
HTMLElement
;
private
_headElement
:
HTMLElement
;
protected
_primaryHeading
:
HTMLElement
;
protected
_primaryHeading
:
HTMLElement
;
...
@@ -113,7 +116,7 @@ export class ReviewZoneWidget extends ZoneWidget {
...
@@ -113,7 +116,7 @@ export class ReviewZoneWidget extends ZoneWidget {
private
_commentElements
:
CommentNode
[];
private
_commentElements
:
CommentNode
[];
private
_resizeObserver
:
any
;
private
_resizeObserver
:
any
;
private
_onDidClose
=
new
Emitter
<
ReviewZoneWidget
>
();
private
_onDidClose
=
new
Emitter
<
ReviewZoneWidget
>
();
private
_isCollapsed
=
true
;
private
_isCollapsed
;
private
_toggleAction
:
Action
;
private
_toggleAction
:
Action
;
private
_commentThread
:
modes
.
CommentThread
;
private
_commentThread
:
modes
.
CommentThread
;
public
get
commentThread
():
modes
.
CommentThread
{
public
get
commentThread
():
modes
.
CommentThread
{
...
@@ -139,6 +142,7 @@ export class ReviewZoneWidget extends ZoneWidget {
...
@@ -139,6 +142,7 @@ export class ReviewZoneWidget extends ZoneWidget {
this
.
_owner
=
owner
;
this
.
_owner
=
owner
;
this
.
_commentThread
=
commentThread
;
this
.
_commentThread
=
commentThread
;
this
.
_replyCommand
=
replyCommand
;
this
.
_replyCommand
=
replyCommand
;
this
.
_isCollapsed
=
commentThread
.
collapsibleState
!==
modes
.
CommentThreadCollapsibleState
.
Expanded
;
this
.
create
();
this
.
create
();
this
.
themeService
.
onThemeChange
(
this
.
_applyTheme
,
this
);
this
.
themeService
.
onThemeChange
(
this
.
_applyTheme
,
this
);
}
}
...
@@ -183,15 +187,15 @@ export class ReviewZoneWidget extends ZoneWidget {
...
@@ -183,15 +187,15 @@ export class ReviewZoneWidget extends ZoneWidget {
this
.
_actionbarWidget
=
new
ActionBar
(
actionsContainer
.
getHTMLElement
(),
{});
this
.
_actionbarWidget
=
new
ActionBar
(
actionsContainer
.
getHTMLElement
(),
{});
this
.
_disposables
.
push
(
this
.
_actionbarWidget
);
this
.
_disposables
.
push
(
this
.
_actionbarWidget
);
this
.
_toggleAction
=
new
Action
(
'
review.expand
'
,
nls
.
localize
(
'
label.expand
'
,
"
Expand
"
),
'
expand-review-action octicon octicon-chevron-down
'
,
true
,
()
=>
{
this
.
_toggleAction
=
new
Action
(
'
review.expand
'
,
nls
.
localize
(
'
label.expand
'
,
"
Expand
"
),
this
.
_isCollapsed
?
EXPAND_ACTION_CLASS
:
COLLAPSE_ACTION_CLASS
,
true
,
()
=>
{
if
(
this
.
_isCollapsed
)
{
if
(
this
.
_isCollapsed
)
{
this
.
_bodyElement
.
style
.
display
=
'
block
'
;
this
.
_bodyElement
.
style
.
display
=
'
block
'
;
this
.
_toggleAction
.
class
=
'
expand-review-action octicon octicon-chevron-up
'
;
this
.
_toggleAction
.
class
=
COLLAPSE_ACTION_CLASS
;
this
.
_isCollapsed
=
false
;
this
.
_isCollapsed
=
false
;
}
}
else
{
else
{
this
.
_bodyElement
.
style
.
display
=
'
none
'
;
this
.
_bodyElement
.
style
.
display
=
'
none
'
;
this
.
_toggleAction
.
class
=
'
expand-review-action octicon octicon-chevron-down
'
;
this
.
_toggleAction
.
class
=
EXPAND_ACTION_CLASS
;
this
.
_isCollapsed
=
true
;
this
.
_isCollapsed
=
true
;
}
}
return
null
;
return
null
;
...
@@ -270,7 +274,7 @@ export class ReviewZoneWidget extends ZoneWidget {
...
@@ -270,7 +274,7 @@ export class ReviewZoneWidget extends ZoneWidget {
this
.
_headElement
.
style
.
height
=
`
${
headHeight
}
px`
;
this
.
_headElement
.
style
.
height
=
`
${
headHeight
}
px`
;
this
.
_headElement
.
style
.
lineHeight
=
this
.
_headElement
.
style
.
height
;
this
.
_headElement
.
style
.
lineHeight
=
this
.
_headElement
.
style
.
height
;
this
.
_bodyElement
.
style
.
display
=
'
none
'
;
this
.
_bodyElement
.
style
.
display
=
this
.
_isCollapsed
?
'
none
'
:
'
block
'
;
this
.
_commentsElement
=
$
(
'
div.comments-container
'
).
appendTo
(
this
.
_bodyElement
).
getHTMLElement
();
this
.
_commentsElement
=
$
(
'
div.comments-container
'
).
appendTo
(
this
.
_bodyElement
).
getHTMLElement
();
this
.
_commentElements
=
[];
this
.
_commentElements
=
[];
for
(
let
i
=
0
;
i
<
this
.
_commentThread
.
comments
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
_commentThread
.
comments
.
length
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录