Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
50416be1
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,体验更适合开发者的 AI 搜索 >>
提交
50416be1
编写于
11月 10, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#110241 Adopt TernarySearchTree.forUris2
上级
70656750
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
151 addition
and
87 deletion
+151
-87
src/vs/base/common/resources.ts
src/vs/base/common/resources.ts
+0
-29
src/vs/editor/contrib/snippet/test/snippetVariables.test.ts
src/vs/editor/contrib/snippet/test/snippetVariables.test.ts
+2
-1
src/vs/platform/configuration/test/common/configurationModels.test.ts
...orm/configuration/test/common/configurationModels.test.ts
+2
-1
src/vs/platform/workspace/common/workspace.ts
src/vs/platform/workspace/common/workspace.ts
+6
-4
src/vs/platform/workspace/test/common/testWorkspace.ts
src/vs/platform/workspace/test/common/testWorkspace.ts
+13
-2
src/vs/platform/workspace/test/common/workspace.test.ts
src/vs/platform/workspace/test/common/workspace.test.ts
+6
-6
src/vs/workbench/api/common/extHostWorkspace.ts
src/vs/workbench/api/common/extHostWorkspace.ts
+19
-9
src/vs/workbench/browser/web.main.ts
src/vs/workbench/browser/web.main.ts
+9
-3
src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts
...ontrib/backup/test/electron-browser/backupTracker.test.ts
+2
-1
src/vs/workbench/contrib/markers/browser/markersFilterOptions.ts
...workbench/contrib/markers/browser/markersFilterOptions.ts
+45
-5
src/vs/workbench/contrib/markers/browser/markersView.ts
src/vs/workbench/contrib/markers/browser/markersView.ts
+4
-2
src/vs/workbench/contrib/search/test/browser/queryBuilder.test.ts
...orkbench/contrib/search/test/browser/queryBuilder.test.ts
+2
-1
src/vs/workbench/contrib/search/test/electron-browser/queryBuilder.test.ts
...contrib/search/test/electron-browser/queryBuilder.test.ts
+2
-1
src/vs/workbench/contrib/tasks/test/common/configuration.test.ts
...workbench/contrib/tasks/test/common/configuration.test.ts
+2
-1
src/vs/workbench/electron-browser/desktop.main.ts
src/vs/workbench/electron-browser/desktop.main.ts
+8
-3
src/vs/workbench/services/configuration/browser/configurationService.ts
...ch/services/configuration/browser/configurationService.ts
+7
-3
src/vs/workbench/services/configuration/test/common/configurationModels.test.ts
...ces/configuration/test/common/configurationModels.test.ts
+2
-1
src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts
...test/electron-browser/configurationEditingService.test.ts
+2
-1
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
...ration/test/electron-browser/configurationService.test.ts
+9
-8
src/vs/workbench/services/label/test/browser/label.test.ts
src/vs/workbench/services/label/test/browser/label.test.ts
+2
-1
src/vs/workbench/test/browser/api/extHostConfiguration.test.ts
...s/workbench/test/browser/api/extHostConfiguration.test.ts
+2
-1
src/vs/workbench/test/browser/api/extHostWorkspace.test.ts
src/vs/workbench/test/browser/api/extHostWorkspace.test.ts
+3
-1
src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts
...rkbench/test/browser/parts/editor/breadcrumbModel.test.ts
+2
-1
src/vs/workbench/workbench.common.main.ts
src/vs/workbench/workbench.common.main.ts
+0
-1
未找到文件。
src/vs/base/common/resources.ts
浏览文件 @
50416be1
...
...
@@ -10,8 +10,6 @@ import { equalsIgnoreCase, compare as strCompare } from 'vs/base/common/strings'
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
isWindows
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
ParsedExpression
,
IExpression
,
parse
}
from
'
vs/base/common/glob
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
export
function
originalFSPath
(
uri
:
URI
):
string
{
return
uriToFsPath
(
uri
,
true
);
...
...
@@ -436,33 +434,6 @@ export namespace DataUri {
}
}
export
class
ResourceGlobMatcher
{
private
readonly
globalExpression
:
ParsedExpression
;
private
readonly
expressionsByRoot
:
TernarySearchTree
<
URI
,
{
root
:
URI
,
expression
:
ParsedExpression
}
>
=
TernarySearchTree
.
forUris
<
{
root
:
URI
,
expression
:
ParsedExpression
}
>
();
constructor
(
globalExpression
:
IExpression
,
rootExpressions
:
{
root
:
URI
,
expression
:
IExpression
}[]
)
{
this
.
globalExpression
=
parse
(
globalExpression
);
for
(
const
expression
of
rootExpressions
)
{
this
.
expressionsByRoot
.
set
(
expression
.
root
,
{
root
:
expression
.
root
,
expression
:
parse
(
expression
.
expression
)
});
}
}
matches
(
resource
:
URI
):
boolean
{
const
rootExpression
=
this
.
expressionsByRoot
.
findSubstr
(
resource
);
if
(
rootExpression
)
{
const
path
=
relativePath
(
rootExpression
.
root
,
resource
);
if
(
path
&&
!!
rootExpression
.
expression
(
path
))
{
return
true
;
}
}
return
!!
this
.
globalExpression
(
resource
.
path
);
}
}
export
function
toLocalResource
(
resource
:
URI
,
authority
:
string
|
undefined
,
localScheme
:
string
):
URI
{
if
(
authority
)
{
let
path
=
resource
.
path
;
...
...
src/vs/editor/contrib/snippet/test/snippetVariables.test.ts
浏览文件 @
50416be1
...
...
@@ -9,10 +9,11 @@ import { Selection } from 'vs/editor/common/core/selection';
import
{
SelectionBasedVariableResolver
,
CompositeSnippetVariableResolver
,
ModelBasedVariableResolver
,
ClipboardBasedVariableResolver
,
TimeBasedVariableResolver
,
WorkspaceBasedVariableResolver
}
from
'
vs/editor/contrib/snippet/snippetVariables
'
;
import
{
SnippetParser
,
Variable
,
VariableResolver
}
from
'
vs/editor/contrib/snippet/snippetParser
'
;
import
{
TextModel
}
from
'
vs/editor/common/model/textModel
'
;
import
{
Workspace
,
toWorkspaceFolders
,
IWorkspace
,
IWorkspaceContextService
,
toWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
toWorkspaceFolders
,
IWorkspace
,
IWorkspaceContextService
,
toWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
mock
}
from
'
vs/base/test/common/mock
'
;
import
{
createTextModel
}
from
'
vs/editor/test/common/editorTestUtils
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
suite
(
'
Snippet Variables Resolver
'
,
function
()
{
...
...
src/vs/platform/configuration/test/common/configurationModels.test.ts
浏览文件 @
50416be1
...
...
@@ -7,9 +7,10 @@ import { ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent
import
{
Extensions
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Workspace
,
Workspace
Folder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
suite
(
'
ConfigurationModel
'
,
()
=>
{
...
...
src/vs/platform/workspace/common/workspace.ts
浏览文件 @
50416be1
...
...
@@ -144,13 +144,14 @@ export interface IWorkspaceFolder extends IWorkspaceFolderData {
export
class
Workspace
implements
IWorkspace
{
private
_foldersMap
:
TernarySearchTree
<
URI
,
WorkspaceFolder
>
=
TernarySearchTree
.
forUris
<
WorkspaceFolder
>
(
);
private
_foldersMap
:
TernarySearchTree
<
URI
,
WorkspaceFolder
>
=
TernarySearchTree
.
forUris
2
<
WorkspaceFolder
>
(
this
.
_ignorePathCasing
);
private
_folders
!
:
WorkspaceFolder
[];
constructor
(
private
_id
:
string
,
folders
:
WorkspaceFolder
[]
=
[],
private
_configuration
:
URI
|
null
=
null
folders
:
WorkspaceFolder
[],
private
_configuration
:
URI
|
null
,
private
_ignorePathCasing
:
(
key
:
URI
)
=>
boolean
,
)
{
this
.
folders
=
folders
;
}
...
...
@@ -158,6 +159,7 @@ export class Workspace implements IWorkspace {
update
(
workspace
:
Workspace
)
{
this
.
_id
=
workspace
.
id
;
this
.
_configuration
=
workspace
.
configuration
;
this
.
_ignorePathCasing
=
workspace
.
_ignorePathCasing
;
this
.
folders
=
workspace
.
folders
;
}
...
...
@@ -195,7 +197,7 @@ export class Workspace implements IWorkspace {
}
private
updateFoldersMap
():
void
{
this
.
_foldersMap
=
TernarySearchTree
.
forUris
<
WorkspaceFolder
>
(
);
this
.
_foldersMap
=
TernarySearchTree
.
forUris
2
<
WorkspaceFolder
>
(
this
.
_ignorePathCasing
);
for
(
const
folder
of
this
.
folders
)
{
this
.
_foldersMap
.
set
(
folder
.
uri
,
folder
);
}
...
...
src/vs/platform/workspace/test/common/testWorkspace.ts
浏览文件 @
50416be1
...
...
@@ -4,8 +4,19 @@
*--------------------------------------------------------------------------------------------*/
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Workspace
,
toWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
Workspace
as
BaseWorkspace
,
toWorkspaceFolder
,
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
isLinux
,
isWindows
}
from
'
vs/base/common/platform
'
;
export
class
Workspace
extends
BaseWorkspace
{
constructor
(
id
:
string
,
folders
:
WorkspaceFolder
[]
=
[],
configuration
:
URI
|
null
=
null
,
ignorePathCasing
:
(
key
:
URI
)
=>
boolean
=
()
=>
!
isLinux
)
{
super
(
id
,
folders
,
configuration
,
ignorePathCasing
);
}
}
const
wsUri
=
URI
.
file
(
isWindows
?
'
C:
\\
testWorkspace
'
:
'
/testWorkspace
'
);
export
const
TestWorkspace
=
testWorkspace
(
wsUri
);
...
...
src/vs/platform/workspace/test/common/workspace.test.ts
浏览文件 @
50416be1
...
...
@@ -8,7 +8,7 @@ import * as path from 'vs/base/common/path';
import
{
Workspace
,
toWorkspaceFolders
,
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IRawFileWorkspaceFolder
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
is
Linux
,
is
Windows
}
from
'
vs/base/common/platform
'
;
suite
(
'
Workspace
'
,
()
=>
{
...
...
@@ -27,7 +27,7 @@ suite('Workspace', () => {
test
(
'
getFolder returns the folder with given uri
'
,
()
=>
{
const
expected
=
new
WorkspaceFolder
({
uri
:
testFolderUri
,
name
:
''
,
index
:
2
});
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
0
}),
expected
,
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]);
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
0
}),
expected
,
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]
,
null
,
()
=>
!
isLinux
);
const
actual
=
testObject
.
getFolder
(
expected
.
uri
);
...
...
@@ -36,7 +36,7 @@ suite('Workspace', () => {
test
(
'
getFolder returns the folder if the uri is sub
'
,
()
=>
{
const
expected
=
new
WorkspaceFolder
({
uri
:
testFolderUri
,
name
:
''
,
index
:
0
});
let
testObject
=
new
Workspace
(
''
,
[
expected
,
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
1
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]);
let
testObject
=
new
Workspace
(
''
,
[
expected
,
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
1
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]
,
null
,
()
=>
!
isLinux
);
const
actual
=
testObject
.
getFolder
(
URI
.
file
(
path
.
join
(
fileFolder
,
'
test/a
'
)));
...
...
@@ -45,7 +45,7 @@ suite('Workspace', () => {
test
(
'
getFolder returns the closest folder if the uri is sub
'
,
()
=>
{
const
expected
=
new
WorkspaceFolder
({
uri
:
testFolderUri
,
name
:
''
,
index
:
2
});
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
}),
expected
]);
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
}),
expected
]
,
null
,
()
=>
!
isLinux
);
const
actual
=
testObject
.
getFolder
(
URI
.
file
(
path
.
join
(
fileFolder
,
'
test/a
'
)));
...
...
@@ -54,7 +54,7 @@ suite('Workspace', () => {
test
(
'
getFolder returns the folder even if the uri has query path
'
,
()
=>
{
const
expected
=
new
WorkspaceFolder
({
uri
:
testFolderUri
,
name
:
''
,
index
:
2
});
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
}),
expected
]);
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
mainFolderUri
,
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
}),
expected
]
,
null
,
()
=>
!
isLinux
);
const
actual
=
testObject
.
getFolder
(
URI
.
file
(
path
.
join
(
fileFolder
,
'
test/a
'
)).
with
({
query
:
'
somequery
'
}));
...
...
@@ -62,7 +62,7 @@ suite('Workspace', () => {
});
test
(
'
getFolder returns null if the uri is not sub
'
,
()
=>
{
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
testFolderUri
,
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
})]);
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
testFolderUri
,
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
})]
,
null
,
()
=>
!
isLinux
);
const
actual
=
testObject
.
getFolder
(
URI
.
file
(
path
.
join
(
fileFolder
,
'
main/a
'
)));
...
...
src/vs/workbench/api/common/extHostWorkspace.ts
浏览文件 @
50416be1
...
...
@@ -10,17 +10,18 @@ import { Emitter, Event } from 'vs/base/common/event';
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
Counter
}
from
'
vs/base/common/numbers
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
basename
,
basenameOrAuthority
,
dirname
,
isEqual
,
relativePath
}
from
'
vs/base/common/resources
'
;
import
{
compare
}
from
'
vs/base/common/strings
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ExtensionIdentifier
,
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
FileSystemProviderCapabilities
}
from
'
vs/platform/files/common/files
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
Workspace
,
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IExtHostFileSystemInfo
}
from
'
vs/workbench/api/common/extHostFileSystemInfo
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/extHostRpcService
'
;
import
{
Range
,
RelativePattern
}
from
'
vs/workbench/api/common/extHostTypes
'
;
...
...
@@ -59,6 +60,11 @@ function delta(oldFolders: vscode.WorkspaceFolder[], newFolders: vscode.Workspac
return
arrayDelta
(
oldSortedFolders
,
newSortedFolders
,
compare
);
}
function
ignorePathCasing
(
uri
:
URI
,
extHostFileSystemInfo
:
IExtHostFileSystemInfo
):
boolean
{
const
capabilities
=
extHostFileSystemInfo
.
getCapabilities
(
uri
.
scheme
);
return
!
(
capabilities
&&
(
capabilities
&
FileSystemProviderCapabilities
.
PathCaseSensitive
));
}
interface
MutableWorkspaceFolder
extends
vscode
.
WorkspaceFolder
{
name
:
string
;
index
:
number
;
...
...
@@ -66,7 +72,7 @@ interface MutableWorkspaceFolder extends vscode.WorkspaceFolder {
class
ExtHostWorkspaceImpl
extends
Workspace
{
static
toExtHostWorkspace
(
data
:
IWorkspaceData
|
null
,
previousConfirmedWorkspace
?:
ExtHostWorkspaceImpl
,
previousUnconfirmedWorkspace
?:
ExtHostWorkspaceImpl
):
{
workspace
:
ExtHostWorkspaceImpl
|
null
,
added
:
vscode
.
WorkspaceFolder
[],
removed
:
vscode
.
WorkspaceFolder
[]
}
{
static
toExtHostWorkspace
(
data
:
IWorkspaceData
|
null
,
previousConfirmedWorkspace
:
ExtHostWorkspaceImpl
|
undefined
,
previousUnconfirmedWorkspace
:
ExtHostWorkspaceImpl
|
undefined
,
extHostFileSystemInfo
:
IExtHostFileSystemInfo
):
{
workspace
:
ExtHostWorkspaceImpl
|
null
,
added
:
vscode
.
WorkspaceFolder
[],
removed
:
vscode
.
WorkspaceFolder
[]
}
{
if
(
!
data
)
{
return
{
workspace
:
null
,
added
:
[],
removed
:
[]
};
}
...
...
@@ -99,7 +105,7 @@ class ExtHostWorkspaceImpl extends Workspace {
// make sure to restore sort order based on index
newWorkspaceFolders
.
sort
((
f1
,
f2
)
=>
f1
.
index
<
f2
.
index
?
-
1
:
1
);
const
workspace
=
new
ExtHostWorkspaceImpl
(
id
,
name
,
newWorkspaceFolders
,
configuration
?
URI
.
revive
(
configuration
)
:
null
,
!!
isUntitled
);
const
workspace
=
new
ExtHostWorkspaceImpl
(
id
,
name
,
newWorkspaceFolders
,
configuration
?
URI
.
revive
(
configuration
)
:
null
,
!!
isUntitled
,
uri
=>
ignorePathCasing
(
uri
,
extHostFileSystemInfo
)
);
const
{
added
,
removed
}
=
delta
(
oldWorkspace
?
oldWorkspace
.
workspaceFolders
:
[],
workspace
.
workspaceFolders
,
compareWorkspaceFolderByUri
);
return
{
workspace
,
added
,
removed
};
...
...
@@ -117,10 +123,11 @@ class ExtHostWorkspaceImpl extends Workspace {
}
private
readonly
_workspaceFolders
:
vscode
.
WorkspaceFolder
[]
=
[];
private
readonly
_structure
=
TernarySearchTree
.
forUris
<
vscode
.
WorkspaceFolder
>
(
!
isLinux
)
;
private
readonly
_structure
:
TernarySearchTree
<
URI
,
vscode
.
WorkspaceFolder
>
;
constructor
(
id
:
string
,
private
_name
:
string
,
folders
:
vscode
.
WorkspaceFolder
[],
configuration
:
URI
|
null
,
private
_isUntitled
:
boolean
)
{
super
(
id
,
folders
.
map
(
f
=>
new
WorkspaceFolder
(
f
)),
configuration
);
constructor
(
id
:
string
,
private
_name
:
string
,
folders
:
vscode
.
WorkspaceFolder
[],
configuration
:
URI
|
null
,
private
_isUntitled
:
boolean
,
ignorePathCasing
:
(
key
:
URI
)
=>
boolean
)
{
super
(
id
,
folders
.
map
(
f
=>
new
WorkspaceFolder
(
f
)),
configuration
,
ignorePathCasing
);
this
.
_structure
=
TernarySearchTree
.
forUris2
<
vscode
.
WorkspaceFolder
>
(
ignorePathCasing
);
// setup the workspace folder data structure
folders
.
forEach
(
folder
=>
{
...
...
@@ -170,22 +177,25 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
private
readonly
_proxy
:
MainThreadWorkspaceShape
;
private
readonly
_messageService
:
MainThreadMessageServiceShape
;
private
readonly
_extHostFileSystemInfo
:
IExtHostFileSystemInfo
;
private
readonly
_activeSearchCallbacks
:
((
match
:
IRawFileMatch2
)
=>
any
)[]
=
[];
constructor
(
@
IExtHostRpcService
extHostRpc
:
IExtHostRpcService
,
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
,
@
IExtHostFileSystemInfo
extHostFileSystemInfo
:
IExtHostFileSystemInfo
,
@
ILogService
logService
:
ILogService
,
)
{
this
.
_logService
=
logService
;
this
.
_extHostFileSystemInfo
=
extHostFileSystemInfo
;
this
.
_requestIdProvider
=
new
Counter
();
this
.
_barrier
=
new
Barrier
();
this
.
_proxy
=
extHostRpc
.
getProxy
(
MainContext
.
MainThreadWorkspace
);
this
.
_messageService
=
extHostRpc
.
getProxy
(
MainContext
.
MainThreadMessageService
);
const
data
=
initData
.
workspace
;
this
.
_confirmedWorkspace
=
data
?
new
ExtHostWorkspaceImpl
(
data
.
id
,
data
.
name
,
[],
data
.
configuration
?
URI
.
revive
(
data
.
configuration
)
:
null
,
!!
data
.
isUntitled
)
:
undefined
;
this
.
_confirmedWorkspace
=
data
?
new
ExtHostWorkspaceImpl
(
data
.
id
,
data
.
name
,
[],
data
.
configuration
?
URI
.
revive
(
data
.
configuration
)
:
null
,
!!
data
.
isUntitled
,
uri
=>
ignorePathCasing
(
uri
,
extHostFileSystemInfo
)
)
:
undefined
;
}
$initializeWorkspace
(
data
:
IWorkspaceData
|
null
):
void
{
...
...
@@ -391,13 +401,13 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
configuration
:
this
.
_actualWorkspace
.
configuration
,
folders
,
isUntitled
:
this
.
_actualWorkspace
.
isUntitled
}
as
IWorkspaceData
,
this
.
_actualWorkspace
).
workspace
||
undefined
;
}
as
IWorkspaceData
,
this
.
_actualWorkspace
,
undefined
,
this
.
_extHostFileSystemInfo
).
workspace
||
undefined
;
}
}
$acceptWorkspaceData
(
data
:
IWorkspaceData
|
null
):
void
{
const
{
workspace
,
added
,
removed
}
=
ExtHostWorkspaceImpl
.
toExtHostWorkspace
(
data
,
this
.
_confirmedWorkspace
,
this
.
_unconfirmedWorkspace
);
const
{
workspace
,
added
,
removed
}
=
ExtHostWorkspaceImpl
.
toExtHostWorkspace
(
data
,
this
.
_confirmedWorkspace
,
this
.
_unconfirmedWorkspace
,
this
.
_extHostFileSystemInfo
);
// Update our workspace object. We have a confirmed workspace, so we drop our
// unconfirmed workspace.
...
...
src/vs/workbench/browser/web.main.ts
浏览文件 @
50416be1
...
...
@@ -59,6 +59,8 @@ import { localize } from 'vs/nls';
import
{
CATEGORIES
}
from
'
vs/workbench/common/actions
'
;
import
{
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IHostService
}
from
'
vs/workbench/services/host/browser/host
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
import
{
UriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentityService
'
;
class
BrowserMain
extends
Disposable
{
...
...
@@ -198,9 +200,13 @@ class BrowserMain extends Disposable {
serviceCollection
.
set
(
IFileService
,
fileService
);
await
this
.
registerFileSystemProviders
(
environmentService
,
fileService
,
remoteAgentService
,
logService
,
logsPath
);
// IURIIdentityService
const
uriIdentityService
=
new
UriIdentityService
(
fileService
);
serviceCollection
.
set
(
IUriIdentityService
,
uriIdentityService
);
// Long running services (workspace, config, storage)
const
[
configurationService
,
storageService
]
=
await
Promise
.
all
([
this
.
createWorkspaceService
(
payload
,
environmentService
,
fileService
,
remoteAgentService
,
logService
).
then
(
service
=>
{
this
.
createWorkspaceService
(
payload
,
environmentService
,
fileService
,
remoteAgentService
,
uriIdentityService
,
logService
).
then
(
service
=>
{
// Workspace
serviceCollection
.
set
(
IWorkspaceContextService
,
service
);
...
...
@@ -330,8 +336,8 @@ class BrowserMain extends Disposable {
}
}
private
async
createWorkspaceService
(
payload
:
IWorkspaceInitializationPayload
,
environmentService
:
IWorkbenchEnvironmentService
,
fileService
:
FileService
,
remoteAgentService
:
IRemoteAgentService
,
logService
:
ILogService
):
Promise
<
WorkspaceService
>
{
const
workspaceService
=
new
WorkspaceService
({
remoteAuthority
:
this
.
configuration
.
remoteAuthority
,
configurationCache
:
new
ConfigurationCache
()
},
environmentService
,
fileService
,
remoteAgentService
,
logService
);
private
async
createWorkspaceService
(
payload
:
IWorkspaceInitializationPayload
,
environmentService
:
IWorkbenchEnvironmentService
,
fileService
:
FileService
,
remoteAgentService
:
IRemoteAgentService
,
uriIdentityService
:
IUriIdentityService
,
logService
:
ILogService
):
Promise
<
WorkspaceService
>
{
const
workspaceService
=
new
WorkspaceService
({
remoteAuthority
:
this
.
configuration
.
remoteAuthority
,
configurationCache
:
new
ConfigurationCache
()
},
environmentService
,
fileService
,
remoteAgentService
,
uriIdentityService
,
logService
);
try
{
await
workspaceService
.
initialize
(
payload
);
...
...
src/vs/workbench/contrib/backup/test/electron-browser/backupTracker.test.ts
浏览文件 @
50416be1
...
...
@@ -33,7 +33,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
ShutdownReason
,
ILifecycleService
,
BeforeShutdownEvent
}
from
'
vs/workbench/services/lifecycle/common/lifecycle
'
;
import
{
IFileDialogService
,
ConfirmResult
,
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IWorkspaceContextService
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
INativeHostService
}
from
'
vs/platform/native/electron-sandbox/native
'
;
import
{
BackupTracker
}
from
'
vs/workbench/contrib/backup/common/backupTracker
'
;
import
{
workbenchInstantiationService
,
TestServiceAccessor
}
from
'
vs/workbench/test/electron-browser/workbenchTestServices
'
;
...
...
@@ -48,6 +48,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
TestWorkingCopy
}
from
'
vs/workbench/test/common/workbenchTestServices
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
const
userdataDir
=
getRandomTestPath
(
os
.
tmpdir
(),
'
vsctests
'
,
'
backuprestorer
'
);
const
backupHome
=
path
.
join
(
userdataDir
,
'
Backups
'
);
...
...
src/vs/workbench/contrib/markers/browser/markersFilterOptions.ts
浏览文件 @
50416be1
...
...
@@ -4,10 +4,41 @@
*--------------------------------------------------------------------------------------------*/
import
{
IFilter
,
matchesFuzzy
,
matchesFuzzy2
}
from
'
vs/base/common/filters
'
;
import
{
IExpression
,
splitGlobAware
,
getEmptyExpression
}
from
'
vs/base/common/glob
'
;
import
{
IExpression
,
splitGlobAware
,
getEmptyExpression
,
ParsedExpression
,
parse
}
from
'
vs/base/common/glob
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ResourceGlobMatcher
}
from
'
vs/base/common/resources
'
;
import
{
relativePath
}
from
'
vs/base/common/resources
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
export
class
ResourceGlobMatcher
{
private
readonly
globalExpression
:
ParsedExpression
;
private
readonly
expressionsByRoot
:
TernarySearchTree
<
URI
,
{
root
:
URI
,
expression
:
ParsedExpression
}
>
;
constructor
(
globalExpression
:
IExpression
,
rootExpressions
:
{
root
:
URI
,
expression
:
IExpression
}[],
uriIdentityService
:
IUriIdentityService
)
{
this
.
globalExpression
=
parse
(
globalExpression
);
this
.
expressionsByRoot
=
TernarySearchTree
.
forUris2
<
{
root
:
URI
,
expression
:
ParsedExpression
}
>
(
uriIdentityService
.
extUri
.
ignorePathCasing
);
for
(
const
expression
of
rootExpressions
)
{
this
.
expressionsByRoot
.
set
(
expression
.
root
,
{
root
:
expression
.
root
,
expression
:
parse
(
expression
.
expression
)
});
}
}
matches
(
resource
:
URI
):
boolean
{
const
rootExpression
=
this
.
expressionsByRoot
.
findSubstr
(
resource
);
if
(
rootExpression
)
{
const
path
=
relativePath
(
rootExpression
.
root
,
resource
);
if
(
path
&&
!!
rootExpression
.
expression
(
path
))
{
return
true
;
}
}
return
!!
this
.
globalExpression
(
resource
.
path
);
}
}
export
class
FilterOptions
{
...
...
@@ -21,7 +52,16 @@ export class FilterOptions {
readonly
excludesMatcher
:
ResourceGlobMatcher
;
readonly
includesMatcher
:
ResourceGlobMatcher
;
constructor
(
readonly
filter
:
string
=
''
,
filesExclude
:
{
root
:
URI
,
expression
:
IExpression
}[]
|
IExpression
=
[],
showWarnings
:
boolean
=
false
,
showErrors
:
boolean
=
false
,
showInfos
:
boolean
=
false
)
{
static
EMPTY
(
uriIdentityService
:
IUriIdentityService
)
{
return
new
FilterOptions
(
''
,
[],
false
,
false
,
false
,
uriIdentityService
);
}
constructor
(
readonly
filter
:
string
,
filesExclude
:
{
root
:
URI
,
expression
:
IExpression
}[]
|
IExpression
,
showWarnings
:
boolean
,
showErrors
:
boolean
,
showInfos
:
boolean
,
uriIdentityService
:
IUriIdentityService
)
{
filter
=
filter
.
trim
();
this
.
showWarnings
=
showWarnings
;
this
.
showErrors
=
showErrors
;
...
...
@@ -43,8 +83,8 @@ export class FilterOptions {
}
}
this
.
excludesMatcher
=
new
ResourceGlobMatcher
(
excludesExpression
,
filesExcludeByRoot
);
this
.
includesMatcher
=
new
ResourceGlobMatcher
(
includeExpression
,
[]);
this
.
excludesMatcher
=
new
ResourceGlobMatcher
(
excludesExpression
,
filesExcludeByRoot
,
uriIdentityService
);
this
.
includesMatcher
=
new
ResourceGlobMatcher
(
includeExpression
,
[]
,
uriIdentityService
);
this
.
textFilter
=
this
.
textFilter
.
trim
();
}
...
...
src/vs/workbench/contrib/markers/browser/markersView.ts
浏览文件 @
50416be1
...
...
@@ -51,6 +51,7 @@ import { IViewDescriptorService } from 'vs/workbench/common/views';
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
Codicon
}
from
'
vs/base/common/codicons
'
;
import
{
ActionViewItem
}
from
'
vs/base/browser/ui/actionbar/actionViewItems
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
function
createResourceMarkersIterator
(
resourceMarkers
:
ResourceMarkers
):
Iterable
<
ITreeElement
<
TreeElement
>>
{
return
Iterable
.
map
(
resourceMarkers
.
markers
,
m
=>
{
...
...
@@ -107,6 +108,7 @@ export class MarkersView extends ViewPane implements IMarkerFilterController {
@
IWorkspaceContextService
private
readonly
workspaceContextService
:
IWorkspaceContextService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IMenuService
private
readonly
menuService
:
IMenuService
,
@
IUriIdentityService
private
readonly
uriIdentityService
:
IUriIdentityService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IStorageService
storageService
:
IStorageService
,
@
IOpenerService
openerService
:
IOpenerService
,
...
...
@@ -124,7 +126,7 @@ export class MarkersView extends ViewPane implements IMarkerFilterController {
this
.
setCurrentActiveEditor
();
this
.
filter
=
new
Filter
(
new
FilterOptions
(
));
this
.
filter
=
new
Filter
(
FilterOptions
.
EMPTY
(
uriIdentityService
));
this
.
rangeHighlightDecorations
=
this
.
_register
(
this
.
instantiationService
.
createInstance
(
RangeHighlightDecorations
));
// actions
...
...
@@ -365,7 +367,7 @@ export class MarkersView extends ViewPane implements IMarkerFilterController {
private
updateFilter
()
{
this
.
cachedFilterStats
=
undefined
;
this
.
filter
.
options
=
new
FilterOptions
(
this
.
filters
.
filterText
,
this
.
getFilesExcludeExpressions
(),
this
.
filters
.
showWarnings
,
this
.
filters
.
showErrors
,
this
.
filters
.
showInfos
);
this
.
filter
.
options
=
new
FilterOptions
(
this
.
filters
.
filterText
,
this
.
getFilesExcludeExpressions
(),
this
.
filters
.
showWarnings
,
this
.
filters
.
showErrors
,
this
.
filters
.
showInfos
,
this
.
uriIdentityService
);
if
(
this
.
tree
)
{
this
.
tree
.
refilter
();
}
...
...
src/vs/workbench/contrib/search/test/browser/queryBuilder.test.ts
浏览文件 @
50416be1
...
...
@@ -10,13 +10,14 @@ import { URI as uri } from 'vs/base/common/uri';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
TestInstantiationService
}
from
'
vs/platform/instantiation/test/common/instantiationServiceMock
'
;
import
{
IWorkspaceContextService
,
toWorkspaceFolder
,
toWorkspaceFolders
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
,
toWorkspaceFolder
,
toWorkspaceFolders
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ISearchPathsInfo
,
QueryBuilder
}
from
'
vs/workbench/contrib/search/common/queryBuilder
'
;
import
{
IPathService
}
from
'
vs/workbench/services/path/common/pathService
'
;
import
{
IFileQuery
,
IFolderQuery
,
IPatternInfo
,
ITextQuery
,
QueryType
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
TestPathService
,
TestEnvironmentService
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
TestContextService
}
from
'
vs/workbench/test/common/workbenchTestServices
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
const
DEFAULT_EDITOR_CONFIG
=
{};
const
DEFAULT_USER_CONFIG
=
{
useRipgrep
:
true
,
useIgnoreFiles
:
true
,
useGlobalIgnoreFiles
:
true
};
...
...
src/vs/workbench/contrib/search/test/electron-browser/queryBuilder.test.ts
浏览文件 @
50416be1
...
...
@@ -6,12 +6,13 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
TestInstantiationService
}
from
'
vs/platform/instantiation/test/common/instantiationServiceMock
'
;
import
{
IWorkspaceContextService
,
toWorkspaceFolder
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
,
toWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ISearchPathsInfo
,
QueryBuilder
}
from
'
vs/workbench/contrib/search/common/queryBuilder
'
;
import
{
TestEnvironmentService
,
TestNativePathService
}
from
'
vs/workbench/test/electron-browser/workbenchTestServices
'
;
import
{
assertEqualSearchPathResults
,
getUri
,
patternsToIExpression
,
globalGlob
,
fixPath
}
from
'
vs/workbench/contrib/search/test/browser/queryBuilder.test
'
;
import
{
TestContextService
}
from
'
vs/workbench/test/common/workbenchTestServices
'
;
import
{
IPathService
}
from
'
vs/workbench/services/path/common/pathService
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
const
DEFAULT_EDITOR_CONFIG
=
{};
const
DEFAULT_USER_CONFIG
=
{
useRipgrep
:
true
,
useIgnoreFiles
:
true
,
useGlobalIgnoreFiles
:
true
};
...
...
src/vs/workbench/contrib/tasks/test/common/configuration.test.ts
浏览文件 @
50416be1
...
...
@@ -10,12 +10,13 @@ import * as UUID from 'vs/base/common/uuid';
import
*
as
Platform
from
'
vs/base/common/platform
'
;
import
{
ValidationStatus
}
from
'
vs/base/common/parsers
'
;
import
{
ProblemMatcher
,
FileLocationKind
,
ProblemPattern
,
ApplyToKind
}
from
'
vs/workbench/contrib/tasks/common/problemMatcher
'
;
import
{
WorkspaceFolder
,
Workspace
,
IWorkspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceFolder
,
IWorkspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
*
as
Tasks
from
'
vs/workbench/contrib/tasks/common/tasks
'
;
import
{
parse
,
ParseResult
,
IProblemReporter
,
ExternalTaskRunnerConfiguration
,
CustomTask
,
TaskConfigSource
}
from
'
vs/workbench/contrib/tasks/common/taskConfiguration
'
;
import
{
MockContextKeyService
}
from
'
vs/platform/keybinding/test/common/mockKeybindingService
'
;
import
{
IContext
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
const
workspaceFolder
:
WorkspaceFolder
=
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/workspace/folderOne
'
),
...
...
src/vs/workbench/electron-browser/desktop.main.ts
浏览文件 @
50416be1
...
...
@@ -51,6 +51,8 @@ import product from 'vs/platform/product/common/product';
import
{
NativeLogService
}
from
'
vs/workbench/services/log/electron-browser/logService
'
;
import
{
INativeHostService
}
from
'
vs/platform/native/electron-sandbox/native
'
;
import
{
NativeHostService
}
from
'
vs/platform/native/electron-sandbox/nativeHostService
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
import
{
UriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentityService
'
;
class
DesktopMain
extends
Disposable
{
...
...
@@ -234,6 +236,9 @@ class DesktopMain extends Disposable {
// User Data Provider
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
this
.
environmentService
.
appSettingsHome
,
this
.
configuration
.
backupPath
?
URI
.
file
(
this
.
configuration
.
backupPath
)
:
undefined
,
diskFileSystemProvider
,
this
.
environmentService
,
logService
));
// IURIIdentityService
const
uriIdentityService
=
new
UriIdentityService
(
fileService
);
serviceCollection
.
set
(
IUriIdentityService
,
uriIdentityService
);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
...
...
@@ -257,7 +262,7 @@ class DesktopMain extends Disposable {
const
payload
=
await
this
.
resolveWorkspaceInitializationPayload
();
const
services
=
await
Promise
.
all
([
this
.
createWorkspaceService
(
payload
,
fileService
,
remoteAgentService
,
logService
).
then
(
service
=>
{
this
.
createWorkspaceService
(
payload
,
fileService
,
remoteAgentService
,
uriIdentityService
,
logService
).
then
(
service
=>
{
// Workspace
serviceCollection
.
set
(
IWorkspaceContextService
,
service
);
...
...
@@ -362,8 +367,8 @@ class DesktopMain extends Disposable {
return
createHash
(
'
md5
'
).
update
(
resource
.
fsPath
).
update
(
ctime
?
String
(
ctime
)
:
''
).
digest
(
'
hex
'
);
}
private
async
createWorkspaceService
(
payload
:
IWorkspaceInitializationPayload
,
fileService
:
FileService
,
remoteAgentService
:
IRemoteAgentService
,
logService
:
ILogService
):
Promise
<
WorkspaceService
>
{
const
workspaceService
=
new
WorkspaceService
({
remoteAuthority
:
this
.
environmentService
.
remoteAuthority
,
configurationCache
:
new
ConfigurationCache
(
this
.
environmentService
)
},
this
.
environmentService
,
fileService
,
remoteAgentService
,
logService
);
private
async
createWorkspaceService
(
payload
:
IWorkspaceInitializationPayload
,
fileService
:
FileService
,
remoteAgentService
:
IRemoteAgentService
,
uriIdentityService
:
IUriIdentityService
,
logService
:
ILogService
):
Promise
<
WorkspaceService
>
{
const
workspaceService
=
new
WorkspaceService
({
remoteAuthority
:
this
.
environmentService
.
remoteAuthority
,
configurationCache
:
new
ConfigurationCache
(
this
.
environmentService
)
},
this
.
environmentService
,
fileService
,
remoteAgentService
,
uriIdentityService
,
logService
);
try
{
await
workspaceService
.
initialize
(
payload
);
...
...
src/vs/workbench/services/configuration/browser/configurationService.ts
浏览文件 @
50416be1
...
...
@@ -32,6 +32,7 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as
import
{
LifecyclePhase
}
from
'
vs/workbench/services/lifecycle/common/lifecycle
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
class
Workspace
extends
BaseWorkspace
{
initialized
:
boolean
=
false
;
...
...
@@ -55,6 +56,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic
private
readonly
logService
:
ILogService
;
private
readonly
fileService
:
IFileService
;
private
readonly
uriIdentityService
:
IUriIdentityService
;
protected
readonly
_onDidChangeConfiguration
:
Emitter
<
IConfigurationChangeEvent
>
=
this
.
_register
(
new
Emitter
<
IConfigurationChangeEvent
>
());
public
readonly
onDidChangeConfiguration
:
Event
<
IConfigurationChangeEvent
>
=
this
.
_onDidChangeConfiguration
.
event
;
...
...
@@ -79,6 +81,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic
environmentService
:
IWorkbenchEnvironmentService
,
fileService
:
IFileService
,
remoteAgentService
:
IRemoteAgentService
,
uriIdentityService
:
IUriIdentityService
,
logService
:
ILogService
,
)
{
super
();
...
...
@@ -94,6 +97,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic
this
.
defaultConfiguration
=
new
DefaultConfigurationModel
();
this
.
configurationCache
=
configurationCache
;
this
.
fileService
=
fileService
;
this
.
uriIdentityService
=
uriIdentityService
;
this
.
logService
=
logService
;
this
.
_configuration
=
new
Configuration
(
this
.
defaultConfiguration
,
new
ConfigurationModel
(),
new
ConfigurationModel
(),
new
ConfigurationModel
(),
new
ResourceMap
(),
new
ConfigurationModel
(),
new
ResourceMap
<
ConfigurationModel
>
(),
this
.
workspace
);
this
.
cachedFolderConfigs
=
new
ResourceMap
<
FolderConfiguration
>
();
...
...
@@ -371,20 +375,20 @@ export class WorkspaceService extends Disposable implements IConfigurationServic
const
workspaceConfigPath
=
workspaceIdentifier
.
configPath
;
const
workspaceFolders
=
toWorkspaceFolders
(
this
.
workspaceConfiguration
.
getFolders
(),
workspaceConfigPath
);
const
workspaceId
=
workspaceIdentifier
.
id
;
const
workspace
=
new
Workspace
(
workspaceId
,
workspaceFolders
,
workspaceConfigPath
);
const
workspace
=
new
Workspace
(
workspaceId
,
workspaceFolders
,
workspaceConfigPath
,
uri
=>
this
.
uriIdentityService
.
extUri
.
ignorePathCasing
(
uri
)
);
workspace
.
initialized
=
this
.
workspaceConfiguration
.
initialized
;
return
workspace
;
});
}
private
createSingleFolderWorkspace
(
singleFolder
:
ISingleFolderWorkspaceInitializationPayload
):
Promise
<
Workspace
>
{
const
workspace
=
new
Workspace
(
singleFolder
.
id
,
[
toWorkspaceFolder
(
singleFolder
.
folder
)]);
const
workspace
=
new
Workspace
(
singleFolder
.
id
,
[
toWorkspaceFolder
(
singleFolder
.
folder
)]
,
null
,
uri
=>
this
.
uriIdentityService
.
extUri
.
ignorePathCasing
(
uri
)
);
workspace
.
initialized
=
true
;
return
Promise
.
resolve
(
workspace
);
}
private
createEmptyWorkspace
(
emptyWorkspace
:
IEmptyWorkspaceInitializationPayload
):
Promise
<
Workspace
>
{
const
workspace
=
new
Workspace
(
emptyWorkspace
.
id
);
const
workspace
=
new
Workspace
(
emptyWorkspace
.
id
,
[],
null
,
uri
=>
this
.
uriIdentityService
.
extUri
.
ignorePathCasing
(
uri
)
);
workspace
.
initialized
=
true
;
return
Promise
.
resolve
(
workspace
);
}
...
...
src/vs/workbench/services/configuration/test/common/configurationModels.test.ts
浏览文件 @
50416be1
...
...
@@ -8,8 +8,9 @@ import { StandaloneConfigurationModelParser, Configuration } from 'vs/workbench/
import
{
ConfigurationModelParser
,
ConfigurationModel
}
from
'
vs/platform/configuration/common/configurationModels
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
,
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
import
{
Workspace
,
Workspace
Folder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
suite
(
'
FolderSettingsModelParser
'
,
()
=>
{
...
...
src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts
浏览文件 @
50416be1
...
...
@@ -41,6 +41,7 @@ import { ConfigurationCache } from 'vs/workbench/services/configuration/electron
import
{
KeybindingsEditingService
,
IKeybindingEditingService
}
from
'
vs/workbench/services/keybinding/common/keybindingEditing
'
;
import
{
NativeWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/electron-browser/environmentService
'
;
import
{
FileUserDataProvider
}
from
'
vs/workbench/services/userData/common/fileUserDataProvider
'
;
import
{
UriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentityService
'
;
class
TestWorkbenchEnvironmentService
extends
NativeWorkbenchEnvironmentService
{
...
...
@@ -113,7 +114,7 @@ suite('ConfigurationEditingService', () => {
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
diskFileSystemProvider
,
environmentService
,
new
NullLogService
()));
instantiationService
.
stub
(
IFileService
,
fileService
);
instantiationService
.
stub
(
IRemoteAgentService
,
remoteAgentService
);
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
());
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
());
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
return
workspaceService
.
initialize
(
noWorkspace
?
{
id
:
''
}
:
{
folder
:
URI
.
file
(
workspaceDir
),
id
:
createHash
(
'
md5
'
).
update
(
URI
.
file
(
workspaceDir
).
toString
()).
digest
(
'
hex
'
)
}).
then
(()
=>
{
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
浏览文件 @
50416be1
...
...
@@ -54,6 +54,7 @@ import product from 'vs/platform/product/common/product';
import
{
BrowserWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/browser/environmentService
'
;
import
{
INativeWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/electron-sandbox/environmentService
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
UriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentityService
'
;
class
TestWorkbenchEnvironmentService
extends
NativeWorkbenchEnvironmentService
{
...
...
@@ -116,7 +117,7 @@ suite('WorkspaceContextService - Folder', () => {
const
diskFileSystemProvider
=
new
DiskFileSystemProvider
(
new
NullLogService
());
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
new
DiskFileSystemProvider
(
new
NullLogService
()),
environmentService
,
new
NullLogService
()));
workspaceContextService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
new
RemoteAgentService
(
environmentService
,
{
_serviceBrand
:
undefined
,
...
product
},
new
RemoteAuthorityResolverService
(),
new
SignService
(
undefined
),
new
NullLogService
()),
new
NullLogService
());
workspaceContextService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
new
RemoteAgentService
(
environmentService
,
{
_serviceBrand
:
undefined
,
...
product
},
new
RemoteAuthorityResolverService
(),
new
SignService
(
undefined
),
new
NullLogService
()),
new
UriIdentityService
(
fileService
),
new
NullLogService
());
return
(
<
WorkspaceService
>
workspaceContextService
).
initialize
(
convertToWorkspacePayload
(
URI
.
file
(
folderDir
)));
});
});
...
...
@@ -182,7 +183,7 @@ suite('WorkspaceContextService - Workspace', () => {
const
diskFileSystemProvider
=
new
DiskFileSystemProvider
(
new
NullLogService
());
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
diskFileSystemProvider
,
environmentService
,
new
NullLogService
()));
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
());
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
());
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
@@ -242,7 +243,7 @@ suite('WorkspaceContextService - Workspace Editing', () => {
const
diskFileSystemProvider
=
new
DiskFileSystemProvider
(
new
NullLogService
());
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
diskFileSystemProvider
,
environmentService
,
new
NullLogService
()));
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
());
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
());
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
@@ -503,7 +504,7 @@ suite('WorkspaceService - Initialization', () => {
const
diskFileSystemProvider
=
new
DiskFileSystemProvider
(
new
NullLogService
());
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
diskFileSystemProvider
,
environmentService
,
new
NullLogService
()));
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
());
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
());
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
...
...
@@ -780,7 +781,7 @@ suite('WorkspaceConfigurationService - Folder', () => {
const
diskFileSystemProvider
=
new
DiskFileSystemProvider
(
new
NullLogService
());
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
diskFileSystemProvider
,
environmentService
,
new
NullLogService
()));
workspaceService
=
disposableStore
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
()));
workspaceService
=
disposableStore
.
add
(
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
...
...
@@ -1286,7 +1287,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => {
const
diskFileSystemProvider
=
new
DiskFileSystemProvider
(
new
NullLogService
());
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
diskFileSystemProvider
,
environmentService
,
new
NullLogService
()));
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
());
const
workspaceService
=
new
WorkspaceService
({
configurationCache
:
new
ConfigurationCache
(
environmentService
)
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
());
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
@@ -1890,7 +1891,7 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
fileService
.
registerProvider
(
Schemas
.
file
,
diskFileSystemProvider
);
fileService
.
registerProvider
(
Schemas
.
userData
,
new
FileUserDataProvider
(
environmentService
.
appSettingsHome
,
undefined
,
diskFileSystemProvider
,
environmentService
,
new
NullLogService
()));
const
configurationCache
:
IConfigurationCache
=
{
read
:
()
=>
Promise
.
resolve
(
''
),
write
:
()
=>
Promise
.
resolve
(),
remove
:
()
=>
Promise
.
resolve
(),
needsCaching
:
()
=>
false
};
testObject
=
new
WorkspaceService
({
configurationCache
,
remoteAuthority
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
());
testObject
=
new
WorkspaceService
({
configurationCache
,
remoteAuthority
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
());
instantiationService
.
stub
(
IWorkspaceContextService
,
testObject
);
instantiationService
.
stub
(
IConfigurationService
,
testObject
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
...
...
@@ -2096,7 +2097,7 @@ suite('ConfigurationService - Configuration Defaults', () => {
const
remoteAgentService
=
(
<
TestInstantiationService
>
workbenchInstantiationService
()).
createInstance
(
RemoteAgentService
);
const
environmentService
=
new
BrowserWorkbenchEnvironmentService
({
logsPath
:
URI
.
file
(
''
),
workspaceId
:
''
,
configurationDefaults
},
TestProductService
);
const
fileService
=
new
FileService
(
new
NullLogService
());
return
disposableStore
.
add
(
new
WorkspaceService
({
configurationCache
:
new
BrowserConfigurationCache
()
},
environmentService
,
fileService
,
remoteAgentService
,
new
NullLogService
()));
return
disposableStore
.
add
(
new
WorkspaceService
({
configurationCache
:
new
BrowserConfigurationCache
()
},
environmentService
,
fileService
,
remoteAgentService
,
new
UriIdentityService
(
fileService
),
new
NullLogService
()));
}
});
...
...
src/vs/workbench/services/label/test/browser/label.test.ts
浏览文件 @
50416be1
...
...
@@ -9,7 +9,8 @@ import { TestEnvironmentService, TestPathService } from 'vs/workbench/test/brows
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
LabelService
}
from
'
vs/workbench/services/label/common/labelService
'
;
import
{
TestContextService
}
from
'
vs/workbench/test/common/workbenchTestServices
'
;
import
{
Workspace
,
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
suite
(
'
URI Label
'
,
()
=>
{
let
labelService
:
LabelService
;
...
...
src/vs/workbench/test/browser/api/extHostConfiguration.test.ts
浏览文件 @
50416be1
...
...
@@ -15,6 +15,7 @@ import { IWorkspaceFolder, WorkspaceFolder } from 'vs/platform/workspace/common/
import
{
ConfigurationTarget
,
IConfigurationModel
,
IConfigurationChange
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
IExtHostFileSystemInfo
}
from
'
vs/workbench/api/common/extHostFileSystemInfo
'
;
suite
(
'
ExtHostConfiguration
'
,
function
()
{
...
...
@@ -27,7 +28,7 @@ suite('ExtHostConfiguration', function () {
}
function
createExtHostWorkspace
():
ExtHostWorkspace
{
return
new
ExtHostWorkspace
(
new
TestRPCProtocol
(),
new
class
extends
mock
<
IExtHostInitDataService
>
()
{
},
new
NullLogService
());
return
new
ExtHostWorkspace
(
new
TestRPCProtocol
(),
new
class
extends
mock
<
IExtHostInitDataService
>
()
{
},
new
class
extends
mock
<
IExtHostFileSystemInfo
>
()
{
},
new
NullLogService
());
}
function
createExtHostConfiguration
(
contents
:
any
=
Object
.
create
(
null
),
shape
?:
MainThreadConfigurationShape
)
{
...
...
src/vs/workbench/test/browser/api/extHostWorkspace.test.ts
浏览文件 @
50416be1
...
...
@@ -21,12 +21,14 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
import
{
ITextQueryBuilderOptions
}
from
'
vs/workbench/contrib/search/common/queryBuilder
'
;
import
{
IPatternInfo
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
IExtHostFileSystemInfo
}
from
'
vs/workbench/api/common/extHostFileSystemInfo
'
;
function
createExtHostWorkspace
(
mainContext
:
IMainContext
,
data
:
IWorkspaceData
,
logService
:
ILogService
):
ExtHostWorkspace
{
const
result
=
new
ExtHostWorkspace
(
new
ExtHostRpcService
(
mainContext
),
new
class
extends
mock
<
IExtHostInitDataService
>
()
{
workspace
=
data
;
},
logService
new
class
extends
mock
<
IExtHostFileSystemInfo
>
()
{
},
logService
,
);
result
.
$initializeWorkspace
(
data
);
return
result
;
...
...
src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts
浏览文件 @
50416be1
...
...
@@ -5,11 +5,12 @@
import
*
as
assert
from
'
assert
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Workspace
,
Workspace
Folder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
EditorBreadcrumbsModel
,
FileElement
}
from
'
vs/workbench/browser/parts/editor/breadcrumbsModel
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
FileKind
}
from
'
vs/platform/files/common/files
'
;
import
{
TestContextService
}
from
'
vs/workbench/test/common/workbenchTestServices
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
suite
(
'
Breadcrumb Model
'
,
function
()
{
...
...
src/vs/workbench/workbench.common.main.ts
浏览文件 @
50416be1
...
...
@@ -53,7 +53,6 @@ import 'vs/workbench/browser/parts/views/viewsService';
//#region --- workbench services
import
'
vs/platform/undoRedo/common/undoRedoService
'
;
import
'
vs/workbench/services/uriIdentity/common/uriIdentityService
'
;
import
'
vs/workbench/services/extensions/browser/extensionUrlHandler
'
;
import
'
vs/workbench/services/keybinding/common/keybindingEditing
'
;
import
'
vs/workbench/services/decorations/browser/decorationsService
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录