Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d54054ee
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,发现更多精彩内容 >>
提交
d54054ee
编写于
8月 16, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
introduce and use IEnvironmentService to the renderer (for #6095)
上级
01a25e94
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
10 deletion
+41
-10
src/vs/platform/environment/common/environment.ts
src/vs/platform/environment/common/environment.ts
+8
-1
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+17
-4
src/vs/workbench/browser/actions/openSettings.ts
src/vs/workbench/browser/actions/openSettings.ts
+7
-4
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+4
-1
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+5
-0
未找到文件。
src/vs/platform/environment/common/environment.ts
浏览文件 @
d54054ee
...
...
@@ -12,11 +12,18 @@ export interface IEnvironmentService {
_serviceBrand
:
any
;
appRoot
:
string
;
userHome
:
string
;
userDataPath
:
string
;
appSettingsHome
:
string
;
appSettingsPath
:
string
;
appKeybindingsPath
:
string
;
extensionsPath
:
string
;
extensionDevelopmentPath
:
string
;
isBuilt
:
boolean
;
createPaths
():
TPromise
<
void
>
;
}
}
\ No newline at end of file
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
d54054ee
...
...
@@ -3,16 +3,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
*
as
paths
from
'
vs/base/node/paths
'
;
import
product
from
'
vs/platform/product
'
;
import
pkg
from
'
vs/platform/package
'
;
import
*
as
os
from
'
os
'
;
import
*
as
path
from
'
path
'
;
import
{
mkdirp
}
from
'
vs/base/node/pfs
'
;
import
{
parseArgs
}
from
'
vs/code/node/argv
'
;
import
{
mkdirp
}
from
'
vs/base/node/pfs
'
;
import
{
parseArgs
}
from
'
vs/code/node/argv
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
export
class
EnvironmentService
implements
IEnvironmentService
{
...
...
@@ -27,6 +27,15 @@ export class EnvironmentService implements IEnvironmentService {
private
_userDataPath
:
string
;
get
userDataPath
():
string
{
return
this
.
_userDataPath
;
}
private
_appSettingsHome
:
string
;
get
appSettingsHome
():
string
{
return
this
.
_appSettingsHome
;
}
private
_appSettingsPath
:
string
;
get
appSettingsPath
():
string
{
return
this
.
_appSettingsPath
;
}
private
_appKeybindingsPath
:
string
;
get
appKeybindingsPath
():
string
{
return
this
.
_appKeybindingsPath
;
}
private
_extensionsPath
:
string
;
get
extensionsPath
():
string
{
return
this
.
_extensionsPath
;
}
...
...
@@ -41,6 +50,10 @@ export class EnvironmentService implements IEnvironmentService {
this
.
_appRoot
=
path
.
dirname
(
URI
.
parse
(
require
.
toUrl
(
''
)).
fsPath
);
this
.
_userDataPath
=
paths
.
getUserDataPath
(
process
.
platform
,
pkg
.
name
,
process
.
argv
);
this
.
_appSettingsHome
=
path
.
join
(
this
.
userDataPath
,
'
User
'
);
this
.
_appSettingsPath
=
path
.
join
(
this
.
appSettingsHome
,
'
settings.json
'
);
this
.
_appKeybindingsPath
=
path
.
join
(
this
.
appSettingsHome
,
'
keybindings.json
'
);
this
.
_userHome
=
path
.
join
(
os
.
homedir
(),
product
.
dataFolderName
);
this
.
_extensionsPath
=
argv
.
extensionHomePath
||
path
.
join
(
this
.
_userHome
,
'
extensions
'
);
this
.
_extensionsPath
=
path
.
normalize
(
this
.
_extensionsPath
);
...
...
src/vs/workbench/browser/actions/openSettings.ts
浏览文件 @
d54054ee
...
...
@@ -26,6 +26,7 @@ import {IMessageService, Severity, CloseAction} from 'vs/platform/message/common
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
interface
IWorkbenchSettingsConfiguration
{
...
...
@@ -134,7 +135,8 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IStorageService
private
storageService
:
IStorageService
@
IStorageService
private
storageService
:
IStorageService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
super
(
id
,
label
,
editorService
,
editorGroupService
,
fileService
,
configurationService
,
messageService
,
contextService
,
keybindingService
,
instantiationService
);
}
...
...
@@ -166,7 +168,7 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
// Open settings
let
emptySettingsHeader
=
nls
.
localize
(
'
emptySettingsHeader
'
,
"
Place your settings in this file to overwrite the default settings
"
);
return
this
.
open
(
'
//
'
+
emptySettingsHeader
+
'
\n
{
\n
}
'
,
URI
.
file
(
this
.
contextService
.
getConfiguration
().
env
.
appSettingsPath
));
return
this
.
open
(
'
//
'
+
emptySettingsHeader
+
'
\n
{
\n
}
'
,
URI
.
file
(
this
.
environmentService
.
appSettingsPath
));
}
}
...
...
@@ -185,7 +187,8 @@ export class OpenGlobalKeybindingsAction extends BaseTwoEditorsAction {
@
IMessageService
messageService
:
IMessageService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
super
(
id
,
label
,
editorService
,
editorGroupService
,
fileService
,
configurationService
,
messageService
,
contextService
,
keybindingService
,
instantiationService
);
}
...
...
@@ -193,7 +196,7 @@ export class OpenGlobalKeybindingsAction extends BaseTwoEditorsAction {
public
run
(
event
?:
any
):
TPromise
<
void
>
{
let
emptyContents
=
'
//
'
+
nls
.
localize
(
'
emptyKeybindingsHeader
'
,
"
Place your key bindings in this file to overwrite the defaults
"
)
+
'
\n
[
\n
]
'
;
return
this
.
openTwoEditors
(
DefaultKeybindingsInput
.
getInstance
(
this
.
instantiationService
,
this
.
keybindingService
),
URI
.
file
(
this
.
contextService
.
getConfiguration
().
env
.
appKeybindingsPath
),
emptyContents
);
return
this
.
openTwoEditors
(
DefaultKeybindingsInput
.
getInstance
(
this
.
instantiationService
,
this
.
keybindingService
),
URI
.
file
(
this
.
environmentService
.
appKeybindingsPath
),
emptyContents
);
}
}
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
d54054ee
...
...
@@ -19,6 +19,7 @@ import {EventService} from 'vs/platform/event/common/eventService';
import
{
WorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
import
{
IWorkspace
,
IConfiguration
,
IEnvironment
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ConfigurationService
}
from
'
vs/workbench/services/configuration/node/configurationService
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
path
=
require
(
'
path
'
);
import
fs
=
require
(
'
fs
'
);
import
gracefulFs
=
require
(
'
graceful-fs
'
);
...
...
@@ -129,6 +130,7 @@ function getWorkspace(environment: IMainEnvironment): IWorkspace {
function
openWorkbench
(
workspace
:
IWorkspace
,
configuration
:
IConfiguration
,
options
:
IOptions
):
winjs
.
TPromise
<
void
>
{
const
eventService
=
new
EventService
();
const
environmentService
=
new
EnvironmentService
();
const
contextService
=
new
WorkspaceContextService
(
eventService
,
workspace
,
configuration
,
options
);
const
configurationService
=
new
ConfigurationService
(
contextService
,
eventService
);
...
...
@@ -145,7 +147,8 @@ function openWorkbench(workspace: IWorkspace, configuration: IConfiguration, opt
const
shell
=
new
WorkbenchShell
(
document
.
body
,
workspace
,
{
configurationService
,
eventService
,
contextService
contextService
,
environmentService
},
configuration
,
options
);
shell
.
open
();
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
d54054ee
...
...
@@ -55,6 +55,7 @@ import {IEventService} from 'vs/platform/event/common/event';
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
IRequestService
}
from
'
vs/platform/request/common/request
'
;
import
{
ISearchService
}
from
'
vs/platform/search/common/search
'
;
...
...
@@ -89,6 +90,7 @@ export interface ICoreServices {
contextService
:
IWorkspaceContextService
;
eventService
:
IEventService
;
configurationService
:
IConfigurationService
;
environmentService
:
IEnvironmentService
;
}
/**
...
...
@@ -99,6 +101,7 @@ export class WorkbenchShell {
private
storageService
:
IStorageService
;
private
messageService
:
MessageService
;
private
eventService
:
IEventService
;
private
environmentService
:
IEnvironmentService
;
private
contextViewService
:
ContextViewService
;
private
windowService
:
IWindowService
;
private
threadService
:
MainThreadService
;
...
...
@@ -129,6 +132,7 @@ export class WorkbenchShell {
this
.
contextService
=
services
.
contextService
;
this
.
eventService
=
services
.
eventService
;
this
.
configurationService
=
services
.
configurationService
;
this
.
environmentService
=
services
.
environmentService
;
this
.
toUnbind
=
[];
this
.
previousErrorTime
=
0
;
...
...
@@ -225,6 +229,7 @@ export class WorkbenchShell {
serviceCollection
.
set
(
IEventService
,
this
.
eventService
);
serviceCollection
.
set
(
IWorkspaceContextService
,
this
.
contextService
);
serviceCollection
.
set
(
IConfigurationService
,
this
.
configurationService
);
serviceCollection
.
set
(
IEnvironmentService
,
this
.
environmentService
);
const
instantiationService
=
new
InstantiationService
(
serviceCollection
,
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录