Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f32bea55
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f32bea55
编写于
5月 11, 2018
作者:
R
Rachel Macfarlane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix reply command for first comment in thread
上级
35704719
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
46 deletion
+28
-46
extensions/git-extended/src/prView/prProvider.ts
extensions/git-extended/src/prView/prProvider.ts
+3
-3
extensions/git-extended/src/review/reviewManager.ts
extensions/git-extended/src/review/reviewManager.ts
+2
-2
src/vs/workbench/parts/comments/electron-browser/commentGlyphWidget.ts
...nch/parts/comments/electron-browser/commentGlyphWidget.ts
+1
-0
src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts
...ch/parts/comments/electron-browser/commentThreadWidget.ts
+2
-1
src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts
...s/comments/electron-browser/commentsEditorContribution.ts
+20
-40
未找到文件。
extensions/git-extended/src/prView/prProvider.ts
浏览文件 @
f32bea55
...
...
@@ -171,7 +171,7 @@ export class PRProvider implements vscode.TreeDataProvider<PRGroupTreeItem | Pul
const
_onDidChangeCommentThreads
=
new
vscode
.
EventEmitter
<
vscode
.
CommentThreadChangedEvent
>
();
vscode
.
workspace
.
registerDocumentCommentProvider
({
onDidChangeCommentThreads
:
_onDidChangeCommentThreads
.
event
,
provideDocumentComments
:
async
(
document
:
vscode
.
TextDocument
,
token
:
vscode
.
CancellationToken
)
=>
{
provideDocumentComments
:
async
(
document
:
vscode
.
TextDocument
,
token
:
vscode
.
CancellationToken
)
:
Promise
<
vscode
.
CommentInfo
>
=>
{
if
(
document
.
uri
.
scheme
===
'
pr
'
)
{
let
params
=
JSON
.
parse
(
document
.
uri
.
query
);
let
fileChange
=
richContentChanges
.
find
(
change
=>
change
.
fileName
===
params
.
fileName
);
...
...
@@ -196,7 +196,7 @@ export class PRProvider implements vscode.TreeDataProvider<PRGroupTreeItem | Pul
return
{
threads
:
[],
commentingRanges
,
reply
:
reply
postReviewComment
:
reply
};
}
...
...
@@ -236,7 +236,7 @@ export class PRProvider implements vscode.TreeDataProvider<PRGroupTreeItem | Pul
return
{
threads
,
commentingRanges
,
reply
:
reply
postReviewComment
:
reply
};
}
...
...
extensions/git-extended/src/review/reviewManager.ts
浏览文件 @
f32bea55
...
...
@@ -392,7 +392,7 @@ export class ReviewManager implements vscode.DecorationProvider {
private
registerCommentProvider
()
{
this
.
_documentCommentProvider
=
vscode
.
workspace
.
registerDocumentCommentProvider
({
onDidChangeCommentThreads
:
this
.
_onDidChangeCommentThreads
.
event
,
provideDocumentComments
:
async
(
document
:
vscode
.
TextDocument
,
token
:
vscode
.
CancellationToken
)
=>
{
provideDocumentComments
:
async
(
document
:
vscode
.
TextDocument
,
token
:
vscode
.
CancellationToken
)
:
Promise
<
vscode
.
CommentInfo
>
=>
{
let
ranges
:
vscode
.
Range
[]
=
[];
let
matchingComments
:
Comment
[];
...
...
@@ -450,7 +450,7 @@ export class ReviewManager implements vscode.DecorationProvider {
return
{
threads
:
this
.
commentsToCommentThreads
(
matchingComments
,
document
.
uri
.
scheme
===
'
file
'
?
vscode
.
CommentThreadCollapsibleState
.
Collapsed
:
vscode
.
CommentThreadCollapsibleState
.
Expanded
),
commentingRanges
:
ranges
,
reply
:
this
.
_reply
postReviewComment
:
this
.
_reply
};
}
});
...
...
src/vs/workbench/parts/comments/electron-browser/commentGlyphWidget.ts
浏览文件 @
f32bea55
...
...
@@ -13,6 +13,7 @@ export class CommentGlyphWidget implements IContentWidget {
private
_editor
:
ICodeEditor
;
constructor
(
id
:
string
,
editor
:
ICodeEditor
,
lineNumber
:
number
,
onClick
:
()
=>
void
)
{
this
.
_id
=
id
;
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
this
.
_domNode
.
className
=
'
new-comment-hint
'
;
this
.
_domNode
.
addEventListener
(
'
click
'
,
onClick
);
...
...
src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts
浏览文件 @
f32bea55
...
...
@@ -158,6 +158,7 @@ export class ReviewZoneWidget extends ZoneWidget {
this
.
_toggleAction
=
new
Action
(
'
review.expand
'
,
nls
.
localize
(
'
label.expand
'
,
"
Expand
"
),
this
.
_isCollapsed
?
EXPAND_ACTION_CLASS
:
COLLAPSE_ACTION_CLASS
,
true
,
()
=>
{
if
(
this
.
_isCollapsed
)
{
this
.
_isCollapsed
=
false
;
this
.
show
({
lineNumber
:
this
.
_commentThread
.
range
.
startLineNumber
,
column
:
1
},
2
);
}
else
{
this
.
_isCollapsed
=
true
;
...
...
@@ -234,7 +235,7 @@ export class ReviewZoneWidget extends ZoneWidget {
display
(
lineNumber
:
number
)
{
const
commentWidget
=
new
CommentGlyphWidget
(
`review_
${
lineNumber
}
`
,
this
.
editor
,
lineNumber
,
()
=>
{
// Does nothing when clicked
this
.
toggleExpand
();
});
this
.
editor
.
layoutContentWidget
(
commentWidget
);
...
...
src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts
浏览文件 @
f32bea55
...
...
@@ -13,7 +13,7 @@ import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
EmbeddedCodeEditorWidget
}
from
'
vs/editor/browser/widget/embeddedCodeEditorWidget
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelDe
coration
,
IModelDe
ltaDecoration
,
TrackedRangeStickiness
}
from
'
vs/editor/common/model
'
;
import
{
IModelDeltaDecoration
,
TrackedRangeStickiness
}
from
'
vs/editor/common/model
'
;
import
{
ModelDecorationOptions
}
from
'
vs/editor/common/model/textModel
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
peekViewEditorBackground
}
from
'
vs/editor/contrib/referenceSearch/referencesWidget
'
;
...
...
@@ -251,14 +251,13 @@ export class ReviewController implements IEditorContribution {
if
(
this
.
canAddNewCommentToLine
(
lineNumber
))
{
let
newCommentInfo
=
this
.
getNewCommentAction
(
lineNumber
);
if
(
!
newCommentInfo
)
{
return
;
}
// add new comment
this
.
_reviewPanelVisible
.
set
(
true
);
const
[
replyCommand
,
owner
]
=
newCommentInfo
;
this
.
_zoneWidget
=
new
ReviewZoneWidget
(
this
.
editor
,
owner
,
{
const
{
replyCommand
,
ownerId
}
=
newCommentInfo
;
this
.
_zoneWidget
=
new
ReviewZoneWidget
(
this
.
editor
,
owner
Id
,
{
threadId
:
null
,
resource
:
null
,
comments
:
[],
...
...
@@ -268,7 +267,7 @@ export class ReviewController implements IEditorContribution {
endLineNumber
:
lineNumber
,
endColumn
:
0
},
reply
:
newCommentInfo
[
0
]
,
reply
:
replyCommand
,
collapsibleState
:
CommentThreadCollapsibleState
.
Expanded
,
},
replyCommand
,
{},
this
.
themeService
,
this
.
commandService
);
...
...
@@ -282,14 +281,13 @@ export class ReviewController implements IEditorContribution {
private
addComment
(
lineNumber
:
number
)
{
let
newCommentInfo
=
this
.
getNewCommentAction
(
lineNumber
);
if
(
!
newCommentInfo
)
{
return
;
}
// add new comment
this
.
_reviewPanelVisible
.
set
(
true
);
const
[
replyCommand
,
owner
]
=
newCommentInfo
;
this
.
_zoneWidget
=
new
ReviewZoneWidget
(
this
.
editor
,
owner
,
{
const
{
replyCommand
,
ownerId
}
=
newCommentInfo
;
this
.
_zoneWidget
=
new
ReviewZoneWidget
(
this
.
editor
,
owner
Id
,
{
threadId
:
null
,
resource
:
null
,
comments
:
[],
...
...
@@ -299,7 +297,7 @@ export class ReviewController implements IEditorContribution {
endLineNumber
:
lineNumber
,
endColumn
:
0
},
reply
:
newCommentInfo
[
0
]
,
reply
:
replyCommand
,
collapsibleState
:
CommentThreadCollapsibleState
.
Expanded
,
},
replyCommand
,
{},
this
.
themeService
,
this
.
commandService
);
...
...
@@ -333,40 +331,22 @@ export class ReviewController implements IEditorContribution {
}
}
getNewCommentAction
(
line
:
number
):
[
modes
.
Command
,
number
]
{
const
decorations
=
this
.
editor
.
getLineDecorations
(
line
);
let
activeDecoration
:
IModelDecoration
;
if
(
decorations
)
{
for
(
const
decoration
of
decorations
)
{
if
(
decoration
.
options
.
linesDecorationsClassName
&&
decoration
.
options
.
linesDecorationsClassName
.
indexOf
(
'
commenting-range
'
)
>
-
1
&&
decoration
.
options
.
glyphMarginClassName
.
indexOf
(
'
review
'
)
<
0
)
{
activeDecoration
=
decoration
;
}
}
}
if
(
!
activeDecoration
)
{
return
null
;
}
let
cmd
:
modes
.
Command
=
null
;
let
owner
:
number
=
-
1
;
this
.
commentingRangeDecorationMap
.
forEach
((
value
,
key
)
=>
{
if
(
!
cmd
&&
value
.
indexOf
(
activeDecoration
.
id
)
>
-
1
)
{
// index
let
infos
=
this
.
_commentInfos
.
filter
(
info
=>
info
.
owner
===
Number
(
key
));
getNewCommentAction
(
line
:
number
):
{
replyCommand
:
modes
.
Command
,
ownerId
:
number
}
{
for
(
let
i
=
0
;
i
<
this
.
_commentInfos
.
length
;
i
++
)
{
const
commentInfo
=
this
.
_commentInfos
[
i
];
const
lineWithinRange
=
commentInfo
.
commentingRanges
.
some
(
range
=>
range
.
startLineNumber
<=
line
&&
line
<=
range
.
endLineNumber
);
if
(
infos
&&
infos
.
length
)
{
cmd
=
infos
[
0
].
reply
;
owner
=
Number
(
key
);
}
if
(
lineWithinRange
)
{
return
{
replyCommand
:
commentInfo
.
reply
,
ownerId
:
commentInfo
.
owner
};
}
}
);
}
return
[
cmd
,
owner
]
;
return
null
;
}
canAddNewCommentToLine
(
line
:
number
):
boolean
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录