Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
a03b3b50
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,发现更多精彩内容 >>
提交
a03b3b50
编写于
8月 23, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove .name from IWorkspace
上级
6090860b
变更
29
隐藏空白更改
内联
并排
Showing
29 changed file
with
103 addition
and
96 deletion
+103
-96
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+1
-1
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+3
-3
src/vs/platform/uriLabel/common/uriLabel.ts
src/vs/platform/uriLabel/common/uriLabel.ts
+13
-9
src/vs/platform/uriLabel/test/uriLabel.test.ts
src/vs/platform/uriLabel/test/uriLabel.test.ts
+1
-2
src/vs/platform/workspace/common/workspace.ts
src/vs/platform/workspace/common/workspace.ts
+1
-17
src/vs/platform/workspace/test/common/testWorkspace.ts
src/vs/platform/workspace/test/common/testWorkspace.ts
+1
-2
src/vs/platform/workspace/test/common/workspace.test.ts
src/vs/platform/workspace/test/common/workspace.test.ts
+4
-4
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
+10
-2
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/node/extHostWorkspace.ts
src/vs/workbench/api/node/extHostWorkspace.ts
+10
-2
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+1
-1
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+4
-8
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+0
-2
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+5
-0
src/vs/workbench/parts/files/electron-browser/views/emptyView.ts
...workbench/parts/files/electron-browser/views/emptyView.ts
+1
-1
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
...kbench/parts/files/electron-browser/views/explorerView.ts
+4
-2
src/vs/workbench/parts/logs/electron-browser/logsActions.ts
src/vs/workbench/parts/logs/electron-browser/logsActions.ts
+10
-5
src/vs/workbench/parts/search/test/common/queryBuilder.test.ts
...s/workbench/parts/search/test/common/queryBuilder.test.ts
+1
-1
src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts
...es/backup/test/electron-browser/backupFileService.test.ts
+1
-1
src/vs/workbench/services/configuration/node/configurationService.ts
...bench/services/configuration/node/configurationService.ts
+4
-6
src/vs/workbench/services/configuration/test/common/configurationModels.test.ts
...ces/configuration/test/common/configurationModels.test.ts
+1
-1
src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts
...test/electron-browser/configurationEditingService.test.ts
+1
-2
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
...ration/test/electron-browser/configurationService.test.ts
+5
-11
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
...nch/services/extensions/electron-browser/extensionHost.ts
+11
-3
src/vs/workbench/services/files/test/electron-browser/fileService.test.ts
.../services/files/test/electron-browser/fileService.test.ts
+4
-4
src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts
...eybinding/test/electron-browser/keybindingEditing.test.ts
+1
-1
src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts
...rkbench/test/browser/parts/editor/breadcrumbModel.test.ts
+1
-1
src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
...bench/test/electron-browser/api/mainThreadEditors.test.ts
+2
-2
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+1
-1
未找到文件。
src/vs/code/electron-main/main.ts
浏览文件 @
a03b3b50
...
...
@@ -58,7 +58,7 @@ function createServices(args: ParsedArgs, bufferLogService: BufferLogService): I
const
environmentService
=
new
EnvironmentService
(
args
,
process
.
execPath
);
const
consoleLogService
=
new
ConsoleLogMainService
(
getLogLevel
(
environmentService
));
const
logService
=
new
MultiplexLogService
([
consoleLogService
,
bufferLogService
]);
const
uriLabelService
=
new
UriLabelService
(
environmentService
);
const
uriLabelService
=
new
UriLabelService
(
environmentService
,
undefined
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
...
...
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
a03b3b50
...
...
@@ -508,7 +508,7 @@ export class SimpleWorkspaceContextService implements IWorkspaceContextService {
constructor
()
{
const
resource
=
URI
.
from
({
scheme
:
SimpleWorkspaceContextService
.
SCHEME
,
authority
:
'
model
'
,
path
:
'
/
'
});
this
.
workspace
=
{
id
:
'
4064f6ec-cb38-4ad0-af64-ee6467e63c82
'
,
folders
:
[
new
WorkspaceFolder
({
uri
:
resource
,
name
:
''
,
index
:
0
})]
,
name
:
resource
.
fsPath
};
this
.
workspace
=
{
id
:
'
4064f6ec-cb38-4ad0-af64-ee6467e63c82
'
,
folders
:
[
new
WorkspaceFolder
({
uri
:
resource
,
name
:
''
,
index
:
0
})]
};
}
public
getWorkspace
():
IWorkspace
{
...
...
@@ -609,8 +609,8 @@ export class SimpleUriLabelService implements IUriLabelService {
return
resource
.
path
;
}
public
getWorkspaceLabel
(
workspace
:
IWorkspaceIdentifier
|
URI
,
options
?:
{
verbose
:
boolean
;
}):
string
{
throw
new
Error
(
'
Not implemented
'
)
;
public
getWorkspaceLabel
(
workspace
:
IWorkspaceIdentifier
|
URI
|
IWorkspace
,
options
?:
{
verbose
:
boolean
;
}):
string
{
return
''
;
}
public
registerFormater
(
schema
:
string
,
formater
:
UriLabelRules
):
IDisposable
{
...
...
src/vs/platform/uriLabel/common/uriLabel.ts
浏览文件 @
a03b3b50
...
...
@@ -7,13 +7,13 @@ import URI from 'vs/base/common/uri';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
,
IWorkspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
isEqual
,
basenameOrAuthority
}
from
'
vs/base/common/resources
'
;
import
{
isLinux
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
tildify
,
getPathLabel
}
from
'
vs/base/common/labels
'
;
import
{
ltrim
}
from
'
vs/base/common/strings
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
WORKSPACE_EXTENSION
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
WORKSPACE_EXTENSION
,
toWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
isParent
}
from
'
vs/platform/files/common/files
'
;
import
{
basename
,
dirname
,
join
}
from
'
vs/base/common/paths
'
;
...
...
@@ -21,7 +21,7 @@ import { basename, dirname, join } from 'vs/base/common/paths';
export
interface
IUriLabelService
{
_serviceBrand
:
any
;
getLabel
(
resource
:
URI
,
relative
?:
boolean
,
forceNoTildify
?:
boolean
):
string
;
getWorkspaceLabel
(
workspace
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
),
options
?:
{
verbose
:
boolean
}):
string
;
getWorkspaceLabel
(
workspace
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
|
IWorkspace
),
options
?:
{
verbose
:
boolean
}):
string
;
registerFormater
(
schema
:
string
,
formater
:
UriLabelRules
):
IDisposable
;
onDidRegisterFormater
:
Event
<
{
scheme
:
string
,
formater
:
UriLabelRules
}
>
;
}
...
...
@@ -46,20 +46,16 @@ export class UriLabelService implements IUriLabelService {
private
readonly
formaters
=
new
Map
<
string
,
UriLabelRules
>
();
private
readonly
_onDidRegisterFormater
=
new
Emitter
<
{
scheme
:
string
,
formater
:
UriLabelRules
}
>
();
private
contextService
:
IWorkspaceContextService
;
constructor
(
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
)
{
}
get
onDidRegisterFormater
():
Event
<
{
scheme
:
string
,
formater
:
UriLabelRules
}
>
{
return
this
.
_onDidRegisterFormater
.
event
;
}
acquireContextService
(
contextService
:
IWorkspaceContextService
):
void
{
this
.
contextService
=
contextService
;
}
getLabel
(
resource
:
URI
,
relative
?:
boolean
,
forceNoTildify
?:
boolean
):
string
{
if
(
!
resource
)
{
return
undefined
;
...
...
@@ -93,7 +89,14 @@ export class UriLabelService implements IUriLabelService {
return
this
.
formatUri
(
resource
,
formater
,
forceNoTildify
);
}
getWorkspaceLabel
(
workspace
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
),
options
?:
{
verbose
:
boolean
}):
string
{
getWorkspaceLabel
(
workspace
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
|
IWorkspace
),
options
?:
{
verbose
:
boolean
}):
string
{
if
(
!
isWorkspaceIdentifier
(
workspace
)
&&
!
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
workspace
=
toWorkspaceIdentifier
(
workspace
);
if
(
!
workspace
)
{
return
''
;
}
}
// Workspace: Single Folder
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
// Folder on disk
...
...
@@ -106,6 +109,7 @@ export class UriLabelService implements IUriLabelService {
}
// Workspace: Saved
console
.
log
(
workspace
.
configPath
);
const
filename
=
basename
(
workspace
.
configPath
);
const
workspaceName
=
filename
.
substr
(
0
,
filename
.
length
-
WORKSPACE_EXTENSION
.
length
-
1
);
if
(
options
&&
options
.
verbose
)
{
...
...
src/vs/platform/uriLabel/test/uriLabel.test.ts
浏览文件 @
a03b3b50
...
...
@@ -17,8 +17,7 @@ suite('URI Label', () => {
let
uriLabelService
:
UriLabelService
;
setup
(()
=>
{
uriLabelService
=
new
UriLabelService
(
TestEnvironmentService
);
uriLabelService
.
acquireContextService
(
new
TestContextService
());
uriLabelService
=
new
UriLabelService
(
TestEnvironmentService
,
new
TestContextService
());
});
test
(
'
file scheme
'
,
function
()
{
...
...
src/vs/platform/workspace/common/workspace.ts
浏览文件 @
a03b3b50
...
...
@@ -81,7 +81,6 @@ export namespace IWorkspace {
export
function
isIWorkspace
(
thing
:
any
):
thing
is
IWorkspace
{
return
thing
&&
typeof
thing
===
'
object
'
&&
typeof
(
thing
as
IWorkspace
).
id
===
'
string
'
&&
typeof
(
thing
as
IWorkspace
).
name
===
'
string
'
&&
Array
.
isArray
((
thing
as
IWorkspace
).
folders
);
}
}
...
...
@@ -93,11 +92,6 @@ export interface IWorkspace {
*/
readonly
id
:
string
;
/**
* the name of the workspace.
*/
readonly
name
:
string
;
/**
* Folders in the workspace.
*/
...
...
@@ -151,7 +145,6 @@ export class Workspace implements IWorkspace {
constructor
(
private
_id
:
string
,
private
_name
:
string
=
''
,
folders
:
WorkspaceFolder
[]
=
[],
private
_configuration
:
URI
=
null
,
private
_ctime
?:
number
...
...
@@ -161,7 +154,6 @@ export class Workspace implements IWorkspace {
update
(
workspace
:
Workspace
)
{
this
.
_id
=
workspace
.
id
;
this
.
_name
=
workspace
.
name
;
this
.
_configuration
=
workspace
.
configuration
;
this
.
_ctime
=
workspace
.
ctime
;
this
.
folders
=
workspace
.
folders
;
...
...
@@ -184,14 +176,6 @@ export class Workspace implements IWorkspace {
return
this
.
_ctime
;
}
get
name
():
string
{
return
this
.
_name
;
}
set
name
(
name
:
string
)
{
this
.
_name
=
name
;
}
get
configuration
():
URI
{
return
this
.
_configuration
;
}
...
...
@@ -216,7 +200,7 @@ export class Workspace implements IWorkspace {
}
toJSON
():
IWorkspace
{
return
{
id
:
this
.
id
,
folders
:
this
.
folders
,
name
:
this
.
name
,
configuration
:
this
.
configuration
};
return
{
id
:
this
.
id
,
folders
:
this
.
folders
,
configuration
:
this
.
configuration
};
}
}
...
...
src/vs/platform/workspace/test/common/testWorkspace.ts
浏览文件 @
a03b3b50
...
...
@@ -13,7 +13,6 @@ export const TestWorkspace = testWorkspace(wsUri);
export
function
testWorkspace
(
resource
:
URI
):
Workspace
{
return
new
Workspace
(
resource
.
toString
(),
resource
.
fsPath
,
toWorkspaceFolders
([{
path
:
resource
.
fsPath
}])
);
}
\ No newline at end of file
}
src/vs/platform/workspace/test/common/workspace.test.ts
浏览文件 @
a03b3b50
...
...
@@ -14,7 +14,7 @@ suite('Workspace', () => {
test
(
'
getFolder returns the folder with given uri
'
,
()
=>
{
const
expected
=
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/test
'
),
name
:
''
,
index
:
2
});
let
testObject
=
new
Workspace
(
''
,
''
,
[
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/main
'
),
name
:
''
,
index
:
0
}),
expected
,
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]);
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/main
'
),
name
:
''
,
index
:
0
}),
expected
,
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]);
const
actual
=
testObject
.
getFolder
(
expected
.
uri
);
...
...
@@ -23,7 +23,7 @@ suite('Workspace', () => {
test
(
'
getFolder returns the folder if the uri is sub
'
,
()
=>
{
const
expected
=
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/test
'
),
name
:
''
,
index
:
0
});
let
testObject
=
new
Workspace
(
''
,
''
,
[
expected
,
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/main
'
),
name
:
''
,
index
:
1
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]);
let
testObject
=
new
Workspace
(
''
,
[
expected
,
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/main
'
),
name
:
''
,
index
:
1
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
2
})]);
const
actual
=
testObject
.
getFolder
(
URI
.
file
(
'
/src/test/a
'
));
...
...
@@ -32,7 +32,7 @@ suite('Workspace', () => {
test
(
'
getFolder returns the closest folder if the uri is sub
'
,
()
=>
{
const
expected
=
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/test
'
),
name
:
''
,
index
:
2
});
let
testObject
=
new
Workspace
(
''
,
''
,
[
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/main
'
),
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
}),
expected
]);
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/main
'
),
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
}),
expected
]);
const
actual
=
testObject
.
getFolder
(
URI
.
file
(
'
/src/test/a
'
));
...
...
@@ -40,7 +40,7 @@ suite('Workspace', () => {
});
test
(
'
getFolder returns null if the uri is not sub
'
,
()
=>
{
let
testObject
=
new
Workspace
(
''
,
''
,
[
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/test
'
),
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
})]);
let
testObject
=
new
Workspace
(
''
,
[
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/test
'
),
name
:
''
,
index
:
0
}),
new
WorkspaceFolder
({
uri
:
URI
.
file
(
'
/src/code
'
),
name
:
''
,
index
:
1
})]);
const
actual
=
testObject
.
getFolder
(
URI
.
file
(
'
/src/main/a
'
));
...
...
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
浏览文件 @
a03b3b50
...
...
@@ -23,6 +23,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
areSameExtensions
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadWorkspace
)
export
class
MainThreadWorkspace
implements
MainThreadWorkspaceShape
{
...
...
@@ -40,6 +41,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
@
IWorkspaceEditingService
private
readonly
_workspaceEditingService
:
IWorkspaceEditingService
,
@
IStatusbarService
private
readonly
_statusbarService
:
IStatusbarService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
IUriLabelService
private
readonly
_uriLabelService
:
IUriLabelService
)
{
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostWorkspace
);
this
.
_contextService
.
onDidChangeWorkspaceFolders
(
this
.
_onDidChangeWorkspace
,
this
,
this
.
_toDispose
);
...
...
@@ -99,7 +101,13 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
}
private
_onDidChangeWorkspace
():
void
{
this
.
_proxy
.
$acceptWorkspaceData
(
this
.
_contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
?
null
:
this
.
_contextService
.
getWorkspace
());
const
workspace
=
this
.
_contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
?
null
:
this
.
_contextService
.
getWorkspace
();
this
.
_proxy
.
$acceptWorkspaceData
(
workspace
?
{
configuration
:
workspace
.
configuration
,
folders
:
workspace
.
folders
,
id
:
workspace
.
id
,
name
:
this
.
_uriLabelService
.
getWorkspaceLabel
(
workspace
)
}
:
null
);
}
// --- search ---
...
...
@@ -230,4 +238,4 @@ CommandsRegistry.registerCommand('_workbench.enterWorkspace', async function (ac
}
return
workspaceEditingService
.
enterWorkspace
(
workspace
.
fsPath
);
});
\ No newline at end of file
});
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
a03b3b50
...
...
@@ -485,7 +485,7 @@ export function createApiFactory(
return
extHostWorkspace
.
getWorkspaceFolders
();
},
get
name
()
{
return
extHostWorkspace
.
workspace
?
extHostWorkspace
.
workspace
.
name
:
undefined
;
return
extHostWorkspace
.
name
;
},
set
name
(
value
)
{
throw
errors
.
readonly
();
...
...
src/vs/workbench/api/node/extHostWorkspace.ts
浏览文件 @
a03b3b50
...
...
@@ -107,8 +107,8 @@ class ExtHostWorkspaceImpl extends Workspace {
private
readonly
_workspaceFolders
:
vscode
.
WorkspaceFolder
[]
=
[];
private
readonly
_structure
=
TernarySearchTree
.
forPaths
<
vscode
.
WorkspaceFolder
>
();
private
constructor
(
id
:
string
,
name
:
string
,
folders
:
vscode
.
WorkspaceFolder
[])
{
super
(
id
,
name
,
folders
.
map
(
f
=>
new
WorkspaceFolder
(
f
)));
private
constructor
(
id
:
string
,
private
_
name
:
string
,
folders
:
vscode
.
WorkspaceFolder
[])
{
super
(
id
,
folders
.
map
(
f
=>
new
WorkspaceFolder
(
f
)));
// setup the workspace folder data structure
folders
.
forEach
(
folder
=>
{
...
...
@@ -117,6 +117,10 @@ class ExtHostWorkspaceImpl extends Workspace {
});
}
get
name
():
string
{
return
this
.
_name
;
}
get
workspaceFolders
():
vscode
.
WorkspaceFolder
[]
{
return
this
.
_workspaceFolders
.
slice
(
0
);
}
...
...
@@ -166,6 +170,10 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
return
this
.
_actualWorkspace
;
}
get
name
():
string
{
return
this
.
_actualWorkspace
?
this
.
_actualWorkspace
.
name
:
undefined
;
}
private
get
_actualWorkspace
():
ExtHostWorkspaceImpl
{
return
this
.
_unconfirmedWorkspace
||
this
.
_confirmedWorkspace
;
}
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
a03b3b50
...
...
@@ -243,7 +243,7 @@ export class TitlebarPart extends Part implements ITitleService {
const
activeEditorShort
=
editor
?
editor
.
getTitle
(
Verbosity
.
SHORT
)
:
''
;
const
activeEditorMedium
=
editor
?
editor
.
getTitle
(
Verbosity
.
MEDIUM
)
:
activeEditorShort
;
const
activeEditorLong
=
editor
?
editor
.
getTitle
(
Verbosity
.
LONG
)
:
activeEditorMedium
;
const
rootName
=
workspace
.
name
;
const
rootName
=
root
?
this
.
uriLabelService
.
getWorkspaceLabel
(
root
)
:
''
;
const
rootPath
=
root
?
this
.
uriLabelService
.
getLabel
(
root
)
:
''
;
const
folderName
=
folder
?
folder
.
name
:
''
;
const
folderPath
=
folder
?
this
.
uriLabelService
.
getLabel
(
folder
.
uri
)
:
''
;
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
a03b3b50
...
...
@@ -48,7 +48,6 @@ import { RelayURLService } from 'vs/platform/url/common/urlService';
import
{
MenubarChannelClient
}
from
'
vs/platform/menubar/node/menubarIpc
'
;
import
{
IMenubarService
}
from
'
vs/platform/menubar/common/menubar
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IUriLabelService
,
UriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
gracefulFs
.
gracefulify
(
fs
);
// enable gracefulFs
...
...
@@ -99,15 +98,13 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
const
mainServices
=
createMainProcessServices
(
mainProcessClient
,
configuration
);
const
environmentService
=
new
EnvironmentService
(
configuration
,
configuration
.
execPath
);
const
uriLabelService
=
new
UriLabelService
(
environmentService
);
const
logService
=
createLogService
(
mainProcessClient
,
configuration
,
environmentService
);
logService
.
trace
(
'
openWorkbench configuration
'
,
JSON
.
stringify
(
configuration
));
// Since the configuration service is one of the core services that is used in so many places, we initialize it
// right before startup of the workbench shell to have its data ready for consumers
return
createAndInitializeWorkspaceService
(
configuration
,
environmentService
,
uriLabelService
).
then
(
workspaceService
=>
{
return
createAndInitializeWorkspaceService
(
configuration
,
environmentService
).
then
(
workspaceService
=>
{
const
storageService
=
createStorageService
(
workspaceService
,
environmentService
);
uriLabelService
.
acquireContextService
(
workspaceService
);
return
domContentLoaded
().
then
(()
=>
{
...
...
@@ -118,8 +115,7 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
configurationService
:
workspaceService
,
environmentService
,
logService
,
storageService
,
uriLabelService
storageService
},
mainServices
,
mainProcessClient
,
configuration
);
shell
.
open
();
...
...
@@ -135,10 +131,10 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
});
}
function
createAndInitializeWorkspaceService
(
configuration
:
IWindowConfiguration
,
environmentService
:
EnvironmentService
,
uriLabelService
:
IUriLabelService
):
TPromise
<
WorkspaceService
>
{
function
createAndInitializeWorkspaceService
(
configuration
:
IWindowConfiguration
,
environmentService
:
EnvironmentService
):
TPromise
<
WorkspaceService
>
{
return
validateFolderUri
(
configuration
.
folderUri
,
configuration
.
verbose
).
then
(
validatedFolderUri
=>
{
const
workspaceService
=
new
WorkspaceService
(
environmentService
,
uriLabelService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
);
return
workspaceService
.
initialize
(
configuration
.
workspace
||
validatedFolderUri
||
configuration
).
then
(()
=>
workspaceService
,
error
=>
workspaceService
);
});
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
a03b3b50
...
...
@@ -109,7 +109,6 @@ export interface ICoreServices {
environmentService
:
IEnvironmentService
;
logService
:
ILogService
;
storageService
:
IStorageService
;
uriLabelService
:
IUriLabelService
;
}
/**
...
...
@@ -148,7 +147,6 @@ export class WorkbenchShell extends Disposable {
this
.
contextService
=
coreServices
.
contextService
;
this
.
configurationService
=
coreServices
.
configurationService
;
this
.
environmentService
=
coreServices
.
environmentService
;
this
.
uriLabelService
=
coreServices
.
uriLabelService
;
this
.
logService
=
coreServices
.
logService
;
this
.
storageService
=
coreServices
.
storageService
;
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
a03b3b50
...
...
@@ -116,6 +116,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
TelemetryService
}
from
'
vs/platform/telemetry/common/telemetryService
'
;
import
{
WorkbenchThemeService
}
from
'
vs/workbench/services/themes/electron-browser/workbenchThemeService
'
;
import
{
IWorkbenchThemeService
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
UriLabelService
,
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
interface
WorkbenchParams
{
configuration
:
IWindowConfiguration
;
...
...
@@ -335,6 +336,10 @@ export class Workbench extends Disposable implements IPartService {
// Clipboard
serviceCollection
.
set
(
IClipboardService
,
new
ClipboardService
());
// Uri Display
const
uriLabelService
=
new
UriLabelService
(
this
.
environmentService
,
this
.
contextService
);
serviceCollection
.
set
(
IUriLabelService
,
uriLabelService
);
// Status bar
this
.
statusbarPart
=
this
.
instantiationService
.
createInstance
(
StatusbarPart
,
Identifiers
.
STATUSBAR_PART
);
this
.
_register
(
toDisposable
(()
=>
this
.
statusbarPart
.
shutdown
()));
...
...
src/vs/workbench/parts/files/electron-browser/views/emptyView.ts
浏览文件 @
a03b3b50
...
...
@@ -103,7 +103,7 @@ export class EmptyView extends ViewletPanel {
if
(
this
.
button
)
{
this
.
button
.
label
=
nls
.
localize
(
'
addFolder
'
,
"
Add Folder
"
);
}
this
.
titleDiv
.
text
(
this
.
contextService
.
getWorkspace
().
name
);
this
.
titleDiv
.
text
(
EmptyView
.
NAME
);
}
else
{
this
.
messageDiv
.
text
(
nls
.
localize
(
'
noFolderHelp
'
,
"
You have not yet opened a folder.
"
));
if
(
this
.
button
)
{
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
浏览文件 @
a03b3b50
...
...
@@ -43,6 +43,7 @@ import { Schemas } from 'vs/base/common/network';
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IViewletPanelOptions
}
from
'
vs/workbench/browser/parts/views/panelViewlet
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
export
interface
IExplorerViewOptions
extends
IViewletViewOptions
{
viewletState
:
FileViewletState
;
...
...
@@ -94,7 +95,8 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IDecorationsService
decorationService
:
IDecorationsService
@
IDecorationsService
decorationService
:
IDecorationsService
,
@
IUriLabelService
private
uriLabelService
:
IUriLabelService
)
{
super
({
...(
options
as
IViewletPanelOptions
),
ariaHeaderLabel
:
nls
.
localize
(
'
explorerSection
'
,
"
Files Explorer Section
"
)
},
keybindingService
,
contextMenuService
,
configurationService
);
...
...
@@ -147,7 +149,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}
public
get
name
():
string
{
return
this
.
contextService
.
getWorkspace
().
name
;
return
this
.
uriLabelService
.
getWorkspaceLabel
(
this
.
contextService
.
getWorkspace
())
;
}
public
get
title
():
string
{
...
...
src/vs/workbench/parts/logs/electron-browser/logsActions.ts
浏览文件 @
a03b3b50
...
...
@@ -16,6 +16,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import
URI
from
'
vs/base/common/uri
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IQuickPickItem
,
IQuickInputService
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
export
class
OpenLogsFolderAction
extends
Action
{
...
...
@@ -42,14 +43,16 @@ export class ShowLogsAction extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
IQuickInputService
private
quickInputService
:
IQuickInputService
,
@
IOutputService
private
outputService
:
IOutputService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IUriLabelService
private
uriLabelService
:
IUriLabelService
)
{
super
(
id
,
label
);
}
run
():
TPromise
<
void
>
{
const
workspaceName
=
this
.
uriLabelService
.
getWorkspaceLabel
(
this
.
contextService
.
getWorkspace
());
const
entries
:
IQuickPickItem
[]
=
[
{
id
:
Constants
.
rendererLogChannelId
,
label
:
this
.
contextService
.
getWorkspace
().
name
?
nls
.
localize
(
'
rendererProcess
'
,
"
Window ({0})
"
,
this
.
contextService
.
getWorkspace
().
n
ame
)
:
nls
.
localize
(
'
emptyWindow
'
,
"
Window
"
)
},
{
id
:
Constants
.
rendererLogChannelId
,
label
:
workspaceName
?
nls
.
localize
(
'
rendererProcess
'
,
"
Window ({0})
"
,
workspaceN
ame
)
:
nls
.
localize
(
'
emptyWindow
'
,
"
Window
"
)
},
{
id
:
Constants
.
extHostLogChannelId
,
label
:
nls
.
localize
(
'
extensionHost
'
,
"
Extension Host
"
)
},
{
id
:
Constants
.
sharedLogChannelId
,
label
:
nls
.
localize
(
'
sharedProcess
'
,
"
Shared
"
)
},
{
id
:
Constants
.
mainLogChannelId
,
label
:
nls
.
localize
(
'
mainProcess
'
,
"
Main
"
)
}
...
...
@@ -75,14 +78,16 @@ export class OpenLogFileAction extends Action {
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
ICommandService
private
commandService
:
ICommandService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IUriLabelService
private
uriLabelService
:
IUriLabelService
)
{
super
(
id
,
label
);
}
run
():
TPromise
<
void
>
{
const
workspaceName
=
this
.
uriLabelService
.
getWorkspaceLabel
(
this
.
contextService
.
getWorkspace
());
const
entries
:
IQuickPickItem
[]
=
[
{
id
:
URI
.
file
(
paths
.
join
(
this
.
environmentService
.
logsPath
,
`renderer
${
this
.
windowService
.
getCurrentWindowId
()}
.log`
)).
fsPath
,
label
:
this
.
contextService
.
getWorkspace
().
name
?
nls
.
localize
(
'
rendererProcess
'
,
"
Window ({0})
"
,
this
.
contextService
.
getWorkspace
().
n
ame
)
:
nls
.
localize
(
'
emptyWindow
'
,
"
Window
"
)
},
{
id
:
URI
.
file
(
paths
.
join
(
this
.
environmentService
.
logsPath
,
`renderer
${
this
.
windowService
.
getCurrentWindowId
()}
.log`
)).
fsPath
,
label
:
workspaceName
?
nls
.
localize
(
'
rendererProcess
'
,
"
Window ({0})
"
,
workspaceN
ame
)
:
nls
.
localize
(
'
emptyWindow
'
,
"
Window
"
)
},
{
id
:
URI
.
file
(
paths
.
join
(
this
.
environmentService
.
logsPath
,
`exthost
${
this
.
windowService
.
getCurrentWindowId
()}
.log`
)).
fsPath
,
label
:
nls
.
localize
(
'
extensionHost
'
,
"
Extension Host
"
)
},
{
id
:
URI
.
file
(
paths
.
join
(
this
.
environmentService
.
logsPath
,
`sharedprocess.log`
)).
fsPath
,
label
:
nls
.
localize
(
'
sharedProcess
'
,
"
Shared
"
)
},
{
id
:
URI
.
file
(
paths
.
join
(
this
.
environmentService
.
logsPath
,
`main.log`
)).
fsPath
,
label
:
nls
.
localize
(
'
mainProcess
'
,
"
Main
"
)
},
...
...
@@ -142,4 +147,4 @@ export class SetLogLevelAction extends Action {
}
return
void
0
;
}
}
\ No newline at end of file
}
src/vs/workbench/parts/search/test/common/queryBuilder.test.ts
浏览文件 @
a03b3b50
...
...
@@ -41,7 +41,7 @@ suite('QueryBuilder', () => {
instantiationService
.
stub
(
IConfigurationService
,
mockConfigService
);
mockContextService
=
new
TestContextService
();
mockWorkspace
=
new
Workspace
(
'
workspace
'
,
'
workspace
'
,
toWorkspaceFolders
([{
path
:
ROOT_1_URI
.
fsPath
}]));
mockWorkspace
=
new
Workspace
(
'
workspace
'
,
toWorkspaceFolders
([{
path
:
ROOT_1_URI
.
fsPath
}]));
mockContextService
.
setWorkspace
(
mockWorkspace
);
instantiationService
.
stub
(
IWorkspaceContextService
,
mockContextService
);
...
...
src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts
浏览文件 @
a03b3b50
...
...
@@ -39,7 +39,7 @@ const untitledBackupPath = path.join(workspaceBackupPath, 'untitled', crypto.cre
class
TestBackupFileService
extends
BackupFileService
{
constructor
(
workspace
:
Uri
,
backupHome
:
string
,
workspacesJsonPath
:
string
)
{
const
fileService
=
new
FileService
(
new
TestContextService
(
new
Workspace
(
workspace
.
fsPath
,
workspace
.
fsPath
,
toWorkspaceFolders
([{
path
:
workspace
.
fsPath
}]))),
TestEnvironmentService
,
new
TestTextResourceConfigurationService
(),
new
TestConfigurationService
(),
new
TestLifecycleService
(),
new
TestStorageService
(),
new
TestNotificationService
(),
{
disableWatcher
:
true
});
const
fileService
=
new
FileService
(
new
TestContextService
(
new
Workspace
(
workspace
.
fsPath
,
toWorkspaceFolders
([{
path
:
workspace
.
fsPath
}]))),
TestEnvironmentService
,
new
TestTextResourceConfigurationService
(),
new
TestConfigurationService
(),
new
TestLifecycleService
(),
new
TestStorageService
(),
new
TestNotificationService
(),
{
disableWatcher
:
true
});
super
(
workspaceBackupPath
,
fileService
);
}
...
...
src/vs/workbench/services/configuration/node/configurationService.ts
浏览文件 @
a03b3b50
...
...
@@ -41,7 +41,6 @@ import { UserConfiguration } from 'vs/platform/configuration/node/configuration'
import
{
IJSONSchema
,
IJSONSchemaMap
}
from
'
vs/base/common/jsonSchema
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
export
class
WorkspaceService
extends
Disposable
implements
IWorkspaceConfigurationService
,
IWorkspaceContextService
{
...
...
@@ -72,7 +71,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
private
configurationEditingService
:
ConfigurationEditingService
;
private
jsonEditingService
:
JSONEditingService
;
constructor
(
private
environmentService
:
IEnvironmentService
,
private
uriLabelService
:
IUriLabelService
,
private
workspaceSettingsRootFolder
:
string
=
FOLDER_CONFIG_FOLDER_NAME
)
{
constructor
(
private
environmentService
:
IEnvironmentService
,
private
workspaceSettingsRootFolder
:
string
=
FOLDER_CONFIG_FOLDER_NAME
)
{
super
();
this
.
defaultConfiguration
=
new
DefaultConfigurationModel
();
...
...
@@ -341,8 +340,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
.
then
(()
=>
{
const
workspaceFolders
=
toWorkspaceFolders
(
this
.
workspaceConfiguration
.
getFolders
(),
URI
.
file
(
dirname
(
workspaceConfigPath
.
fsPath
)));
const
workspaceId
=
workspaceIdentifier
.
id
;
const
workspaceName
=
this
.
uriLabelService
.
getWorkspaceLabel
({
id
:
workspaceId
,
configPath
:
workspaceConfigPath
.
fsPath
});
return
new
Workspace
(
workspaceId
,
workspaceName
,
workspaceFolders
,
workspaceConfigPath
);
return
new
Workspace
(
workspaceId
,
workspaceFolders
,
workspaceConfigPath
);
});
}
...
...
@@ -364,11 +362,11 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
}
const
id
=
createHash
(
'
md5
'
).
update
(
folder
.
fsPath
).
update
(
ctime
?
String
(
ctime
)
:
''
).
digest
(
'
hex
'
);
return
new
Workspace
(
id
,
t
his
.
uriLabelService
.
getWorkspaceLabel
(
folder
),
t
oWorkspaceFolders
([{
path
:
folder
.
fsPath
}]),
null
,
ctime
);
return
new
Workspace
(
id
,
toWorkspaceFolders
([{
path
:
folder
.
fsPath
}]),
null
,
ctime
);
});
}
else
{
const
id
=
createHash
(
'
md5
'
).
update
(
folder
.
toString
()).
digest
(
'
hex
'
);
return
TPromise
.
as
(
new
Workspace
(
id
,
t
his
.
uriLabelService
.
getWorkspaceLabel
(
folder
),
t
oWorkspaceFolders
([{
uri
:
folder
.
toString
()
}]),
null
));
return
TPromise
.
as
(
new
Workspace
(
id
,
toWorkspaceFolders
([{
uri
:
folder
.
toString
()
}]),
null
));
}
}
...
...
src/vs/workbench/services/configuration/test/common/configurationModels.test.ts
浏览文件 @
a03b3b50
...
...
@@ -115,7 +115,7 @@ suite('WorkspaceConfigurationChangeEvent', () => {
configurationChangeEvent
.
change
([
'
window.restoreWindows
'
],
URI
.
file
(
'
folder2
'
));
configurationChangeEvent
.
telemetryData
(
ConfigurationTarget
.
WORKSPACE
,
{});
let
testObject
=
new
WorkspaceConfigurationChangeEvent
(
configurationChangeEvent
,
new
Workspace
(
'
id
'
,
'
name
'
,
let
testObject
=
new
WorkspaceConfigurationChangeEvent
(
configurationChangeEvent
,
new
Workspace
(
'
id
'
,
[
new
WorkspaceFolder
({
index
:
0
,
name
:
'
1
'
,
uri
:
URI
.
file
(
'
folder1
'
)
}),
new
WorkspaceFolder
({
index
:
1
,
name
:
'
2
'
,
uri
:
URI
.
file
(
'
folder2
'
)
}),
new
WorkspaceFolder
({
index
:
2
,
name
:
'
3
'
,
uri
:
URI
.
file
(
'
folder3
'
)
})]));
...
...
src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts
浏览文件 @
a03b3b50
...
...
@@ -39,7 +39,6 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
CommandService
}
from
'
vs/workbench/services/commands/common/commandService
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
UriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
class
SettingsTestEnvironmentService
extends
EnvironmentService
{
...
...
@@ -103,7 +102,7 @@ suite('ConfigurationEditingService', () => {
instantiationService
=
<
TestInstantiationService
>
workbenchInstantiationService
();
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
,
new
UriLabelService
(
environmentService
)
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
);
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
return
workspaceService
.
initialize
(
noWorkspace
?
{}
as
IWindowConfiguration
:
URI
.
file
(
workspaceDir
)).
then
(()
=>
{
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
...
...
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
浏览文件 @
a03b3b50
...
...
@@ -35,7 +35,6 @@ import { IJSONEditingService } from 'vs/workbench/services/configuration/common/
import
{
JSONEditingService
}
from
'
vs/workbench/services/configuration/node/jsonEditingService
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IWindowConfiguration
}
from
'
vs/platform/windows/common/windows
'
;
import
{
UriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
class
SettingsTestEnvironmentService
extends
EnvironmentService
{
...
...
@@ -87,8 +86,7 @@ suite('WorkspaceContextService - Folder', () => {
workspaceResource
=
folderDir
;
const
globalSettingsFile
=
path
.
join
(
parentDir
,
'
settings.json
'
);
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
uriLabelService
=
new
UriLabelService
(
environmentService
);
workspaceContextService
=
new
WorkspaceService
(
environmentService
,
uriLabelService
);
workspaceContextService
=
new
WorkspaceService
(
environmentService
);
return
(
<
WorkspaceService
>
workspaceContextService
).
initialize
(
URI
.
file
(
folderDir
));
});
});
...
...
@@ -145,8 +143,7 @@ suite('WorkspaceContextService - Workspace', () => {
parentResource
=
parentDir
;
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
path
.
join
(
parentDir
,
'
settings.json
'
));
const
uriLabelService
=
new
UriLabelService
(
environmentService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
,
uriLabelService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
);
const
instantiationService
=
<
TestInstantiationService
>
workbenchInstantiationService
();
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
...
...
@@ -409,8 +406,7 @@ suite('WorkspaceService - Initialization', () => {
const
instantiationService
=
<
TestInstantiationService
>
workbenchInstantiationService
();
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
uriLabelService
=
new
UriLabelService
(
environmentService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
,
uriLabelService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
);
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
...
...
@@ -665,8 +661,7 @@ suite('WorkspaceConfigurationService - Folder', () => {
const
instantiationService
=
<
TestInstantiationService
>
workbenchInstantiationService
();
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
uriLabelService
=
new
UriLabelService
(
environmentService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
,
uriLabelService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
);
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
instantiationService
.
stub
(
IConfigurationService
,
workspaceService
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
...
...
@@ -941,8 +936,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => {
parentResource
=
parentDir
;
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
path
.
join
(
parentDir
,
'
settings.json
'
));
const
uriLabelService
=
new
UriLabelService
(
environmentService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
,
uriLabelService
);
const
workspaceService
=
new
WorkspaceService
(
environmentService
);
const
instantiationService
=
<
TestInstantiationService
>
workbenchInstantiationService
();
instantiationService
.
stub
(
IWorkspaceContextService
,
workspaceService
);
...
...
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
浏览文件 @
a03b3b50
...
...
@@ -23,7 +23,7 @@ import { IMessagePassingProtocol } from 'vs/base/parts/ipc/node/ipc';
import
{
generateRandomPipeName
,
Protocol
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
createServer
,
Server
,
Socket
}
from
'
net
'
;
import
{
Event
,
Emitter
,
debounceEvent
,
mapEvent
,
anyEvent
,
fromNodeEventEmitter
}
from
'
vs/base/common/event
'
;
import
{
IInitData
,
I
WorkspaceData
,
I
ConfigurationInitData
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
IInitData
,
IConfigurationInitData
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
IExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
ICrashReporterService
}
from
'
vs/workbench/services/crashReporter/electron-browser/crashReporterService
'
;
...
...
@@ -38,6 +38,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
import
{
getPathFromAmdModule
}
from
'
vs/base/common/amd
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
isMessageOfType
,
MessageType
,
createMessageOfType
}
from
'
vs/workbench/common/extensionHostProtocol
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
export
interface
IExtensionHostStarter
{
readonly
onCrashed
:
Event
<
[
number
,
string
]
>
;
...
...
@@ -81,7 +82,8 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
@
IWorkspaceConfigurationService
private
readonly
_configurationService
:
IWorkspaceConfigurationService
,
@
ITelemetryService
private
readonly
_telemetryService
:
ITelemetryService
,
@
ICrashReporterService
private
readonly
_crashReporterService
:
ICrashReporterService
,
@
ILogService
private
readonly
_logService
:
ILogService
@
ILogService
private
readonly
_logService
:
ILogService
,
@
IUriLabelService
private
readonly
_uriLabelService
:
IUriLabelService
)
{
// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside
this
.
_isExtensionDevHost
=
this
.
_environmentService
.
isExtensionDevelopment
;
...
...
@@ -371,6 +373,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
private
_createExtHostInitData
():
TPromise
<
IInitData
>
{
return
TPromise
.
join
([
this
.
_telemetryService
.
getTelemetryInfo
(),
this
.
_extensions
]).
then
(([
telemetryInfo
,
extensionDescriptions
])
=>
{
const
configurationData
:
IConfigurationInitData
=
{
...
this
.
_configurationService
.
getConfigurationData
(),
configurationScopes
:
{}
};
const
workspace
=
this
.
_contextService
.
getWorkspace
();
const
r
:
IInitData
=
{
parentPid
:
process
.
pid
,
environment
:
{
...
...
@@ -380,7 +383,12 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
extensionDevelopmentPath
:
this
.
_environmentService
.
extensionDevelopmentPath
,
extensionTestsPath
:
this
.
_environmentService
.
extensionTestsPath
},
workspace
:
this
.
_contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
?
null
:
<
IWorkspaceData
>
this
.
_contextService
.
getWorkspace
(),
workspace
:
this
.
_contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
?
null
:
{
configuration
:
workspace
.
configuration
,
folders
:
workspace
.
folders
,
id
:
workspace
.
id
,
name
:
this
.
_uriLabelService
.
getWorkspaceLabel
(
workspace
)
},
extensions
:
extensionDescriptions
,
// Send configurations scopes only in development mode.
configuration
:
!
this
.
_environmentService
.
isBuilt
||
this
.
_environmentService
.
isExtensionDevelopment
?
{
...
configurationData
,
configurationScopes
:
getScopes
()
}
:
configurationData
,
...
...
src/vs/workbench/services/files/test/electron-browser/fileService.test.ts
浏览文件 @
a03b3b50
...
...
@@ -37,7 +37,7 @@ suite('FileService', () => {
const
sourceDir
=
getPathFromAmdModule
(
require
,
'
./fixtures/service
'
);
return
pfs
.
copy
(
sourceDir
,
testDir
).
then
(()
=>
{
service
=
new
FileService
(
new
TestContextService
(
new
Workspace
(
testDir
,
t
estDir
,
t
oWorkspaceFolders
([{
path
:
testDir
}]))),
TestEnvironmentService
,
new
TestTextResourceConfigurationService
(),
new
TestConfigurationService
(),
new
TestLifecycleService
(),
new
TestStorageService
(),
new
TestNotificationService
(),
{
disableWatcher
:
true
});
service
=
new
FileService
(
new
TestContextService
(
new
Workspace
(
testDir
,
toWorkspaceFolders
([{
path
:
testDir
}]))),
TestEnvironmentService
,
new
TestTextResourceConfigurationService
(),
new
TestConfigurationService
(),
new
TestLifecycleService
(),
new
TestStorageService
(),
new
TestNotificationService
(),
{
disableWatcher
:
true
});
});
});
...
...
@@ -853,7 +853,7 @@ suite('FileService', () => {
const
textResourceConfigurationService
=
new
TestTextResourceConfigurationService
(
configurationService
);
const
_service
=
new
FileService
(
new
TestContextService
(
new
Workspace
(
_testDir
,
_testDir
,
toWorkspaceFolders
([{
path
:
_testDir
}]))),
new
TestContextService
(
new
Workspace
(
_testDir
,
toWorkspaceFolders
([{
path
:
_testDir
}]))),
TestEnvironmentService
,
textResourceConfigurationService
,
configurationService
,
...
...
@@ -898,7 +898,7 @@ suite('FileService', () => {
const
textResourceConfigurationService
=
new
TestTextResourceConfigurationService
(
configurationService
);
const
_service
=
new
FileService
(
new
TestContextService
(
new
Workspace
(
_testDir
,
_testDir
,
toWorkspaceFolders
([{
path
:
_testDir
}]))),
new
TestContextService
(
new
Workspace
(
_testDir
,
toWorkspaceFolders
([{
path
:
_testDir
}]))),
TestEnvironmentService
,
textResourceConfigurationService
,
configurationService
,
...
...
@@ -932,7 +932,7 @@ suite('FileService', () => {
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
));
const
_service
=
new
FileService
(
new
TestContextService
(
new
Workspace
(
_testDir
,
_testDir
,
toWorkspaceFolders
([{
path
:
_testDir
}]))),
new
TestContextService
(
new
Workspace
(
_testDir
,
toWorkspaceFolders
([{
path
:
_testDir
}]))),
TestEnvironmentService
,
new
TestTextResourceConfigurationService
(),
new
TestConfigurationService
(),
...
...
src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts
浏览文件 @
a03b3b50
...
...
@@ -86,7 +86,7 @@ suite('KeybindingsEditing', () => {
instantiationService
.
stub
(
ILogService
,
new
TestLogService
());
instantiationService
.
stub
(
IModelService
,
instantiationService
.
createInstance
(
ModelServiceImpl
));
instantiationService
.
stub
(
IFileService
,
new
FileService
(
new
TestContextService
(
new
Workspace
(
testDir
,
t
estDir
,
t
oWorkspaceFolders
([{
path
:
testDir
}]))),
new
TestContextService
(
new
Workspace
(
testDir
,
toWorkspaceFolders
([{
path
:
testDir
}]))),
TestEnvironmentService
,
new
TestTextResourceConfigurationService
(),
new
TestConfigurationService
(),
...
...
src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts
浏览文件 @
a03b3b50
...
...
@@ -16,7 +16,7 @@ import { FileKind } from 'vs/platform/files/common/files';
suite
(
'
Breadcrumb Model
'
,
function
()
{
const
workspaceService
=
new
TestContextService
(
new
Workspace
(
'
ffff
'
,
'
Test
'
,
[
new
WorkspaceFolder
({
uri
:
URI
.
parse
(
'
foo:/bar/baz/ws
'
),
name
:
'
ws
'
,
index
:
0
})]));
const
workspaceService
=
new
TestContextService
(
new
Workspace
(
'
ffff
'
,
[
new
WorkspaceFolder
({
uri
:
URI
.
parse
(
'
foo:/bar/baz/ws
'
),
name
:
'
ws
'
,
index
:
0
})]));
const
configService
=
new
class
extends
TestConfigurationService
{
getValue
(...
args
:
any
[])
{
if
(
args
[
0
]
===
'
breadcrumbs.filePath
'
)
{
...
...
src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
浏览文件 @
a03b3b50
...
...
@@ -21,7 +21,7 @@ import { Range } from 'vs/editor/common/core/range';
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
TestFileService
,
TestEditorService
,
TestEditorGroupsService
,
TestEnvironmentService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
TestFileService
,
TestEditorService
,
TestEditorGroupsService
,
TestEnvironmentService
,
TestContextService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ResourceTextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
BulkEditService
}
from
'
vs/workbench/services/bulkEdit/electron-browser/bulkEditService
'
;
...
...
@@ -84,7 +84,7 @@ suite('MainThreadEditors', () => {
}
};
const
bulkEditService
=
new
BulkEditService
(
new
NullLogService
(),
modelService
,
new
TestEditorService
(),
textModelService
,
new
TestFileService
(),
textFileService
,
new
UriLabelService
(
TestEnvironmentService
));
const
bulkEditService
=
new
BulkEditService
(
new
NullLogService
(),
modelService
,
new
TestEditorService
(),
textModelService
,
new
TestFileService
(),
textFileService
,
new
UriLabelService
(
TestEnvironmentService
,
new
TestContextService
()
));
const
rpcProtocol
=
new
TestRPCProtocol
();
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDocuments
,
new
class
extends
mock
<
ExtHostDocumentsShape
>
()
{
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
a03b3b50
...
...
@@ -271,7 +271,7 @@ export function workbenchInstantiationService(): IInstantiationService {
instantiationService
.
stub
(
IHashService
,
new
TestHashService
());
instantiationService
.
stub
(
ILogService
,
new
TestLogService
());
instantiationService
.
stub
(
IEditorGroupsService
,
new
TestEditorGroupsService
([
new
TestEditorGroup
(
0
)]));
instantiationService
.
stub
(
IUriLabelService
,
new
UriLabelService
(
TestEnvironmentService
));
instantiationService
.
stub
(
IUriLabelService
,
new
UriLabelService
(
TestEnvironmentService
,
workspaceContextService
));
const
editorService
=
new
TestEditorService
();
instantiationService
.
stub
(
IEditorService
,
editorService
);
instantiationService
.
stub
(
ICodeEditorService
,
new
TestCodeEditorService
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录