Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b98a5ad0
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,发现更多精彩内容 >>
提交
b98a5ad0
编写于
2月 21, 2019
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
register comments panel when there is comment control registered
上级
d41ade21
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
14 deletion
+44
-14
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+4
-4
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+3
-2
src/vs/workbench/api/electron-browser/mainThreadComments.ts
src/vs/workbench/api/electron-browser/mainThreadComments.ts
+37
-8
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
b98a5ad0
...
...
@@ -1318,22 +1318,22 @@ export interface CommentThreadChangedEvent {
/**
* Added comment threads.
*/
readonly
added
:
CommentThread
[];
readonly
added
:
(
CommentThread
|
CommentThread2
)
[];
/**
* Removed comment threads.
*/
readonly
removed
:
CommentThread
[];
readonly
removed
:
(
CommentThread
|
CommentThread2
)
[];
/**
* Changed comment threads.
*/
readonly
changed
:
CommentThread
[];
readonly
changed
:
(
CommentThread
|
CommentThread2
)
[];
/**
* changed draft mode.
*/
readonly
draftMode
:
DraftMode
;
readonly
draftMode
?
:
DraftMode
;
}
/**
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
b98a5ad0
...
...
@@ -793,6 +793,7 @@ declare module 'vscode' {
* Whether the thread should be collapsed or expanded when opening the document. Defaults to Collapsed.
*/
collapsibleState
?:
CommentThreadCollapsibleState
;
dispose
?():
void
;
}
/**
...
...
@@ -956,8 +957,8 @@ declare module 'vscode' {
readonly
id
:
string
;
readonly
label
:
string
;
/**
* The active (focused) comment widget.
*/
* The active (focused) comment widget.
*/
readonly
widget
?:
CommentWidget
;
createCommentThread
(
id
:
string
,
resource
:
Uri
,
range
:
Range
,
comments
:
Comment
[],
acceptInputCommands
:
Command
[],
collapsibleState
?:
CommentThreadCollapsibleState
):
CommentThread
;
dispose
():
void
;
...
...
src/vs/workbench/api/electron-browser/mainThreadComments.ts
浏览文件 @
b98a5ad0
...
...
@@ -165,6 +165,7 @@ export class MainThreadCommentControl {
private
_threads
:
Map
<
number
,
MainThreadCommentThread
>
=
new
Map
<
number
,
MainThreadCommentThread
>
();
constructor
(
private
_proxy
:
ExtHostCommentsShape
,
private
_commentService
:
ICommentService
,
private
_handle
:
number
,
private
_id
:
string
,
private
_label
:
string
...
...
@@ -184,12 +185,26 @@ export class MainThreadCommentControl {
);
this
.
_threads
.
set
(
commentThreadHandle
,
thread
);
this
.
_commentService
.
updateComments
(
`
${
this
.
handle
}
`
,
{
added
:
[
thread
],
removed
:
[],
changed
:
[],
draftMode
:
modes
.
DraftMode
.
NotSupported
});
return
thread
;
}
deleteCommentThread
(
commentThreadHandle
:
number
)
{
let
thread
=
this
.
_threads
.
get
(
commentThreadHandle
);
this
.
_threads
.
delete
(
commentThreadHandle
);
this
.
_commentService
.
updateComments
(
`
${
this
.
handle
}
`
,
{
added
:
[],
removed
:
[
thread
],
changed
:
[],
draftMode
:
modes
.
DraftMode
.
NotSupported
});
thread
.
dispose
();
}
...
...
@@ -284,9 +299,15 @@ export class MainThreadComments extends Disposable implements MainThreadComments
}
$registerCommentControl
(
handle
:
number
,
id
:
string
,
label
:
string
):
void
{
const
provider
=
new
MainThreadCommentControl
(
this
.
_proxy
,
handle
,
id
,
label
);
const
provider
=
new
MainThreadCommentControl
(
this
.
_proxy
,
this
.
_commentService
,
handle
,
id
,
label
);
this
.
_commentService
.
registerCommentControl
(
String
(
handle
),
provider
);
this
.
_commentControls
.
set
(
handle
,
provider
);
const
commentsPanelAlreadyConstructed
=
this
.
_panelService
.
getPanels
().
some
(
panel
=>
panel
.
id
===
COMMENTS_PANEL_ID
);
if
(
!
commentsPanelAlreadyConstructed
)
{
this
.
registerPanel
(
commentsPanelAlreadyConstructed
);
}
this
.
_commentService
.
setWorkspaceComments
(
String
(
handle
),
[]);
}
$createCommentThread
(
handle
:
number
,
commentThreadHandle
:
number
,
threadId
:
string
,
resource
:
UriComponents
,
range
:
IRange
,
comments
:
modes
.
Comment
[],
commands
:
modes
.
Command
[],
collapseState
:
modes
.
CommentThreadCollapsibleState
):
modes
.
CommentThread2
|
undefined
{
...
...
@@ -350,6 +371,18 @@ export class MainThreadComments extends Disposable implements MainThreadComments
this
.
_commentService
.
registerDataProvider
(
providerId
,
handler
);
}
private
registerPanel
(
commentsPanelAlreadyConstructed
:
boolean
)
{
if
(
!
commentsPanelAlreadyConstructed
)
{
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
).
registerPanel
(
new
PanelDescriptor
(
CommentsPanel
,
COMMENTS_PANEL_ID
,
COMMENTS_PANEL_TITLE
,
'
commentsPanel
'
,
10
));
}
}
/**
* If the comments panel has never been opened, the constructor for it has not yet run so it has
* no listeners for comment threads being set or updated. Listen for the panel opening for the
...
...
@@ -383,13 +416,9 @@ export class MainThreadComments extends Disposable implements MainThreadComments
this
.
_handlers
.
set
(
handle
,
providerId
);
const
commentsPanelAlreadyConstructed
=
this
.
_panelService
.
getPanels
().
some
(
panel
=>
panel
.
id
===
COMMENTS_PANEL_ID
);
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
).
registerPanel
(
new
PanelDescriptor
(
CommentsPanel
,
COMMENTS_PANEL_ID
,
COMMENTS_PANEL_TITLE
,
'
commentsPanel
'
,
10
));
if
(
!
commentsPanelAlreadyConstructed
)
{
this
.
registerPanel
(
commentsPanelAlreadyConstructed
);
}
const
openPanel
=
this
.
_configurationService
.
getValue
<
ICommentsConfiguration
>
(
'
comments
'
).
openPanel
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录