Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c2bdd6a8
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,发现更多精彩内容 >>
提交
c2bdd6a8
编写于
9月 28, 2016
作者:
P
Pine Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor and put id as property of TreeContentProvider
上级
aa1ffcd8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
112 addition
and
4 deletion
+112
-4
src/vs/platform/actions/browser/menusExtensionPoint.ts
src/vs/platform/actions/browser/menusExtensionPoint.ts
+3
-3
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+18
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+3
-0
src/vs/workbench/api/node/extHost.contribution.ts
src/vs/workbench/api/node/extHost.contribution.ts
+2
-0
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+11
-0
src/vs/workbench/api/node/extHostExplorers.ts
src/vs/workbench/api/node/extHostExplorers.ts
+51
-0
src/vs/workbench/api/node/mainThreadDocuments.ts
src/vs/workbench/api/node/mainThreadDocuments.ts
+1
-0
src/vs/workbench/api/node/mainThreadExplorers.ts
src/vs/workbench/api/node/mainThreadExplorers.ts
+22
-0
src/vs/workbench/parts/explorers/browser/media/treeExplorerViewlet.contribution.css
...lorers/browser/media/treeExplorerViewlet.contribution.css
+1
-1
未找到文件。
src/vs/platform/actions/browser/menusExtensionPoint.ts
浏览文件 @
c2bdd6a8
...
...
@@ -340,9 +340,9 @@ ExtensionsRegistry.registerExtensionPoint<schema.IExplorer>('explorer', schema.e
Registry
.
as
<
ViewletRegistry
>
(
ViewletExtensions
.
Viewlets
).
registerViewlet
(
new
ViewletDescriptor
(
'
vs/workbench/parts/explorers/browser/treeExplorerViewlet
'
,
'
TreeExplorerViewlet
'
,
'
workbench.view.
treeExplorer
'
,
// Later change this to make it unique
localize
(
'
treeExplorer
'
,
'
treeExplorer
'
)
,
'
treeExplorer
'
,
'
workbench.view.
customViewlet.
'
+
treeContentProviderId
,
treeContentProviderId
,
treeContentProviderId
,
125
));
}
...
...
src/vs/vscode.d.ts
浏览文件 @
c2bdd6a8
...
...
@@ -1348,6 +1348,22 @@ declare module 'vscode' {
provideTextDocumentContent
(
uri
:
Uri
,
token
:
CancellationToken
):
string
|
Thenable
<
string
>
;
}
export
interface
TreeContentProvider
{
id
:
string
;
provideTreeContent
():
ITree
;
}
export
interface
ITree
{
root
:
ITreeNode
;
}
export
interface
ITreeNode
{
label
:
string
;
isExpanded
:
boolean
;
parent
:
ITreeNode
;
children
:
ITreeNode
[]
}
/**
* Represents an item that can be selected from
* a list of items.
...
...
@@ -3803,6 +3819,8 @@ declare module 'vscode' {
*/
export
function
registerTextDocumentContentProvider
(
scheme
:
string
,
provider
:
TextDocumentContentProvider
):
Disposable
;
export
function
registerTreeContentProvider
(
provider
:
TreeContentProvider
):
Disposable
;
/**
* An event that is emitted when a [text document](#TextDocument) is opened.
*/
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
c2bdd6a8
...
...
@@ -12,11 +12,13 @@ import { IThreadService } from 'vs/workbench/services/thread/common/threadServic
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
product
from
'
vs/platform/product
'
;
import
pkg
from
'
vs/platform/package
'
;
import
{
ExtHostFileSystemEventService
}
from
'
vs/workbench/api/node/extHostFileSystemEventService
'
;
import
{
ExtHostDocuments
}
from
'
vs/workbench/api/node/extHostDocuments
'
;
import
{
ExtHostDocumentSaveParticipant
}
from
'
vs/workbench/api/node/extHostDocumentSaveParticipant
'
;
import
{
ExtHostConfiguration
}
from
'
vs/workbench/api/node/extHostConfiguration
'
;
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/node/extHostDiagnostics
'
;
import
{
ExtHostExplorers
}
from
'
vs/workbench/api/node/extHostExplorers
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/node/extHostWorkspace
'
;
import
{
ExtHostQuickOpen
}
from
'
vs/workbench/api/node/extHostQuickOpen
'
;
import
{
ExtHostHeapService
}
from
'
vs/workbench/api/node/extHostHeapService
'
;
...
...
@@ -64,6 +66,7 @@ export function createApiFactory(threadService: IThreadService, extensionService
const
extHostDocuments
=
col
.
define
(
ExtHostContext
.
ExtHostDocuments
).
set
<
ExtHostDocuments
>
(
new
ExtHostDocuments
(
threadService
));
const
extHostDocumentSaveParticipant
=
col
.
define
(
ExtHostContext
.
ExtHostDocumentSaveParticipant
).
set
<
ExtHostDocumentSaveParticipant
>
(
new
ExtHostDocumentSaveParticipant
(
extHostDocuments
,
threadService
.
get
(
MainContext
.
MainThreadWorkspace
)));
const
extHostEditors
=
col
.
define
(
ExtHostContext
.
ExtHostEditors
).
set
<
ExtHostEditors
>
(
new
ExtHostEditors
(
threadService
,
extHostDocuments
));
const
extHostExplorers
=
col
.
define
(
ExtHostContext
.
ExtHostExplorers
).
set
<
ExtHostExplorers
>
(
new
ExtHostExplorers
(
threadService
));
const
extHostCommands
=
col
.
define
(
ExtHostContext
.
ExtHostCommands
).
set
<
ExtHostCommands
>
(
new
ExtHostCommands
(
threadService
,
extHostEditors
,
extHostHeapService
));
const
extHostConfiguration
=
col
.
define
(
ExtHostContext
.
ExtHostConfiguration
).
set
<
ExtHostConfiguration
>
(
new
ExtHostConfiguration
(
threadService
.
get
(
MainContext
.
MainThreadConfiguration
)));
const
extHostDiagnostics
=
col
.
define
(
ExtHostContext
.
ExtHostDiagnostics
).
set
<
ExtHostDiagnostics
>
(
new
ExtHostDiagnostics
(
threadService
));
...
...
src/vs/workbench/api/node/extHost.contribution.ts
浏览文件 @
c2bdd6a8
...
...
@@ -20,6 +20,7 @@ import { MainThreadDiagnostics } from './mainThreadDiagnostics';
import
{
MainThreadDocuments
}
from
'
./mainThreadDocuments
'
;
import
{
MainThreadEditors
}
from
'
./mainThreadEditors
'
;
import
{
MainThreadErrors
}
from
'
./mainThreadErrors
'
;
import
{
MainThreadExplorers
}
from
'
./mainThreadExplorers
'
;
import
{
MainThreadLanguageFeatures
}
from
'
./mainThreadLanguageFeatures
'
;
import
{
MainThreadLanguages
}
from
'
./mainThreadLanguages
'
;
import
{
MainThreadMessageService
}
from
'
./mainThreadMessageService
'
;
...
...
@@ -70,6 +71,7 @@ export class ExtHostContribution implements IWorkbenchContribution {
col
.
define
(
MainContext
.
MainThreadDocuments
).
set
(
create
(
MainThreadDocuments
));
col
.
define
(
MainContext
.
MainThreadEditors
).
set
(
create
(
MainThreadEditors
));
col
.
define
(
MainContext
.
MainThreadErrors
).
set
(
create
(
MainThreadErrors
));
col
.
define
(
MainContext
.
MainThreadExplorers
).
set
(
create
(
MainThreadExplorers
));
col
.
define
(
MainContext
.
MainThreadLanguageFeatures
).
set
(
create
(
MainThreadLanguageFeatures
));
col
.
define
(
MainContext
.
MainThreadLanguages
).
set
(
create
(
MainThreadLanguages
));
col
.
define
(
MainContext
.
MainThreadMessageService
).
set
(
create
(
MainThreadMessageService
));
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
c2bdd6a8
...
...
@@ -115,6 +115,11 @@ export abstract class MainThreadEditorsShape {
$tryApplyEdits
(
id
:
string
,
modelVersionId
:
number
,
edits
:
editorCommon
.
ISingleEditOperation
[],
opts
:
IApplyEditsOptions
):
TPromise
<
boolean
>
{
throw
ni
();
}
}
export
abstract
class
MainThreadExplorersShape
{
$registerTreeContentProvider
(
treeContentProviderId
:
string
):
void
{
throw
ni
();
}
$unregisterTreeContentProvider
(
treeContentProviderId
:
string
):
void
{
throw
ni
();
}
}
export
abstract
class
MainThreadErrorsShape
{
onUnexpectedExtHostError
(
err
:
any
):
void
{
throw
ni
();
}
}
...
...
@@ -257,6 +262,10 @@ export abstract class ExtHostEditorsShape {
$acceptTextEditorRemove
(
id
:
string
):
void
{
throw
ni
();
}
}
export
abstract
class
ExtHostExplorersShape
{
$provideTextDocumentContent
(
treeContentProviderId
:
string
):
vscode
.
ITree
{
throw
ni
();
};
}
export
abstract
class
ExtHostExtensionServiceShape
{
$localShowMessage
(
severity
:
Severity
,
msg
:
string
):
void
{
throw
ni
();
}
$activateExtension
(
extensionDescription
:
IExtensionDescription
):
TPromise
<
void
>
{
throw
ni
();
}
...
...
@@ -331,6 +340,7 @@ export const MainContext = {
MainThreadDocuments
:
createMainId
<
MainThreadDocumentsShape
>
(
'
MainThreadDocuments
'
,
MainThreadDocumentsShape
),
MainThreadEditors
:
createMainId
<
MainThreadEditorsShape
>
(
'
MainThreadEditors
'
,
MainThreadEditorsShape
),
MainThreadErrors
:
createMainId
<
MainThreadErrorsShape
>
(
'
MainThreadErrors
'
,
MainThreadErrorsShape
),
MainThreadExplorers
:
createMainId
<
MainThreadExplorersShape
>
(
'
MainThreadExplorers
'
,
MainThreadExplorersShape
),
MainThreadLanguageFeatures
:
createMainId
<
MainThreadLanguageFeaturesShape
>
(
'
MainThreadLanguageFeatures
'
,
MainThreadLanguageFeaturesShape
),
MainThreadLanguages
:
createMainId
<
MainThreadLanguagesShape
>
(
'
MainThreadLanguages
'
,
MainThreadLanguagesShape
),
MainThreadMessageService
:
createMainId
<
MainThreadMessageServiceShape
>
(
'
MainThreadMessageService
'
,
MainThreadMessageServiceShape
),
...
...
@@ -351,6 +361,7 @@ export const ExtHostContext = {
ExtHostDocuments
:
createExtId
<
ExtHostDocumentsShape
>
(
'
ExtHostDocuments
'
,
ExtHostDocumentsShape
),
ExtHostDocumentSaveParticipant
:
createExtId
<
ExtHostDocumentSaveParticipantShape
>
(
'
ExtHostDocumentSaveParticipant
'
,
ExtHostDocumentSaveParticipantShape
),
ExtHostEditors
:
createExtId
<
ExtHostEditorsShape
>
(
'
ExtHostEditors
'
,
ExtHostEditorsShape
),
ExtHostExplorers
:
createExtId
<
ExtHostExplorersShape
>
(
'
ExtHostExplorers
'
,
ExtHostExplorersShape
),
ExtHostFileSystemEventService
:
createExtId
<
ExtHostFileSystemEventServiceShape
>
(
'
ExtHostFileSystemEventService
'
,
ExtHostFileSystemEventServiceShape
),
ExtHostHeapService
:
createExtId
<
ExtHostHeapServiceShape
>
(
'
ExtHostHeapMonitor
'
,
ExtHostHeapServiceShape
),
ExtHostLanguageFeatures
:
createExtId
<
ExtHostLanguageFeaturesShape
>
(
'
ExtHostLanguageFeatures
'
,
ExtHostLanguageFeaturesShape
),
...
...
src/vs/workbench/api/node/extHostExplorers.ts
0 → 100644
浏览文件 @
c2bdd6a8
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Disposable
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
ExtHostExplorersShape
,
MainThreadExplorersShape
}
from
'
./extHost.protocol
'
;
export
class
ExtHostExplorers
extends
ExtHostExplorersShape
{
private
_proxy
:
MainThreadExplorersShape
;
private
_treeContentProviders
:
{
[
treeContentProviderId
:
string
]:
vscode
.
TreeContentProvider
;
};
constructor
(
threadService
:
IThreadService
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadExplorers
);
this
.
_treeContentProviders
=
Object
.
create
(
null
);
}
public
registerTreeContentProvider
(
provider
:
vscode
.
TreeContentProvider
):
vscode
.
Disposable
{
const
treeContentProviderId
=
provider
.
id
;
if
(
this
.
_treeContentProviders
[
treeContentProviderId
])
{
throw
new
Error
(
`TreeContentProvider with id '
${
provider
.
id
}
already registered`
);
}
this
.
_treeContentProviders
[
treeContentProviderId
]
=
provider
;
this
.
_proxy
.
$registerTreeContentProvider
(
treeContentProviderId
);
return
new
Disposable
(()
=>
{
if
(
delete
this
.
_treeContentProviders
[
treeContentProviderId
])
{
this
.
_proxy
.
$unregisterTreeContentProvider
(
treeContentProviderId
);
}
});
}
$provideTextDocumentContent
(
treeContentProviderId
:
string
):
vscode
.
ITree
{
const
provider
=
this
.
_treeContentProviders
[
treeContentProviderId
];
if
(
!
provider
)
{
throw
new
Error
(
`no TreeContentProvider registered with id '
${
treeContentProviderId
}
'`
);
}
return
provider
.
provideTreeContent
();
}
}
src/vs/workbench/api/node/mainThreadDocuments.ts
浏览文件 @
c2bdd6a8
...
...
@@ -264,4 +264,5 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
}
},
onUnexpectedError
);
}
}
src/vs/workbench/api/node/mainThreadExplorers.ts
0 → 100644
浏览文件 @
c2bdd6a8
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ExtHostContext
,
MainThreadExplorersShape
,
ExtHostExplorersShape
}
from
'
./extHost.protocol
'
;
export
class
MainThreadExplorers
extends
MainThreadExplorersShape
{
private
_proxy
:
ExtHostExplorersShape
;
constructor
(
@
IThreadService
threadService
:
IThreadService
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
ExtHostContext
.
ExtHostExplorers
);
}
$registerTreeContentProvider
(
treeContentProviderId
:
string
):
void
{
const
tree
=
this
.
_proxy
.
$provideTextDocumentContent
(
treeContentProviderId
);
}
$unregisterTreeContentProvider
(
treeContentProviderId
:
string
):
void
{
}
}
\ No newline at end of file
src/vs/workbench/parts/explorers/browser/media/treeExplorerViewlet.contribution.css
浏览文件 @
c2bdd6a8
...
...
@@ -4,6 +4,6 @@
*--------------------------------------------------------------------------------------------*/
/* Activity Bar */
.monaco-workbench
>
.activitybar
.monaco-action-bar
.action-label.
treeExplorer
{
.monaco-workbench
>
.activitybar
.monaco-action-bar
.action-label.
pineTree
{
background-image
:
url('files-dark.svg')
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录