Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
84c4c8d4
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 搜索 >>
提交
84c4c8d4
编写于
8月 17, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add meaningful defaults to paths, product and package to survive test runs
上级
d2a413ee
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
68 addition
and
20 deletion
+68
-20
src/vs/base/node/paths.ts
src/vs/base/node/paths.ts
+31
-4
src/vs/platform/configuration/common/configurationService.ts
src/vs/platform/configuration/common/configurationService.ts
+5
-6
src/vs/platform/package.ts
src/vs/platform/package.ts
+13
-3
src/vs/platform/product.ts
src/vs/platform/product.ts
+5
-1
src/vs/test/utils/servicesTestUtils.ts
src/vs/test/utils/servicesTestUtils.ts
+4
-0
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+1
-1
src/vs/workbench/services/configuration/node/configurationService.ts
...bench/services/configuration/node/configurationService.ts
+5
-3
src/vs/workbench/test/browser/parts/quickOpen/quickopen.perf.test.ts
...bench/test/browser/parts/quickOpen/quickopen.perf.test.ts
+4
-2
未找到文件。
src/vs/base/node/paths.ts
浏览文件 @
84c4c8d4
...
...
@@ -4,13 +4,40 @@
*--------------------------------------------------------------------------------------------*/
import
uri
from
'
vs/base/common/uri
'
;
import
*
as
path
from
'
path
'
;
import
*
as
os
from
'
os
'
;
interface
IPaths
{
getAppDataPath
(
platform
:
string
):
string
;
getUserDataPath
(
platform
:
string
,
appName
:
string
,
args
:
string
[]):
string
;
}
const
pathsPath
=
uri
.
parse
(
require
.
toUrl
(
'
paths
'
)).
fsPath
;
const
paths
=
require
.
__$__nodeRequire
<
IPaths
>
(
pathsPath
);
export
const
getAppDataPath
=
paths
.
getAppDataPath
;
export
const
getUserDataPath
=
paths
.
getUserDataPath
;
function
defaultGetAppDataPath
(
platform
)
{
switch
(
platform
)
{
case
'
win32
'
:
return
process
.
env
[
'
APPDATA
'
];
case
'
darwin
'
:
return
path
.
join
(
os
.
homedir
(),
'
Library
'
,
'
Application Support
'
);
case
'
linux
'
:
return
process
.
env
[
'
XDG_CONFIG_HOME
'
]
||
path
.
join
(
os
.
homedir
(),
'
.config
'
);
default
:
throw
new
Error
(
'
Platform not supported
'
);
}
}
function
defaultGetUserDataPath
(
platform
,
appName
)
{
return
path
.
join
(
getAppDataPath
(
platform
),
appName
);
}
let
_getAppDataPath
:
(
platform
:
string
)
=>
string
;
let
_getUserDataPath
:
(
platform
:
string
,
appName
:
string
,
args
:
string
[])
=>
string
;
try
{
const
pathsPath
=
uri
.
parse
(
require
.
toUrl
(
'
paths
'
)).
fsPath
;
const
paths
=
require
.
__$__nodeRequire
<
IPaths
>
(
pathsPath
);
_getAppDataPath
=
paths
.
getAppDataPath
;
_getUserDataPath
=
paths
.
getUserDataPath
;
}
catch
(
error
)
{
_getAppDataPath
=
(
platform
)
=>
defaultGetAppDataPath
(
platform
);
_getUserDataPath
=
(
platform
:
string
,
appName
:
string
,
args
:
string
[])
=>
defaultGetUserDataPath
(
platform
,
appName
);
}
export
const
getAppDataPath
=
_getAppDataPath
;
export
const
getUserDataPath
=
_getUserDataPath
;
src/vs/platform/configuration/common/configurationService.ts
浏览文件 @
84c4c8d4
...
...
@@ -48,8 +48,6 @@ export abstract class ConfigurationService implements IConfigurationService, IDi
private
_onDidUpdateConfiguration
=
new
Emitter
<
IConfigurationServiceEvent
>
();
protected
contextService
:
IWorkspaceContextService
;
protected
eventService
:
IEventService
;
protected
workspaceSettingsRootFolder
:
string
;
private
cachedConfig
:
ILoadConfigResult
;
...
...
@@ -59,10 +57,11 @@ export abstract class ConfigurationService implements IConfigurationService, IDi
private
callOnDispose
:
IDisposable
;
private
reloadConfigurationScheduler
:
RunOnceScheduler
;
constructor
(
contextService
:
IWorkspaceContextService
,
eventService
:
IEventService
,
workspaceSettingsRootFolder
:
string
=
'
.vscode
'
)
{
this
.
contextService
=
contextService
;
this
.
eventService
=
eventService
;
constructor
(
protected
contextService
:
IWorkspaceContextService
,
protected
eventService
:
IEventService
,
workspaceSettingsRootFolder
:
string
=
'
.vscode
'
)
{
this
.
workspaceSettingsRootFolder
=
workspaceSettingsRootFolder
;
this
.
workspaceFilePathToConfiguration
=
Object
.
create
(
null
);
this
.
cachedConfig
=
{
...
...
src/vs/platform/package.ts
浏览文件 @
84c4c8d4
...
...
@@ -11,6 +11,16 @@ export interface IPackageConfiguration {
version
:
string
;
}
const
rootPath
=
path
.
dirname
(
uri
.
parse
(
require
.
toUrl
(
''
)).
fsPath
);
const
packageJsonPath
=
path
.
join
(
rootPath
,
'
package.json
'
);
export
default
require
.
__$__nodeRequire
(
packageJsonPath
)
as
IPackageConfiguration
;
\ No newline at end of file
let
pkg
:
IPackageConfiguration
;
try
{
const
rootPath
=
path
.
dirname
(
uri
.
parse
(
require
.
toUrl
(
''
)).
fsPath
);
const
packageJsonPath
=
path
.
join
(
rootPath
,
'
package.json
'
);
pkg
=
require
.
__$__nodeRequire
(
packageJsonPath
)
as
IPackageConfiguration
;
}
catch
(
error
)
{
pkg
=
{
name
:
'
code-oss-dev
'
,
version
:
'
1.x.x
'
};
}
export
default
pkg
;
\ No newline at end of file
src/vs/platform/product.ts
浏览文件 @
84c4c8d4
...
...
@@ -53,7 +53,11 @@ try {
const
productJsonPath
=
path
.
join
(
rootPath
,
'
product.json
'
);
product
=
require
.
__$__nodeRequire
(
productJsonPath
)
as
IProductConfiguration
;
}
catch
(
error
)
{
product
=
Object
.
create
(
null
);
// can happen in environments where product.json is missing (e.g. when used from tests)
product
=
<
IProductConfiguration
>
{
nameLong
:
'
Code - OSS
'
,
applicationName
:
'
code-oss
'
,
dataFolderName
:
'
.vscode-oss
'
};
}
if
(
process
.
env
[
'
VSCODE_DEV
'
])
{
...
...
src/vs/test/utils/servicesTestUtils.ts
浏览文件 @
84c4c8d4
...
...
@@ -41,6 +41,8 @@ import {IModelService} from 'vs/editor/common/services/modelService';
import
{
ModelServiceImpl
}
from
'
vs/editor/common/services/modelServiceImpl
'
;
import
{
IRawTextContent
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
RawText
}
from
'
vs/editor/common/model/textModel
'
;
import
{
parseArgs
}
from
'
vs/code/node/argv
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
export
const
TestWorkspace
:
IWorkspace
=
{
resource
:
URI
.
file
(
'
C:
\\
testWorkspace
'
),
...
...
@@ -54,6 +56,8 @@ export const TestConfiguration: IConfiguration = {
env
:
Object
.
create
(
null
)
};
export
const
TestEnvironmentService
=
new
EnvironmentService
(
parseArgs
(
process
.
argv
));
export
class
TestContextService
implements
WorkspaceContextService
.
IWorkspaceContextService
{
public
_serviceBrand
:
any
;
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
84c4c8d4
...
...
@@ -139,7 +139,7 @@ function openWorkbench(args: ParsedArgs, workspace: IWorkspace, configuration: I
const
eventService
=
new
EventService
();
const
environmentService
=
new
EnvironmentService
(
args
);
const
contextService
=
new
WorkspaceContextService
(
eventService
,
workspace
,
configuration
,
options
);
const
configurationService
=
new
ConfigurationService
(
contextService
,
eventService
);
const
configurationService
=
new
ConfigurationService
(
contextService
,
eventService
,
environmentService
);
// 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
...
...
src/vs/workbench/services/configuration/node/configurationService.ts
浏览文件 @
84c4c8d4
...
...
@@ -15,6 +15,7 @@ import {IConfigFile} from 'vs/platform/configuration/common/model';
import
objects
=
require
(
'
vs/base/common/objects
'
);
import
{
IStat
,
IContent
,
ConfigurationService
as
CommonConfigurationService
}
from
'
vs/platform/configuration/common/configurationService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
OptionsChangeEvent
,
EventType
}
from
'
vs/workbench/common/events
'
;
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -31,7 +32,8 @@ export class ConfigurationService extends CommonConfigurationService {
constructor
(
contextService
:
IWorkspaceContextService
,
eventService
:
IEventService
eventService
:
IEventService
,
private
environmentService
:
IEnvironmentService
)
{
super
(
contextService
,
eventService
);
...
...
@@ -120,8 +122,8 @@ export class ConfigurationService extends CommonConfigurationService {
}
public
setUserConfiguration
(
key
:
any
,
value
:
any
)
:
Thenable
<
void
>
{
const
appSettingsPath
=
this
.
contextService
.
getConfiguration
().
env
.
appSettingsPath
;
const
appSettingsPath
=
this
.
environmentService
.
appSettingsPath
;
return
readFile
(
appSettingsPath
,
'
utf8
'
).
then
(
content
=>
{
const
{
tabSize
,
insertSpaces
}
=
this
.
getConfiguration
<
{
tabSize
:
number
;
insertSpaces
:
boolean
}
>
(
'
editor
'
);
const
path
:
JSONPath
=
typeof
key
===
'
string
'
?
(
<
string
>
key
).
split
(
'
.
'
)
:
<
JSONPath
>
key
;
...
...
src/vs/workbench/test/browser/parts/quickOpen/quickopen.perf.test.ts
浏览文件 @
84c4c8d4
...
...
@@ -21,7 +21,8 @@ import {QuickOpenHandler, IQuickOpenRegistry, Extensions} from 'vs/workbench/bro
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
SearchService
}
from
'
vs/workbench/services/search/node/searchService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
TestConfiguration
,
TestEditorService
,
TestEditorGroupService
}
from
'
vs/test/utils/servicesTestUtils
'
;
import
{
TestEnvironmentService
,
TestConfiguration
,
TestEditorService
,
TestEditorGroupService
}
from
'
vs/test/utils/servicesTestUtils
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
*
as
Timer
from
'
vs/base/common/timer
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
...
...
@@ -51,13 +52,14 @@ suite('QuickOpen performance', () => {
mtime
:
null
},
TestConfiguration
),
telemetryService
:
telemetryService
telemetryService
};
const
services
=
ensureStaticPlatformServices
(
overrides
);
const
instantiationService
=
services
.
instantiationService
.
createChild
(
new
ServiceCollection
(
[
IWorkbenchEditorService
,
new
TestEditorService
()],
[
IEditorGroupService
,
new
TestEditorGroupService
()],
[
IEnvironmentService
,
TestEnvironmentService
],
[
IUntitledEditorService
,
createSyncDescriptor
(
UntitledEditorService
)],
[
ISearchService
,
createSyncDescriptor
(
SearchService
)]
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录