Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8692ecf9
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,发现更多精彩内容 >>
提交
8692ecf9
编写于
11月 13, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
79f3ea1e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
80 addition
and
103 deletion
+80
-103
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+45
-2
src/vs/workbench/electron-browser/configureLocale.ts
src/vs/workbench/electron-browser/configureLocale.ts
+0
-99
src/vs/workbench/electron-browser/main.contribution.ts
src/vs/workbench/electron-browser/main.contribution.ts
+35
-1
src/vs/workbench/workbench.main.ts
src/vs/workbench/workbench.main.ts
+0
-1
未找到文件。
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
8692ecf9
...
...
@@ -24,7 +24,7 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur
import
{
IExtensionManagementService
,
LocalExtensionType
,
ILocalExtension
,
IExtensionEnablementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
isMacintosh
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
isMacintosh
,
isLinux
,
language
}
from
'
vs/base/common/platform
'
;
import
{
IQuickOpenService
,
IFilePickOpenEntry
,
ISeparator
,
IPickOpenAction
,
IPickOpenItem
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
...
...
@@ -42,10 +42,11 @@ import { getPathLabel } from 'vs/base/common/labels';
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
IWorkspaceIdentifier
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
FileKind
}
from
'
vs/platform/files/common/files
'
;
import
{
FileKind
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
getEntries
}
from
'
vs/base/common/performance
'
;
import
{
IEditor
}
from
'
vs/platform/editor/common/editor
'
;
// --- actions
...
...
@@ -1633,3 +1634,45 @@ export class ToggleWindowTabsBar extends Action {
return
this
.
windowsService
.
toggleWindowTabsBar
().
then
(()
=>
true
);
}
}
export
class
ConfigureLocaleAction
extends
Action
{
public
static
ID
=
'
workbench.action.configureLocale
'
;
public
static
LABEL
=
nls
.
localize
(
'
configureLocale
'
,
"
Configure Language
"
);
private
static
DEFAULT_CONTENT
:
string
=
[
'
{
'
,
`\t//
${
nls
.
localize
(
'
displayLanguage
'
,
'
Defines VSCode
\'
s display language.
'
)}
`
,
`\t//
${
nls
.
localize
(
'
doc
'
,
'
See {0} for a list of supported languages.
'
,
'
https://go.microsoft.com/fwlink/?LinkId=761051
'
)}
`
,
`\t//
${
nls
.
localize
(
'
restart
'
,
'
Changing the value requires restarting VSCode.
'
)}
`
,
`\t"locale":"
${
language
}
"`
,
'
}
'
].
join
(
'
\n
'
);
constructor
(
id
:
string
,
label
:
string
,
@
IFileService
private
fileService
:
IFileService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
TPromise
<
IEditor
>
{
const
file
=
URI
.
file
(
paths
.
join
(
this
.
environmentService
.
appSettingsHome
,
'
locale.json
'
));
return
this
.
fileService
.
resolveFile
(
file
).
then
(
null
,
(
error
)
=>
{
return
this
.
fileService
.
createFile
(
file
,
ConfigureLocaleAction
.
DEFAULT_CONTENT
);
}).
then
((
stat
)
=>
{
if
(
!
stat
)
{
return
undefined
;
}
return
this
.
editorService
.
openEditor
({
resource
:
stat
.
resource
,
options
:
{
forceOpen
:
true
}
});
},
(
error
)
=>
{
throw
new
Error
(
nls
.
localize
(
'
fail.createSettings
'
,
"
Unable to create '{0}' ({1}).
"
,
getPathLabel
(
file
,
this
.
contextService
),
error
));
});
}
}
\ No newline at end of file
src/vs/workbench/electron-browser/configureLocale.ts
已删除
100644 → 0
浏览文件 @
79f3ea1e
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
*
as
Path
from
'
vs/base/common/paths
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
*
as
Labels
from
'
vs/base/common/labels
'
;
import
*
as
Platform
from
'
vs/base/common/platform
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
}
from
'
vs/workbench/common/actions
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IEditor
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IJSONContributionRegistry
,
Extensions
as
JSONExtensions
}
from
'
vs/platform/jsonschemas/common/jsonContributionRegistry
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
class
ConfigureLocaleAction
extends
Action
{
public
static
ID
=
'
workbench.action.configureLocale
'
;
public
static
LABEL
=
nls
.
localize
(
'
configureLocale
'
,
"
Configure Language
"
);
private
static
DEFAULT_CONTENT
:
string
=
[
'
{
'
,
`\t//
${
nls
.
localize
(
'
displayLanguage
'
,
'
Defines VSCode
\'
s display language.
'
)}
`
,
`\t//
${
nls
.
localize
(
'
doc
'
,
'
See {0} for a list of supported languages.
'
,
'
https://go.microsoft.com/fwlink/?LinkId=761051
'
)}
`
,
`\t//
${
nls
.
localize
(
'
restart
'
,
'
Changing the value requires restarting VSCode.
'
)}
`
,
`\t"locale":"
${
Platform
.
language
}
"`
,
'
}
'
].
join
(
'
\n
'
);
constructor
(
id
:
string
,
label
:
string
,
@
IFileService
private
fileService
:
IFileService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
)
{
super
(
id
,
label
);
}
public
run
(
event
?:
any
):
TPromise
<
IEditor
>
{
const
file
=
URI
.
file
(
Path
.
join
(
this
.
environmentService
.
appSettingsHome
,
'
locale.json
'
));
return
this
.
fileService
.
resolveFile
(
file
).
then
(
null
,
(
error
)
=>
{
return
this
.
fileService
.
createFile
(
file
,
ConfigureLocaleAction
.
DEFAULT_CONTENT
);
}).
then
((
stat
)
=>
{
if
(
!
stat
)
{
return
undefined
;
}
return
this
.
editorService
.
openEditor
({
resource
:
stat
.
resource
,
options
:
{
forceOpen
:
true
}
});
},
(
error
)
=>
{
throw
new
Error
(
nls
.
localize
(
'
fail.createSettings
'
,
"
Unable to create '{0}' ({1}).
"
,
Labels
.
getPathLabel
(
file
,
this
.
contextService
),
error
));
});
}
}
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
Extensions
.
WorkbenchActions
);
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ConfigureLocaleAction
,
ConfigureLocaleAction
.
ID
,
ConfigureLocaleAction
.
LABEL
),
'
Configure Language
'
);
let
enumValues
:
string
[]
=
[
'
de
'
,
'
en
'
,
'
en-US
'
,
'
es
'
,
'
fr
'
,
'
it
'
,
'
ja
'
,
'
ko
'
,
'
ru
'
,
'
zh-CN
'
,
'
zh-TW
'
];
import
product
from
'
vs/platform/node/product
'
;
if
(
product
.
quality
!==
'
stable
'
)
{
enumValues
.
push
(
'
hu
'
);
}
const
schemaId
=
'
vscode://schemas/locale
'
;
// Keep en-US since we generated files with that content.
const
schema
:
IJSONSchema
=
{
id
:
schemaId
,
description
:
'
Locale Definition file
'
,
type
:
'
object
'
,
default
:
{
'
locale
'
:
'
en
'
},
required
:
[
'
locale
'
],
properties
:
{
locale
:
{
type
:
'
string
'
,
enum
:
enumValues
,
description
:
nls
.
localize
(
'
JsonSchema.locale
'
,
'
The UI Language to use.
'
)
}
}
};
const
jsonRegistry
=
Registry
.
as
<
IJSONContributionRegistry
>
(
JSONExtensions
.
JSONContribution
);
jsonRegistry
.
registerSchema
(
schemaId
,
schema
);
\ No newline at end of file
src/vs/workbench/electron-browser/main.contribution.ts
浏览文件 @
8692ecf9
...
...
@@ -14,7 +14,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'v
import
{
IWorkbenchActionRegistry
,
Extensions
}
from
'
vs/workbench/common/actions
'
;
import
{
KeyMod
,
KeyChord
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
isWindows
,
isLinux
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
CloseEditorAction
,
KeybindingsReferenceAction
,
OpenDocumentationUrlAction
,
OpenIntroductoryVideosUrlAction
,
OpenTipsAndTricksUrlAction
,
ReportIssueAction
,
ReportPerformanceIssueAction
,
ZoomResetAction
,
ZoomOutAction
,
ZoomInAction
,
ToggleFullScreenAction
,
ToggleMenuBarAction
,
CloseWorkspaceAction
,
CloseCurrentWindowAction
,
SwitchWindow
,
NewWindowAction
,
CloseMessagesAction
,
NavigateUpAction
,
NavigateDownAction
,
NavigateLeftAction
,
NavigateRightAction
,
IncreaseViewSizeAction
,
DecreaseViewSizeAction
,
ShowStartupPerformance
,
ToggleSharedProcessAction
,
QuickSwitchWindow
,
QuickOpenRecentAction
,
inRecentFilesPickerContextKey
}
from
'
vs/workbench/electron-browser/actions
'
;
import
{
CloseEditorAction
,
KeybindingsReferenceAction
,
OpenDocumentationUrlAction
,
OpenIntroductoryVideosUrlAction
,
OpenTipsAndTricksUrlAction
,
ReportIssueAction
,
ReportPerformanceIssueAction
,
ZoomResetAction
,
ZoomOutAction
,
ZoomInAction
,
ToggleFullScreenAction
,
ToggleMenuBarAction
,
CloseWorkspaceAction
,
CloseCurrentWindowAction
,
SwitchWindow
,
NewWindowAction
,
CloseMessagesAction
,
NavigateUpAction
,
NavigateDownAction
,
NavigateLeftAction
,
NavigateRightAction
,
IncreaseViewSizeAction
,
DecreaseViewSizeAction
,
ShowStartupPerformance
,
ToggleSharedProcessAction
,
QuickSwitchWindow
,
QuickOpenRecentAction
,
inRecentFilesPickerContextKey
,
ConfigureLocaleAction
}
from
'
vs/workbench/electron-browser/actions
'
;
import
{
MessagesVisibleContext
}
from
'
vs/workbench/electron-browser/workbench
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
{
registerCommands
}
from
'
vs/workbench/electron-browser/commands
'
;
...
...
@@ -22,6 +22,7 @@ import { AddRootFolderAction, GlobalRemoveRootFolderAction, OpenWorkspaceAction,
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
inQuickOpenContext
,
getQuickNavigateHandler
}
from
'
vs/workbench/browser/parts/quickopen/quickopen
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IJSONContributionRegistry
,
Extensions
as
JSONExtensions
}
from
'
vs/platform/jsonschemas/common/jsonContributionRegistry
'
;
// Contribute Commands
registerCommands
();
...
...
@@ -449,3 +450,36 @@ configurationRegistry.registerConfiguration({
}
}
});
// Register action to configure locale and related settings
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
Extensions
.
WorkbenchActions
);
registry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ConfigureLocaleAction
,
ConfigureLocaleAction
.
ID
,
ConfigureLocaleAction
.
LABEL
),
'
Configure Language
'
);
let
enumValues
:
string
[]
=
[
'
de
'
,
'
en
'
,
'
en-US
'
,
'
es
'
,
'
fr
'
,
'
it
'
,
'
ja
'
,
'
ko
'
,
'
ru
'
,
'
zh-CN
'
,
'
zh-TW
'
];
if
(
product
.
quality
!==
'
stable
'
)
{
enumValues
.
push
(
'
hu
'
);
}
const
schemaId
=
'
vscode://schemas/locale
'
;
// Keep en-US since we generated files with that content.
const
schema
:
IJSONSchema
=
{
id
:
schemaId
,
description
:
'
Locale Definition file
'
,
type
:
'
object
'
,
default
:
{
'
locale
'
:
'
en
'
},
required
:
[
'
locale
'
],
properties
:
{
locale
:
{
type
:
'
string
'
,
enum
:
enumValues
,
description
:
nls
.
localize
(
'
JsonSchema.locale
'
,
'
The UI Language to use.
'
)
}
}
};
const
jsonRegistry
=
Registry
.
as
<
IJSONContributionRegistry
>
(
JSONExtensions
.
JSONContribution
);
jsonRegistry
.
registerSchema
(
schemaId
,
schema
);
\ No newline at end of file
src/vs/workbench/workbench.main.ts
浏览文件 @
8692ecf9
...
...
@@ -79,7 +79,6 @@ import 'vs/workbench/parts/terminal/browser/terminalQuickOpen';
import
'
vs/workbench/parts/terminal/electron-browser/terminalPanel
'
;
// can be packaged separately
import
'
vs/workbench/electron-browser/workbench
'
;
import
'
vs/workbench/electron-browser/configureLocale
'
;
import
'
vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录