Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
eaa2d3bb
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,发现更多精彩内容 >>
提交
eaa2d3bb
编写于
7月 01, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
introduce extHostLabelService and mainThreadLabelService
fixes #75881
上级
82d951bb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
78 addition
and
28 deletion
+78
-28
src/vs/workbench/api/browser/extensionHost.contribution.ts
src/vs/workbench/api/browser/extensionHost.contribution.ts
+1
-0
src/vs/workbench/api/browser/mainThreadFileSystem.ts
src/vs/workbench/api/browser/mainThreadFileSystem.ts
+0
-15
src/vs/workbench/api/browser/mainThreadLabelService.ts
src/vs/workbench/api/browser/mainThreadLabelService.ts
+36
-0
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+11
-2
src/vs/workbench/api/common/extHostFileSystem.ts
src/vs/workbench/api/common/extHostFileSystem.ts
+0
-10
src/vs/workbench/api/common/extHostLabelService.ts
src/vs/workbench/api/common/extHostLabelService.ts
+27
-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/browser/extensionHost.contribution.ts
浏览文件 @
eaa2d3bb
...
...
@@ -54,6 +54,7 @@ import './mainThreadWebview';
import
'
./mainThreadWorkspace
'
;
import
'
./mainThreadComments
'
;
import
'
./mainThreadTask
'
;
import
'
./mainThreadLabelService
'
;
import
'
vs/workbench/api/common/apiCommands
'
;
export
class
ExtensionPoints
implements
IWorkbenchContribution
{
...
...
src/vs/workbench/api/browser/mainThreadFileSystem.ts
浏览文件 @
eaa2d3bb
...
...
@@ -9,7 +9,6 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import
{
FileWriteOptions
,
FileSystemProviderCapabilities
,
IFileChange
,
IFileService
,
IFileSystemProvider
,
IStat
,
IWatchOptions
,
FileType
,
FileOverwriteOptions
,
FileDeleteOptions
,
FileOpenOptions
,
IFileStat
}
from
'
vs/platform/files/common/files
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
ExtHostContext
,
ExtHostFileSystemShape
,
IExtHostContext
,
IFileChangeDto
,
MainContext
,
MainThreadFileSystemShape
}
from
'
../common/extHost.protocol
'
;
import
{
ResourceLabelFormatter
,
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadFileSystem
)
...
...
@@ -17,12 +16,10 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
private
readonly
_proxy
:
ExtHostFileSystemShape
;
private
readonly
_fileProvider
=
new
Map
<
number
,
RemoteFileSystemProvider
>
();
private
readonly
_resourceLabelFormatters
=
new
Map
<
number
,
IDisposable
>
();
constructor
(
extHostContext
:
IExtHostContext
,
@
IFileService
private
readonly
_fileService
:
IFileService
,
@
ILabelService
private
readonly
_labelService
:
ILabelService
)
{
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostFileSystem
);
}
...
...
@@ -41,18 +38,6 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
this
.
_fileProvider
.
delete
(
handle
);
}
$registerResourceLabelFormatter
(
handle
:
number
,
formatter
:
ResourceLabelFormatter
):
void
{
// Dynamicily registered formatters should have priority over those contributed via package.json
formatter
.
priority
=
true
;
const
disposable
=
this
.
_labelService
.
registerFormatter
(
formatter
);
this
.
_resourceLabelFormatters
.
set
(
handle
,
disposable
);
}
$unregisterResourceLabelFormatter
(
handle
:
number
):
void
{
dispose
(
this
.
_resourceLabelFormatters
.
get
(
handle
));
this
.
_resourceLabelFormatters
.
delete
(
handle
);
}
$onFileSystemChange
(
handle
:
number
,
changes
:
IFileChangeDto
[]):
void
{
const
fileProvider
=
this
.
_fileProvider
.
get
(
handle
);
if
(
!
fileProvider
)
{
...
...
src/vs/workbench/api/browser/mainThreadLabelService.ts
0 → 100644
浏览文件 @
eaa2d3bb
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
MainContext
,
MainThreadLabelServiceShape
,
IExtHostContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
ResourceLabelFormatter
,
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadLabelService
)
export
class
MainThreadLabelService
implements
MainThreadLabelServiceShape
{
private
readonly
_resourceLabelFormatters
=
new
Map
<
number
,
IDisposable
>
();
constructor
(
_
:
IExtHostContext
,
@
ILabelService
private
readonly
_labelService
:
ILabelService
)
{
}
$registerResourceLabelFormatter
(
handle
:
number
,
formatter
:
ResourceLabelFormatter
):
void
{
// Dynamicily registered formatters should have priority over those contributed via package.json
formatter
.
priority
=
true
;
const
disposable
=
this
.
_labelService
.
registerFormatter
(
formatter
);
this
.
_resourceLabelFormatters
.
set
(
handle
,
disposable
);
}
$unregisterResourceLabelFormatter
(
handle
:
number
):
void
{
dispose
(
this
.
_resourceLabelFormatters
.
get
(
handle
));
this
.
_resourceLabelFormatters
.
delete
(
handle
);
}
dispose
():
void
{
// noop
}
}
\ No newline at end of file
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
eaa2d3bb
...
...
@@ -592,8 +592,6 @@ export interface IFileChangeDto {
export
interface
MainThreadFileSystemShape
extends
IDisposable
{
$registerFileSystemProvider
(
handle
:
number
,
scheme
:
string
,
capabilities
:
files
.
FileSystemProviderCapabilities
):
void
;
$unregisterProvider
(
handle
:
number
):
void
;
$registerResourceLabelFormatter
(
handle
:
number
,
formatter
:
ResourceLabelFormatter
):
void
;
$unregisterResourceLabelFormatter
(
handle
:
number
):
void
;
$onFileSystemChange
(
handle
:
number
,
resource
:
IFileChangeDto
[]):
void
;
$stat
(
uri
:
UriComponents
):
Promise
<
files
.
IStat
>
;
...
...
@@ -606,6 +604,11 @@ export interface MainThreadFileSystemShape extends IDisposable {
$delete
(
resource
:
UriComponents
,
opts
:
files
.
FileDeleteOptions
):
Promise
<
void
>
;
}
export
interface
MainThreadLabelServiceShape
extends
IDisposable
{
$registerResourceLabelFormatter
(
handle
:
number
,
formatter
:
ResourceLabelFormatter
):
void
;
$unregisterResourceLabelFormatter
(
handle
:
number
):
void
;
}
export
interface
MainThreadSearchShape
extends
IDisposable
{
$registerFileSearchProvider
(
handle
:
number
,
scheme
:
string
):
void
;
$registerTextSearchProvider
(
handle
:
number
,
scheme
:
string
):
void
;
...
...
@@ -832,6 +835,10 @@ export interface ExtHostFileSystemShape {
$write
(
handle
:
number
,
fd
:
number
,
pos
:
number
,
data
:
VSBuffer
):
Promise
<
number
>
;
}
export
interface
ExtHostLabelServiceShape
{
$registerResourceLabelFormatter
(
formatter
:
ResourceLabelFormatter
):
IDisposable
;
}
export
interface
ExtHostSearchShape
{
$provideFileSearchResults
(
handle
:
number
,
session
:
number
,
query
:
search
.
IRawQuery
,
token
:
CancellationToken
):
Promise
<
search
.
ISearchCompleteStats
>
;
$provideTextSearchResults
(
handle
:
number
,
session
:
number
,
query
:
search
.
IRawTextQuery
,
token
:
CancellationToken
):
Promise
<
search
.
ISearchCompleteStats
>
;
...
...
@@ -1331,6 +1338,7 @@ export const MainContext = {
MainThreadSearch
:
createMainId
<
MainThreadSearchShape
>
(
'
MainThreadSearch
'
),
MainThreadTask
:
createMainId
<
MainThreadTaskShape
>
(
'
MainThreadTask
'
),
MainThreadWindow
:
createMainId
<
MainThreadWindowShape
>
(
'
MainThreadWindow
'
),
MainThreadLabelService
:
createMainId
<
MainThreadLabelServiceShape
>
(
'
MainThreadLabelService
'
)
};
export
const
ExtHostContext
=
{
...
...
@@ -1364,4 +1372,5 @@ export const ExtHostContext = {
ExtHostStorage
:
createMainId
<
ExtHostStorageShape
>
(
'
ExtHostStorage
'
),
ExtHostUrls
:
createExtId
<
ExtHostUrlsShape
>
(
'
ExtHostUrls
'
),
ExtHostOutputService
:
createMainId
<
ExtHostOutputServiceShape
>
(
'
ExtHostOutputService
'
),
ExtHosLabelService
:
createMainId
<
ExtHostLabelServiceShape
>
(
'
ExtHostLabelService
'
)
};
src/vs/workbench/api/common/extHostFileSystem.ts
浏览文件 @
eaa2d3bb
...
...
@@ -12,7 +12,6 @@ import { FileChangeType } from 'vs/workbench/api/common/extHostTypes';
import
*
as
typeConverter
from
'
vs/workbench/api/common/extHostTypeConverters
'
;
import
{
ExtHostLanguageFeatures
}
from
'
vs/workbench/api/common/extHostLanguageFeatures
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
ResourceLabelFormatter
}
from
'
vs/platform/label/common/label
'
;
import
{
State
,
StateMachine
,
LinkComputer
,
Edge
}
from
'
vs/editor/common/modes/linkComputer
'
;
import
{
commonPrefixLength
}
from
'
vs/base/common/strings
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
...
...
@@ -241,15 +240,6 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
});
}
registerResourceLabelFormatter
(
formatter
:
ResourceLabelFormatter
):
IDisposable
{
const
handle
=
this
.
_handlePool
++
;
this
.
_proxy
.
$registerResourceLabelFormatter
(
handle
,
formatter
);
return
toDisposable
(()
=>
{
this
.
_proxy
.
$unregisterResourceLabelFormatter
(
handle
);
});
}
private
static
_asIStat
(
stat
:
vscode
.
FileStat
):
files
.
IStat
{
const
{
type
,
ctime
,
mtime
,
size
}
=
stat
;
return
{
type
,
ctime
,
mtime
,
size
};
...
...
src/vs/workbench/api/common/extHostLabelService.ts
0 → 100644
浏览文件 @
eaa2d3bb
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ResourceLabelFormatter
}
from
'
vs/platform/label/common/label
'
;
import
{
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
MainThreadLabelServiceShape
,
ExtHostLabelServiceShape
,
MainContext
,
IMainContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
export
class
ExtHostLabelService
implements
ExtHostLabelServiceShape
{
private
readonly
_proxy
:
MainThreadLabelServiceShape
;
private
_handlePool
:
number
=
0
;
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadLabelService
);
}
$registerResourceLabelFormatter
(
formatter
:
ResourceLabelFormatter
):
IDisposable
{
const
handle
=
this
.
_handlePool
++
;
this
.
_proxy
.
$registerResourceLabelFormatter
(
handle
,
formatter
);
return
toDisposable
(()
=>
{
this
.
_proxy
.
$unregisterResourceLabelFormatter
(
handle
);
});
}
}
\ No newline at end of file
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
eaa2d3bb
...
...
@@ -67,6 +67,7 @@ import { values } from 'vs/base/common/collections';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
ExtHostEditorInsets
}
from
'
vs/workbench/api/common/extHostCodeInsets
'
;
import
{
ExtHostLabelService
}
from
'
vs/workbench/api/common/extHostLabelService
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
,
registry
:
ExtensionDescriptionRegistry
,
configProvider
:
ExtHostConfigProvider
):
typeof
vscode
;
...
...
@@ -125,6 +126,7 @@ export function createApiFactory(
const
extHostProgress
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostProgress
,
new
ExtHostProgress
(
rpcProtocol
.
getProxy
(
MainContext
.
MainThreadProgress
)));
const
extHostOutputService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostOutputService
,
new
ExtHostOutputService
(
LogOutputChannelFactory
,
initData
.
logsLocation
,
rpcProtocol
));
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostStorage
,
extHostStorage
);
const
extHostLabelService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHosLabelService
,
new
ExtHostLabelService
(
rpcProtocol
));
if
(
initData
.
remote
.
isRemote
&&
initData
.
remote
.
authority
)
{
extHostTask
.
registerTaskSystem
(
Schemas
.
vscodeRemote
,
{
...
...
@@ -694,7 +696,7 @@ export function createApiFactory(
return
extensionService
.
registerRemoteAuthorityResolver
(
authorityPrefix
,
resolver
);
}),
registerResourceLabelFormatter
:
proposedApiFunction
(
extension
,
(
formatter
:
vscode
.
ResourceLabelFormatter
)
=>
{
return
extHost
FileSystem
.
registerResourceLabelFormatter
(
formatter
);
return
extHost
LabelService
.
$
registerResourceLabelFormatter
(
formatter
);
}),
onDidRenameFile
:
proposedApiFunction
(
extension
,
(
listener
:
(
e
:
vscode
.
FileRenameEvent
)
=>
any
,
thisArg
?:
any
,
disposables
?:
vscode
.
Disposable
[])
=>
{
return
extHostFileSystemEvent
.
onDidRenameFile
(
listener
,
thisArg
,
disposables
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录