Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9754a210
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 搜索 >>
提交
9754a210
编写于
6月 12, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "extract more functionality into IWorkspace"
This reverts commit
25b4b172
.
上级
7a927e30
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
71 addition
and
108 deletion
+71
-108
src/vs/editor/browser/standalone/standaloneServices.ts
src/vs/editor/browser/standalone/standaloneServices.ts
+4
-4
src/vs/platform/workspace/common/workspace.ts
src/vs/platform/workspace/common/workspace.ts
+15
-45
src/vs/platform/workspace/test/common/testWorkspace.ts
src/vs/platform/workspace/test/common/testWorkspace.ts
+6
-6
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+10
-10
src/vs/workbench/node/extensionHostMain.ts
src/vs/workbench/node/extensionHostMain.ts
+2
-9
src/vs/workbench/parts/terminal/test/electron-browser/terminalLinkHandler.test.ts
...erminal/test/electron-browser/terminalLinkHandler.test.ts
+5
-4
src/vs/workbench/services/configuration/node/configurationService.ts
...bench/services/configuration/node/configurationService.ts
+10
-9
src/vs/workbench/services/configuration/test/node/configurationEditingService.test.ts
...nfiguration/test/node/configurationEditingService.test.ts
+4
-6
src/vs/workbench/services/configuration/test/node/configurationService.test.ts
...ices/configuration/test/node/configurationService.test.ts
+11
-11
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
...h/test/electron-browser/quickopen.perf.integrationTest.ts
+2
-2
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
.../test/electron-browser/textsearch.perf.integrationTest.ts
+2
-2
未找到文件。
src/vs/editor/browser/standalone/standaloneServices.ts
浏览文件 @
9754a210
...
...
@@ -22,7 +22,7 @@ import { IMessageService } from 'vs/platform/message/common/message';
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IStorageService
,
NullStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
,
WorkspaceContextService
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
,
WorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
EditorWorkerServiceImpl
}
from
'
vs/editor/common/services/editorWorkerServiceImpl
'
;
...
...
@@ -115,9 +115,9 @@ export module StaticServices {
export
const
instantiationService
=
define
<
IInstantiationService
>
(
IInstantiationService
,
()
=>
new
InstantiationService
(
_serviceCollection
,
true
));
export
const
contextService
=
define
(
IWorkspaceContextService
,
()
=>
new
WorkspaceContextService
(
new
Workspace
(
URI
.
from
({
scheme
:
'
inmemory
'
,
authority
:
'
model
'
,
path
:
'
/
'
})
)
));
export
const
contextService
=
define
(
IWorkspaceContextService
,
()
=>
new
WorkspaceContextService
(
{
resource
:
URI
.
from
({
scheme
:
'
inmemory
'
,
authority
:
'
model
'
,
path
:
'
/
'
})
}
));
export
const
telemetryService
=
define
(
ITelemetryService
,
()
=>
new
StandaloneTelemetryService
());
...
...
src/vs/platform/workspace/common/workspace.ts
浏览文件 @
9754a210
...
...
@@ -65,26 +65,27 @@ export interface IWorkspace {
name
?:
string
;
}
export
class
Workspace
implements
IWorkspa
ce
{
export
class
Workspace
ContextService
implements
IWorkspaceContextServi
ce
{
constructor
(
private
_resource
:
URI
,
private
_uid
?:
number
,
private
_name
?:
string
)
{
}
public
_serviceBrand
:
any
;
public
get
resource
():
URI
{
return
this
.
_resource
;
private
workspace
:
IWorkspace
;
constructor
(
workspace
:
IWorkspace
)
{
this
.
workspace
=
workspace
;
}
public
get
uid
():
number
{
return
this
.
_uid
;
public
get
Workspace
():
IWorkspace
{
return
this
.
workspace
;
}
public
get
name
():
string
{
return
this
.
_nam
e
;
public
hasWorkspace
():
boolean
{
return
!!
this
.
workspac
e
;
}
public
isInsideWorkspace
(
resource
:
URI
):
boolean
{
if
(
resource
)
{
return
isEqualOrParent
(
resource
.
fsPath
,
this
.
_
resource
.
fsPath
,
!
isLinux
/* ignorecase */
);
if
(
resource
&&
this
.
workspace
)
{
return
isEqualOrParent
(
resource
.
fsPath
,
this
.
workspace
.
resource
.
fsPath
,
!
isLinux
/* ignorecase */
);
}
return
false
;
...
...
@@ -92,48 +93,17 @@ export class Workspace implements IWorkspace {
public
toWorkspaceRelativePath
(
resource
:
URI
,
toOSPath
?:
boolean
):
string
{
if
(
this
.
isInsideWorkspace
(
resource
))
{
return
paths
.
normalize
(
paths
.
relative
(
this
.
_
resource
.
fsPath
,
resource
.
fsPath
),
toOSPath
);
return
paths
.
normalize
(
paths
.
relative
(
this
.
workspace
.
resource
.
fsPath
,
resource
.
fsPath
),
toOSPath
);
}
return
null
;
}
public
toResource
(
workspaceRelativePath
:
string
):
URI
{
if
(
typeof
workspaceRelativePath
===
'
string
'
)
{
return
URI
.
file
(
paths
.
join
(
this
.
_
resource
.
fsPath
,
workspaceRelativePath
));
if
(
typeof
workspaceRelativePath
===
'
string
'
&&
this
.
workspace
)
{
return
URI
.
file
(
paths
.
join
(
this
.
workspace
.
resource
.
fsPath
,
workspaceRelativePath
));
}
return
null
;
}
}
export
class
WorkspaceContextService
implements
IWorkspaceContextService
{
public
_serviceBrand
:
any
;
private
workspace
:
Workspace
;
constructor
(
workspace
?:
Workspace
)
{
this
.
workspace
=
workspace
;
}
public
getWorkspace
():
IWorkspace
{
return
this
.
workspace
;
}
public
hasWorkspace
():
boolean
{
return
!!
this
.
workspace
;
}
public
isInsideWorkspace
(
resource
:
URI
):
boolean
{
return
this
.
workspace
?
this
.
workspace
.
isInsideWorkspace
(
resource
)
:
false
;
}
public
toWorkspaceRelativePath
(
resource
:
URI
,
toOSPath
?:
boolean
):
string
{
return
this
.
workspace
?
this
.
workspace
.
toWorkspaceRelativePath
(
resource
,
toOSPath
)
:
null
;
}
public
toResource
(
workspaceRelativePath
:
string
):
URI
{
return
this
.
workspace
?
this
.
workspace
.
toResource
(
workspaceRelativePath
)
:
null
;
}
}
\ No newline at end of file
src/vs/platform/workspace/test/common/testWorkspace.ts
浏览文件 @
9754a210
...
...
@@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
I
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
URI
from
'
vs/base/common/uri
'
;
export
const
TestWorkspace
=
new
Workspace
(
URI
.
file
(
'
C:
\\
testWorkspace
'
),
Date
.
now
()
,
'
Test Workspace
'
)
;
export
const
TestWorkspace
:
IWorkspace
=
{
resource
:
URI
.
file
(
'
C:
\\
testWorkspace
'
),
name
:
'
Test Workspace
'
,
uid
:
Date
.
now
()
}
;
src/vs/workbench/electron-browser/main.ts
浏览文件 @
9754a210
...
...
@@ -18,7 +18,7 @@ import paths = require('vs/base/common/paths');
import
uri
from
'
vs/base/common/uri
'
;
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
WorkspaceContextService
,
Workspa
ce
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspace
,
WorkspaceContextServi
ce
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/node/configurationService
'
;
import
{
ParsedArgs
}
from
'
vs/platform/environment/common/environment
'
;
import
{
realpath
,
stat
}
from
'
vs/base/node/pfs
'
;
...
...
@@ -116,7 +116,7 @@ function toInputs(paths: IPath[], isUntitledFile?: boolean): IResourceInput[] {
});
}
function
getWorkspace
(
workspacePath
:
string
):
TPromise
<
Workspace
>
{
function
getWorkspace
(
workspacePath
:
string
):
TPromise
<
I
Workspace
>
{
if
(
!
workspacePath
)
{
return
TPromise
.
as
(
null
);
}
...
...
@@ -135,23 +135,23 @@ function getWorkspace(workspacePath: string): TPromise<Workspace> {
const
folderName
=
path
.
basename
(
realWorkspacePath
)
||
realWorkspacePath
;
return
stat
(
realWorkspacePath
).
then
(
folderStat
=>
{
return
new
Workspace
(
workspaceResource
,
platform
.
isLinux
?
folderStat
.
ino
:
folderStat
.
birthtime
.
getTime
()
,
folderName
// On Linux, birthtime is ctime, so we cannot use it! We use the ino instead!
)
;
return
<
IWorkspace
>
{
'
resource
'
:
workspaceResource
,
'
name
'
:
folderName
,
'
uid
'
:
platform
.
isLinux
?
folderStat
.
ino
:
folderStat
.
birthtime
.
getTime
()
// On Linux, birthtime is ctime, so we cannot use it! We use the ino instead!
}
;
});
},
error
=>
{
},
(
error
)
=>
{
errors
.
onUnexpectedError
(
error
);
return
null
;
// treat invalid paths as empty workspace
});
}
function
openWorkbench
(
environment
:
IWindowConfiguration
,
workspace
:
Workspace
,
options
:
IOptions
):
TPromise
<
void
>
{
function
openWorkbench
(
environment
:
IWindowConfiguration
,
workspace
:
I
Workspace
,
options
:
IOptions
):
TPromise
<
void
>
{
const
environmentService
=
new
EnvironmentService
(
environment
,
environment
.
execPath
);
const
contextService
=
new
WorkspaceContextService
(
workspace
);
const
configurationService
=
new
WorkspaceConfigurationService
(
environmentService
,
workspa
ce
);
const
configurationService
=
new
WorkspaceConfigurationService
(
contextService
,
environmentServi
ce
);
const
timerService
=
new
TimerService
((
<
any
>
window
).
MonacoEnvironment
.
timers
as
IInitData
,
!
contextService
.
hasWorkspace
());
// Since the configuration service is one of the core services that is used in so many places, we initialize it
...
...
src/vs/workbench/node/extensionHostMain.ts
浏览文件 @
9754a210
...
...
@@ -15,7 +15,7 @@ import { ExtHostThreadService } from 'vs/workbench/services/thread/common/extHos
import
{
QueryType
,
ISearchQuery
}
from
'
vs/platform/search/common/search
'
;
import
{
DiskSearch
}
from
'
vs/workbench/services/search/node/searchService
'
;
import
{
RemoteTelemetryService
}
from
'
vs/workbench/api/node/extHostTelemetry
'
;
import
{
IWorkspaceContextService
,
WorkspaceContextService
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
,
WorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IInitData
,
IEnvironment
,
MainContext
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
...
...
@@ -43,14 +43,7 @@ export class ExtensionHostMain {
constructor
(
remoteCom
:
IRemoteCom
,
initData
:
IInitData
)
{
// services
this
.
_environment
=
initData
.
environment
;
const
workspaceRaw
=
initData
.
contextService
.
workspace
;
let
workspace
:
Workspace
;
if
(
workspaceRaw
)
{
workspace
=
new
Workspace
(
workspaceRaw
.
resource
,
workspaceRaw
.
uid
,
workspaceRaw
.
name
);
}
this
.
_contextService
=
new
WorkspaceContextService
(
workspace
);
this
.
_contextService
=
new
WorkspaceContextService
(
initData
.
contextService
.
workspace
);
const
threadService
=
new
ExtHostThreadService
(
remoteCom
);
const
telemetryService
=
new
RemoteTelemetryService
(
'
pluginHostTelemetry
'
,
threadService
);
this
.
_extensionService
=
new
ExtHostExtensionService
(
initData
,
threadService
,
telemetryService
,
this
.
_contextService
);
...
...
src/vs/workbench/parts/terminal/test/electron-browser/terminalLinkHandler.test.ts
浏览文件 @
9754a210
...
...
@@ -8,7 +8,7 @@
import
*
as
assert
from
'
assert
'
;
import
{
Platform
}
from
'
vs/base/common/platform
'
;
import
{
TerminalLinkHandler
,
LineColumnInfo
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalLinkHandler
'
;
import
{
WorkspaceContextService
,
Workspa
ce
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspace
,
WorkspaceContextServi
ce
}
from
'
vs/platform/workspace/common/workspace
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
*
as
path
from
'
path
'
;
...
...
@@ -44,9 +44,10 @@ interface LinkFormatInfo {
column
?:
string
;
}
class
TestWorkspace
extends
Workspace
{
constructor
(
private
basePath
:
string
)
{
super
(
new
TestURI
(
basePath
));
class
TestWorkspace
implements
IWorkspace
{
resource
:
URI
;
constructor
(
basePath
:
string
)
{
this
.
resource
=
new
TestURI
(
basePath
);
}
}
...
...
src/vs/workbench/services/configuration/node/configurationService.ts
浏览文件 @
9754a210
...
...
@@ -12,6 +12,7 @@ import extfs = require('vs/base/node/extfs');
import
objects
=
require
(
'
vs/base/common/objects
'
);
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
collections
=
require
(
'
vs/base/common/collections
'
);
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
readFile
}
from
'
vs/base/node/pfs
'
;
...
...
@@ -23,7 +24,7 @@ import { ConfigurationService as BaseConfigurationService } from 'vs/platform/co
import
{
IWorkspaceConfigurationValues
,
IWorkspaceConfigurationService
,
IWorkspaceConfigurationValue
,
WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME
,
WORKSPACE_STANDALONE_CONFIGURATIONS
,
WORKSPACE_CONFIG_DEFAULT_PATH
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
FileChangeType
,
FileChangesEvent
,
isEqual
}
from
'
vs/platform/files/common/files
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Workspace
}
from
"
vs/platform/workspace/common/workspace
"
;
interface
IStat
{
resource
:
uri
;
...
...
@@ -61,8 +62,8 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
private
reloadConfigurationScheduler
:
RunOnceScheduler
;
constructor
(
private
environmentService
:
IEnvironmen
tService
,
private
workspace
?:
Workspa
ce
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContex
tService
,
@
IEnvironmentService
environmentService
:
IEnvironmentServi
ce
,
private
workspaceSettingsRootFolder
:
string
=
WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME
)
{
super
();
...
...
@@ -215,13 +216,13 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
private
loadWorkspaceConfigFiles
<
T
>
():
TPromise
<
{
[
relativeWorkspacePath
:
string
]:
IConfigModel
<
T
>
}
>
{
// Return early if we don't have a workspace
if
(
!
this
.
workspace
)
{
if
(
!
this
.
contextService
.
hasWorkspace
()
)
{
return
TPromise
.
as
(
Object
.
create
(
null
));
}
// once: when invoked for the first time we fetch json files that contribute settings
if
(
!
this
.
bulkFetchFromWorkspacePromise
)
{
this
.
bulkFetchFromWorkspacePromise
=
resolveStat
(
this
.
workspa
ce
.
toResource
(
this
.
workspaceSettingsRootFolder
)).
then
(
stat
=>
{
this
.
bulkFetchFromWorkspacePromise
=
resolveStat
(
this
.
contextServi
ce
.
toResource
(
this
.
workspaceSettingsRootFolder
)).
then
(
stat
=>
{
if
(
!
stat
.
isDirectory
)
{
return
TPromise
.
as
([]);
}
...
...
@@ -232,11 +233,11 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
return
false
;
// only JSON files
}
return
this
.
isWorkspaceConfigurationFile
(
this
.
workspa
ce
.
toWorkspaceRelativePath
(
stat
.
resource
));
// only workspace config files
return
this
.
isWorkspaceConfigurationFile
(
this
.
contextServi
ce
.
toWorkspaceRelativePath
(
stat
.
resource
));
// only workspace config files
}).
map
(
stat
=>
stat
.
resource
));
},
err
=>
[]
/* never fail this call */
)
.
then
((
contents
:
IContent
[])
=>
{
contents
.
forEach
(
content
=>
this
.
workspaceFilePathToConfiguration
[
this
.
workspa
ce
.
toWorkspaceRelativePath
(
content
.
resource
)]
=
TPromise
.
as
(
this
.
createConfigModel
(
content
)));
contents
.
forEach
(
content
=>
this
.
workspaceFilePathToConfiguration
[
this
.
contextServi
ce
.
toWorkspaceRelativePath
(
content
.
resource
)]
=
TPromise
.
as
(
this
.
createConfigModel
(
content
)));
},
errors
.
onUnexpectedError
);
}
...
...
@@ -258,7 +259,7 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
continue
;
// only JSON files or the actual settings folder
}
const
workspacePath
=
this
.
workspa
ce
.
toWorkspaceRelativePath
(
resource
);
const
workspacePath
=
this
.
contextServi
ce
.
toWorkspaceRelativePath
(
resource
);
if
(
!
workspacePath
)
{
continue
;
// event is not inside workspace
}
...
...
@@ -294,7 +295,7 @@ export class WorkspaceConfigurationService extends Disposable implements IWorksp
}
private
createConfigModel
<
T
>
(
content
:
IContent
):
IConfigModel
<
T
>
{
const
path
=
this
.
workspa
ce
.
toWorkspaceRelativePath
(
content
.
resource
);
const
path
=
this
.
contextServi
ce
.
toWorkspaceRelativePath
(
content
.
resource
);
if
(
path
===
WORKSPACE_CONFIG_DEFAULT_PATH
)
{
return
new
WorkspaceSettingsConfigModel
<
T
>
(
content
.
value
,
content
.
resource
.
toString
());
}
else
{
...
...
src/vs/workbench/services/configuration/test/node/configurationEditingService.test.ts
浏览文件 @
9754a210
...
...
@@ -15,7 +15,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
ParsedArgs
,
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
parseArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
{
WorkspaceContextService
,
IWorkspaceContextService
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceContextService
,
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
extfs
=
require
(
'
vs/base/node/extfs
'
);
import
{
TestTextFileService
,
TestEditorGroupService
,
TestLifecycleService
,
TestBackupFileService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
...
...
@@ -113,11 +113,9 @@ suite('ConfigurationEditingService', () => {
clearServices
();
instantiationService
=
new
TestInstantiationService
();
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
instantiationService
.
stub
(
IEnvironmentService
,
environmentService
);
const
workspace
=
noWorkspace
?
null
:
new
Workspace
(
URI
.
file
(
workspaceDir
));
instantiationService
.
stub
(
IWorkspaceContextService
,
new
WorkspaceContextService
(
workspace
));
const
configurationService
=
new
WorkspaceConfigurationService
(
environmentService
,
workspace
);
instantiationService
.
stub
(
IEnvironmentService
,
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
));
instantiationService
.
stub
(
IWorkspaceContextService
,
new
WorkspaceContextService
(
noWorkspace
?
null
:
{
resource
:
URI
.
file
(
workspaceDir
)
}));
const
configurationService
=
instantiationService
.
createInstance
(
WorkspaceConfigurationService
);
instantiationService
.
stub
(
IConfigurationService
,
configurationService
);
instantiationService
.
stub
(
ILifecycleService
,
new
TestLifecycleService
());
instantiationService
.
stub
(
IEditorGroupService
,
new
TestEditorGroupService
());
...
...
src/vs/workbench/services/configuration/test/node/configurationService.test.ts
浏览文件 @
9754a210
...
...
@@ -13,7 +13,7 @@ import * as sinon from 'sinon';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
ParsedArgs
}
from
'
vs/platform/environment/common/environment
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
Workspace
ContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
parseArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
extfs
=
require
(
'
vs/base/node/extfs
'
);
...
...
@@ -47,9 +47,9 @@ suite('WorkspaceConfigurationService - Node', () => {
}
function
createService
(
workspaceDir
:
string
,
globalSettingsFile
:
string
):
TPromise
<
WorkspaceConfigurationService
>
{
const
workspace
=
new
Workspace
(
URI
.
file
(
workspaceDir
)
);
const
workspace
ContextService
=
new
WorkspaceContextService
({
resource
:
URI
.
file
(
workspaceDir
)
}
);
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
service
=
new
WorkspaceConfigurationService
(
environmentService
,
workspa
ce
);
const
service
=
new
WorkspaceConfigurationService
(
workspaceContextService
,
environmentServi
ce
);
return
service
.
initialize
().
then
(()
=>
service
);
}
...
...
@@ -204,9 +204,9 @@ suite('WorkspaceConfigurationService - Node', () => {
test
(
'
workspace change triggers event
'
,
(
done
:
()
=>
void
)
=>
{
createWorkspace
((
workspaceDir
,
globalSettingsFile
,
cleanUp
)
=>
{
const
workspace
=
new
Workspace
(
URI
.
file
(
workspaceDir
)
);
const
workspace
ContextService
=
new
WorkspaceContextService
({
resource
:
URI
.
file
(
workspaceDir
)
}
);
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
service
=
new
WorkspaceConfigurationService
(
environmentService
,
workspa
ce
);
const
service
=
new
WorkspaceConfigurationService
(
workspaceContextService
,
environmentServi
ce
);
return
service
.
initialize
().
then
(()
=>
{
service
.
onDidUpdateConfiguration
(
event
=>
{
...
...
@@ -230,9 +230,9 @@ suite('WorkspaceConfigurationService - Node', () => {
test
(
'
workspace reload should triggers event if content changed
'
,
(
done
:
()
=>
void
)
=>
{
createWorkspace
((
workspaceDir
,
globalSettingsFile
,
cleanUp
)
=>
{
const
workspace
=
new
Workspace
(
URI
.
file
(
workspaceDir
)
);
const
workspace
ContextService
=
new
WorkspaceContextService
({
resource
:
URI
.
file
(
workspaceDir
)
}
);
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
service
=
new
WorkspaceConfigurationService
(
environmentService
,
workspa
ce
);
const
service
=
new
WorkspaceConfigurationService
(
workspaceContextService
,
environmentServi
ce
);
return
service
.
initialize
().
then
(()
=>
{
const
settingsFile
=
path
.
join
(
workspaceDir
,
'
.vscode
'
,
'
settings.json
'
);
...
...
@@ -255,9 +255,9 @@ suite('WorkspaceConfigurationService - Node', () => {
test
(
'
workspace reload should not trigger event if nothing changed
'
,
(
done
:
()
=>
void
)
=>
{
createWorkspace
((
workspaceDir
,
globalSettingsFile
,
cleanUp
)
=>
{
const
workspace
=
new
Workspace
(
URI
.
file
(
workspaceDir
)
);
const
workspace
ContextService
=
new
WorkspaceContextService
({
resource
:
URI
.
file
(
workspaceDir
)
}
);
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
service
=
new
WorkspaceConfigurationService
(
environmentService
,
workspa
ce
);
const
service
=
new
WorkspaceConfigurationService
(
workspaceContextService
,
environmentServi
ce
);
return
service
.
initialize
().
then
(()
=>
{
const
settingsFile
=
path
.
join
(
workspaceDir
,
'
.vscode
'
,
'
settings.json
'
);
...
...
@@ -280,9 +280,9 @@ suite('WorkspaceConfigurationService - Node', () => {
test
(
'
workspace reload should not trigger event if there is no model
'
,
(
done
:
()
=>
void
)
=>
{
createWorkspace
((
workspaceDir
,
globalSettingsFile
,
cleanUp
)
=>
{
const
workspace
=
new
Workspace
(
URI
.
file
(
workspaceDir
)
);
const
workspace
ContextService
=
new
WorkspaceContextService
({
resource
:
URI
.
file
(
workspaceDir
)
}
);
const
environmentService
=
new
SettingsTestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
,
globalSettingsFile
);
const
service
=
new
WorkspaceConfigurationService
(
environmentService
,
workspa
ce
);
const
service
=
new
WorkspaceConfigurationService
(
workspaceContextService
,
environmentServi
ce
);
return
service
.
initialize
().
then
(()
=>
{
const
target
=
sinon
.
stub
();
...
...
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
浏览文件 @
9754a210
...
...
@@ -7,7 +7,7 @@
import
'
vs/workbench/parts/search/browser/search.contribution
'
;
// load contributions
import
*
as
assert
from
'
assert
'
;
import
{
WorkspaceContextService
,
IWorkspaceContextService
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceContextService
,
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
createSyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ISearchService
}
from
'
vs/platform/search/common/search
'
;
...
...
@@ -73,7 +73,7 @@ suite('QuickOpen performance (integration)', () => {
[
ITelemetryService
,
telemetryService
],
[
IConfigurationService
,
new
SimpleConfigurationService
()],
[
IModelService
,
new
ModelServiceImpl
(
null
,
configurationService
)],
[
IWorkspaceContextService
,
new
WorkspaceContextService
(
new
Workspace
(
URI
.
file
(
testWorkspacePath
))
)],
[
IWorkspaceContextService
,
new
WorkspaceContextService
(
{
resource
:
URI
.
file
(
testWorkspacePath
)
}
)],
[
IWorkbenchEditorService
,
new
TestEditorService
()],
[
IEditorGroupService
,
new
TestEditorGroupService
()],
[
IEnvironmentService
,
TestEnvironmentService
],
...
...
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
浏览文件 @
9754a210
...
...
@@ -8,7 +8,7 @@
import
'
vs/workbench/parts/search/browser/search.contribution
'
;
// load contributions
import
*
as
assert
from
'
assert
'
;
import
*
as
fs
from
'
fs
'
;
import
{
WorkspaceContextService
,
IWorkspaceContextService
,
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
WorkspaceContextService
,
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
createSyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ISearchService
,
IQueryOptions
}
from
'
vs/platform/search/common/search
'
;
...
...
@@ -62,7 +62,7 @@ suite('TextSearch performance (integration)', () => {
[
ITelemetryService
,
telemetryService
],
[
IConfigurationService
,
new
SimpleConfigurationService
()],
[
IModelService
,
new
ModelServiceImpl
(
null
,
configurationService
)],
[
IWorkspaceContextService
,
new
WorkspaceContextService
(
new
Workspace
(
URI
.
file
(
testWorkspacePath
))
)],
[
IWorkspaceContextService
,
new
WorkspaceContextService
(
{
resource
:
URI
.
file
(
testWorkspacePath
)
}
)],
[
IWorkbenchEditorService
,
new
TestEditorService
()],
[
IEditorGroupService
,
new
TestEditorGroupService
()],
[
IEnvironmentService
,
TestEnvironmentService
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录