Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c4efd003
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,发现更多精彩内容 >>
提交
c4efd003
编写于
5月 22, 2018
作者:
P
Peng Lyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show diff view editor for outdated comments.
上级
3ef1b53c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
107 addition
and
31 deletion
+107
-31
extensions/git-extended/package.json
extensions/git-extended/package.json
+4
-0
extensions/git-extended/src/commands.ts
extensions/git-extended/src/commands.ts
+15
-0
extensions/git-extended/src/review/reviewManager.ts
extensions/git-extended/src/review/reviewManager.ts
+8
-1
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+1
-0
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-0
src/vs/workbench/api/node/extHostComments.ts
src/vs/workbench/api/node/extHostComments.ts
+12
-11
src/vs/workbench/parts/comments/electron-browser/commentsPanel.ts
...orkbench/parts/comments/electron-browser/commentsPanel.ts
+65
-19
未找到文件。
extensions/git-extended/package.json
浏览文件 @
c4efd003
...
...
@@ -84,6 +84,10 @@
"command"
:
"pr.openDescription"
,
"title"
:
"View Pull Request Description"
},
{
"command"
:
"pr.viewChanges"
,
"title"
:
"View Changes"
},
{
"command"
:
"review.openFile"
,
"title"
:
"Open File"
,
...
...
extensions/git-extended/src/commands.ts
浏览文件 @
c4efd003
...
...
@@ -9,6 +9,7 @@ import { PullRequestModel } from './common/models/pullRequestModel';
import
{
FileChangeTreeItem
}
from
'
./common/treeItems
'
;
import
{
ReviewManager
}
from
'
./review/reviewManager
'
;
import
{
PullRequestOverviewPanel
}
from
'
./common/pullRequestOverview
'
;
import
{
fromGitUri
,
toGitUri
}
from
'
./common/uri
'
;
export
function
registerCommands
(
context
:
vscode
.
ExtensionContext
)
{
// initialize resources
...
...
@@ -50,4 +51,18 @@ export function registerCommands(context: vscode.ExtensionContext) {
// Create and show a new webview
PullRequestOverviewPanel
.
createOrShow
(
context
.
extensionPath
,
pr
);
}));
context
.
subscriptions
.
push
(
vscode
.
commands
.
registerCommand
(
'
pr.viewChanges
'
,
async
(
fileChange
:
FileChangeTreeItem
)
=>
{
// Show the file change in a diff view.
let
{
path
,
ref
,
commit
}
=
fromGitUri
(
fileChange
.
filePath
);
let
previousCommit
=
`
${
commit
}
^`
;
let
previousFileUri
=
fileChange
.
filePath
.
with
({
query
:
JSON
.
stringify
({
path
:
path
,
ref
:
ref
,
commit
:
previousCommit
})
});
return
vscode
.
commands
.
executeCommand
(
'
vscode.diff
'
,
previousFileUri
,
fileChange
.
filePath
,
`
${
fileChange
.
fileName
}
from
${
commit
}
`
);
}));
}
extensions/git-extended/src/review/reviewManager.ts
浏览文件 @
c4efd003
...
...
@@ -397,7 +397,14 @@ export class ReviewManager implements vscode.DecorationProvider {
commentId
:
comment
.
id
,
body
:
new
vscode
.
MarkdownString
(
comment
.
body
),
userName
:
comment
.
user
.
login
,
gravatar
:
comment
.
user
.
avatar_url
gravatar
:
comment
.
user
.
avatar_url
,
command
:
{
title
:
'
View Changes
'
,
command
:
'
pr.viewChanges
'
,
arguments
:
[
fileChange
]
}
};
}),
collapsibleState
:
collapsibleState
...
...
src/vs/editor/common/modes.ts
浏览文件 @
c4efd003
...
...
@@ -985,6 +985,7 @@ export interface Comment {
readonly
body
:
IMarkdownString
;
readonly
userName
:
string
;
readonly
gravatar
:
string
;
readonly
command
?:
Command
;
}
export
interface
CommentThreadChangedEvent
{
...
...
src/vs/monaco.d.ts
浏览文件 @
c4efd003
...
...
@@ -5180,6 +5180,7 @@ declare namespace monaco.languages {
readonly
body
:
IMarkdownString
;
readonly
userName
:
string
;
readonly
gravatar
:
string
;
readonly
command
?:
Command
;
}
export
interface
CommentThreadChangedEvent
{
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
c4efd003
...
...
@@ -554,6 +554,7 @@ declare module 'vscode' {
body
:
MarkdownString
;
userName
:
string
;
gravatar
:
string
;
command
?:
Command
;
}
export
interface
CommentThreadChangedEvent
{
...
...
src/vs/workbench/api/node/extHostComments.ts
浏览文件 @
c4efd003
...
...
@@ -75,7 +75,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
return
asWinJsPromise
(
token
=>
{
let
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
provider
.
createNewCommentThread
(
data
.
document
,
ran
,
text
,
token
);
}).
then
(
commentThread
=>
commentThread
?
convertToCommentThread
(
commentThread
)
:
null
);
}).
then
(
commentThread
=>
commentThread
?
convertToCommentThread
(
commentThread
,
this
.
_commandsConverter
)
:
null
);
}
$replyToCommentThread
(
handle
:
number
,
uri
:
UriComponents
,
range
:
IRange
,
thread
:
modes
.
CommentThread
,
text
:
string
):
TPromise
<
modes
.
CommentThread
>
{
...
...
@@ -89,7 +89,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
return
asWinJsPromise
(
token
=>
{
let
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
provider
.
replyToCommentThread
(
data
.
document
,
ran
,
convertFromCommentThread
(
thread
),
text
,
token
);
}).
then
(
commentThread
=>
commentThread
?
convertToCommentThread
(
commentThread
)
:
null
);
}).
then
(
commentThread
=>
commentThread
?
convertToCommentThread
(
commentThread
,
this
.
_commandsConverter
)
:
null
);
}
$provideDocumentComments
(
handle
:
number
,
uri
:
UriComponents
):
TPromise
<
modes
.
CommentInfo
>
{
...
...
@@ -114,7 +114,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
return
asWinJsPromise
(
token
=>
{
return
provider
.
provideWorkspaceComments
(
token
);
}).
then
(
comments
=>
comments
.
map
(
x
=>
convertToCommentThread
(
x
)
comments
.
map
(
x
=>
convertToCommentThread
(
x
,
this
.
_commandsConverter
)
));
}
...
...
@@ -123,9 +123,9 @@ export class ExtHostComments implements ExtHostCommentsShape {
this
.
_proxy
.
$onDidCommentThreadsChange
(
handle
,
{
owner
:
handle
,
changed
:
event
.
changed
.
map
(
x
=>
convertToCommentThread
(
x
)),
added
:
event
.
added
.
map
(
x
=>
convertToCommentThread
(
x
)),
removed
:
event
.
removed
.
map
(
x
=>
convertToCommentThread
(
x
))
changed
:
event
.
changed
.
map
(
x
=>
convertToCommentThread
(
x
,
this
.
_commandsConverter
)),
added
:
event
.
added
.
map
(
x
=>
convertToCommentThread
(
x
,
this
.
_commandsConverter
)),
removed
:
event
.
removed
.
map
(
x
=>
convertToCommentThread
(
x
,
this
.
_commandsConverter
))
});
});
}
...
...
@@ -134,17 +134,17 @@ export class ExtHostComments implements ExtHostCommentsShape {
function
convertCommentInfo
(
owner
:
number
,
vscodeCommentInfo
:
vscode
.
CommentInfo
,
commandsConverter
:
CommandsConverter
):
modes
.
CommentInfo
{
return
{
owner
:
owner
,
threads
:
vscodeCommentInfo
.
threads
.
map
(
x
=>
convertToCommentThread
(
x
)),
threads
:
vscodeCommentInfo
.
threads
.
map
(
x
=>
convertToCommentThread
(
x
,
commandsConverter
)),
commentingRanges
:
vscodeCommentInfo
.
commentingRanges
?
vscodeCommentInfo
.
commentingRanges
.
map
(
range
=>
extHostTypeConverter
.
Range
.
from
(
range
))
:
[]
};
}
function
convertToCommentThread
(
vscodeCommentThread
:
vscode
.
CommentThread
):
modes
.
CommentThread
{
function
convertToCommentThread
(
vscodeCommentThread
:
vscode
.
CommentThread
,
commandsConverter
:
CommandsConverter
):
modes
.
CommentThread
{
return
{
threadId
:
vscodeCommentThread
.
threadId
,
resource
:
vscodeCommentThread
.
resource
.
toString
(),
range
:
extHostTypeConverter
.
Range
.
from
(
vscodeCommentThread
.
range
),
comments
:
vscodeCommentThread
.
comments
.
map
(
co
nvertToComment
),
comments
:
vscodeCommentThread
.
comments
.
map
(
co
mment
=>
convertToComment
(
comment
,
commandsConverter
)
),
collapsibleState
:
vscodeCommentThread
.
collapsibleState
};
}
...
...
@@ -168,11 +168,12 @@ function convertFromComment(comment: modes.Comment): vscode.Comment {
};
}
function
convertToComment
(
vscodeComment
:
vscode
.
Comment
):
modes
.
Comment
{
function
convertToComment
(
vscodeComment
:
vscode
.
Comment
,
commandsConverter
:
CommandsConverter
):
modes
.
Comment
{
return
{
commentId
:
vscodeComment
.
commentId
,
body
:
extHostTypeConverter
.
MarkdownString
.
from
(
vscodeComment
.
body
),
userName
:
vscodeComment
.
userName
,
gravatar
:
vscodeComment
.
gravatar
gravatar
:
vscodeComment
.
gravatar
,
command
:
vscodeComment
.
command
?
commandsConverter
.
toInternal
(
vscodeComment
.
command
)
:
null
};
}
src/vs/workbench/parts/comments/electron-browser/commentsPanel.ts
浏览文件 @
c4efd003
...
...
@@ -9,7 +9,7 @@ import { IAction } from 'vs/base/common/actions';
import
{
debounceEvent
}
from
'
vs/base/common/event
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
CollapseAllAction
,
DefaultAccessibilityProvider
,
DefaultController
,
DefaultDragAndDrop
}
from
'
vs/base/parts/tree/browser/treeDefaults
'
;
import
{
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
isCodeEditor
,
isDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
CommentThread
,
CommentThreadChangedEvent
}
from
'
vs/editor/common/modes
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -23,6 +23,10 @@ import { CommentsDataFilter, CommentsDataSource, CommentsModelRenderer } from 'v
import
{
IActivityService
,
NumberBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
ICommentService
}
from
'
vs/workbench/services/comments/electron-browser/commentService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ICommandService
}
from
'
../../../../platform/commands/common/commands
'
;
import
{
DiffEditorInput
}
from
'
vs/workbench/common/editor/diffEditorInput
'
;
import
{
TextDiffEditor
}
from
'
../../../browser/parts/editor/textDiffEditor
'
;
import
{
DiffEditorWidget
}
from
'
../../../../editor/browser/widget/diffEditorWidget
'
;
export
const
COMMENTS_PANEL_ID
=
'
workbench.panel.comments
'
;
export
const
COMMENTS_PANEL_TITLE
=
'
Comments
'
;
...
...
@@ -39,6 +43,7 @@ export class CommentsPanel extends Panel {
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
ICommentService
private
commentService
:
ICommentService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
ICommandService
private
commandService
:
ICommandService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IThemeService
themeService
:
IThemeService
,
@
IActivityService
private
activityService
:
IActivityService
...
...
@@ -151,24 +156,65 @@ export class CommentsPanel extends Panel {
}
});
});
Promise
.
all
([
this
.
editorService
.
openEditor
({
resource
:
element
.
resource
,
options
:
{
pinned
:
pinned
,
preserveFocus
:
preserveFocus
,
selection
:
range
}
},
sideBySide
),
setCommentsForFile
]).
then
(
vals
=>
{
let
editor
=
vals
[
0
];
const
threadToReveal
=
element
instanceof
ResourceWithCommentThreads
?
element
.
commentThreads
[
0
].
threadId
:
element
.
threadId
;
const
commentToReveal
=
element
instanceof
ResourceWithCommentThreads
?
element
.
commentThreads
[
0
].
comment
.
commentId
:
element
.
comment
.
commentId
;
const
control
=
editor
.
getControl
();
if
(
threadToReveal
&&
isCodeEditor
(
control
))
{
const
controller
=
ReviewController
.
get
(
control
);
controller
.
revealCommentThread
(
threadToReveal
,
commentToReveal
);
}
setCommentsForFile
=
null
;
});
const
threadToReveal
=
element
instanceof
ResourceWithCommentThreads
?
element
.
commentThreads
[
0
].
threadId
:
element
.
threadId
;
const
commentToReveal
=
element
instanceof
ResourceWithCommentThreads
?
element
.
commentThreads
[
0
].
comment
:
element
.
comment
;
if
(
commentToReveal
.
command
)
{
Promise
.
all
([
this
.
commandService
.
executeCommand
(
commentToReveal
.
command
.
id
,
...
commentToReveal
.
command
.
arguments
),
setCommentsForFile
]).
then
(
_
=>
{
let
activeInput
=
this
.
editorService
.
getActiveEditorInput
();
if
(
activeInput
&&
activeInput
instanceof
DiffEditorInput
)
{
let
activeEditor
=
this
.
editorService
.
getActiveEditor
();
const
control
=
activeEditor
.
getControl
()
as
DiffEditorWidget
;
const
originalEditorControl
=
control
.
getOriginalEditor
();
const
modifiedEditorControl
=
control
.
getModifiedEditor
();
let
controller
;
if
(
activeInput
.
originalInput
.
getResource
().
toString
()
===
element
.
resource
.
toString
())
{
controller
=
ReviewController
.
get
(
originalEditorControl
);
}
else
if
(
activeInput
.
modifiedInput
.
getResource
().
toString
()
===
element
.
resource
.
toString
())
{
controller
=
ReviewController
.
get
(
modifiedEditorControl
);
}
if
(
controller
)
{
controller
.
revealCommentThread
(
threadToReveal
,
commentToReveal
.
commentId
);
}
}
else
{
let
currentActiveResource
=
activeInput
?
activeInput
.
getResource
()
:
void
0
;
if
(
currentActiveResource
&&
currentActiveResource
.
toString
()
===
element
.
resource
.
toString
())
{
const
control
=
this
.
editorService
.
getActiveEditor
().
getControl
();
if
(
threadToReveal
&&
isCodeEditor
(
control
))
{
const
controller
=
ReviewController
.
get
(
control
);
controller
.
revealCommentThread
(
threadToReveal
,
commentToReveal
.
commentId
);
}
}
}
return
true
;
});
}
else
{
Promise
.
all
([
this
.
editorService
.
openEditor
({
resource
:
element
.
resource
,
options
:
{
pinned
:
pinned
,
preserveFocus
:
preserveFocus
,
selection
:
range
}
},
sideBySide
),
setCommentsForFile
]).
then
(
vals
=>
{
let
editor
=
vals
[
0
];
const
control
=
editor
.
getControl
();
if
(
threadToReveal
&&
isCodeEditor
(
control
))
{
const
controller
=
ReviewController
.
get
(
control
);
console
.
log
(
commentToReveal
.
command
);
controller
.
revealCommentThread
(
threadToReveal
,
commentToReveal
.
commentId
);
}
setCommentsForFile
=
null
;
});
}
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录