Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9f5fd606
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,发现更多精彩内容 >>
提交
9f5fd606
编写于
4月 27, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes Microsoft/monaco-editor#334: Forward standalone editor options to configuration service
上级
e67edc80
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
65 addition
and
4 deletion
+65
-4
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+20
-0
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+19
-0
src/vs/editor/standalone/browser/standaloneCodeEditor.ts
src/vs/editor/standalone/browser/standaloneCodeEditor.ts
+21
-2
src/vs/editor/standalone/browser/standaloneEditor.ts
src/vs/editor/standalone/browser/standaloneEditor.ts
+5
-2
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
9f5fd606
...
...
@@ -700,4 +700,24 @@ const editorConfiguration: IConfigurationNode = {
}
};
let
cachedEditorConfigurationKeys
:
{
[
key
:
string
]:
boolean
;
}
=
null
;
function
getEditorConfigurationKeys
():
{
[
key
:
string
]:
boolean
;
}
{
if
(
cachedEditorConfigurationKeys
===
null
)
{
cachedEditorConfigurationKeys
=
Object
.
create
(
null
);
Object
.
keys
(
editorConfiguration
.
properties
).
forEach
((
prop
)
=>
{
cachedEditorConfigurationKeys
[
prop
]
=
true
;
});
}
return
cachedEditorConfigurationKeys
;
}
export
function
isEditorConfigurationKey
(
key
:
string
):
boolean
{
const
editorConfigurationKeys
=
getEditorConfigurationKeys
();
return
(
editorConfigurationKeys
[
`editor.
${
key
}
`
]
||
false
);
}
export
function
isDiffEditorConfigurationKey
(
key
:
string
):
boolean
{
const
editorConfigurationKeys
=
getEditorConfigurationKeys
();
return
(
editorConfigurationKeys
[
`diffEditor.
${
key
}
`
]
||
false
);
}
configurationRegistry
.
registerConfiguration
(
editorConfiguration
);
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
9f5fd606
...
...
@@ -41,6 +41,7 @@ import { ITextModel } from 'vs/editor/common/model';
import
{
INotificationService
,
INotification
,
INotificationHandle
,
NoOpNotification
,
IPromptChoice
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IConfirmation
,
IConfirmationResult
,
IDialogService
,
IDialogOptions
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IPosition
,
Position
as
Pos
}
from
'
vs/editor/common/core/position
'
;
import
{
isEditorConfigurationKey
,
isDiffEditorConfigurationKey
}
from
'
vs/editor/common/config/commonEditorConfig
'
;
export
class
SimpleEditor
implements
IEditor
{
...
...
@@ -495,6 +496,7 @@ export class SimpleConfigurationService implements IConfigurationService {
}
public
updateValue
(
key
:
string
,
value
:
any
,
arg3
?:
any
,
arg4
?:
any
):
TPromise
<
void
>
{
this
.
configuration
().
updateValue
(
key
,
value
);
return
TPromise
.
as
(
null
);
}
...
...
@@ -620,3 +622,20 @@ export class SimpleWorkspaceContextService implements IWorkspaceContextService {
return
true
;
}
}
export
function
applyConfigurationValues
(
configurationService
:
IConfigurationService
,
source
:
any
,
isDiffEditor
:
boolean
):
void
{
if
(
!
source
)
{
return
;
}
if
(
!
(
configurationService
instanceof
SimpleConfigurationService
))
{
return
;
}
Object
.
keys
(
source
).
forEach
((
key
)
=>
{
if
(
isEditorConfigurationKey
(
key
))
{
configurationService
.
updateValue
(
`editor.
${
key
}
`
,
source
[
key
]);
}
if
(
isDiffEditor
&&
isDiffEditorConfigurationKey
(
key
))
{
configurationService
.
updateValue
(
`diffEditor.
${
key
}
`
,
source
[
key
]);
}
});
}
src/vs/editor/standalone/browser/standaloneCodeEditor.ts
浏览文件 @
9f5fd606
...
...
@@ -16,7 +16,7 @@ import { IModelChangedEvent } from 'vs/editor/common/editorCommon';
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
StandaloneKeybindingService
}
from
'
vs/editor/standalone/browser/simpleServices
'
;
import
{
StandaloneKeybindingService
,
applyConfigurationValues
}
from
'
vs/editor/standalone/browser/simpleServices
'
;
import
{
IEditorContextViewService
}
from
'
vs/editor/standalone/browser/standaloneServices
'
;
import
{
CodeEditor
}
from
'
vs/editor/browser/codeEditor
'
;
import
{
DiffEditorWidget
}
from
'
vs/editor/browser/widget/diffEditorWidget
'
;
...
...
@@ -30,6 +30,7 @@ import * as aria from 'vs/base/browser/ui/aria/aria';
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
/**
* Description of an action contribution
...
...
@@ -284,6 +285,7 @@ export class StandaloneCodeEditor extends CodeEditor implements IStandaloneCodeE
export
class
StandaloneEditor
extends
StandaloneCodeEditor
implements
IStandaloneCodeEditor
{
private
_contextViewService
:
IEditorContextViewService
;
private
readonly
_configurationService
:
IConfigurationService
;
private
_ownsModel
:
boolean
;
constructor
(
...
...
@@ -298,7 +300,9 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IStandaloneThemeService
themeService
:
IStandaloneThemeService
,
@
INotificationService
notificationService
:
INotificationService
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
applyConfigurationValues
(
configurationService
,
options
,
false
);
options
=
options
||
{};
if
(
typeof
options
.
theme
===
'
string
'
)
{
themeService
.
setTheme
(
options
.
theme
);
...
...
@@ -308,6 +312,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
super
(
domElement
,
options
,
instantiationService
,
codeEditorService
,
commandService
,
contextKeyService
,
keybindingService
,
themeService
,
notificationService
);
this
.
_contextViewService
=
<
IEditorContextViewService
>
contextViewService
;
this
.
_configurationService
=
configurationService
;
this
.
_register
(
toDispose
);
if
(
typeof
model
===
'
undefined
'
)
{
...
...
@@ -331,6 +336,11 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
super
.
dispose
();
}
public
updateOptions
(
newOptions
:
IEditorOptions
):
void
{
applyConfigurationValues
(
this
.
_configurationService
,
newOptions
,
false
);
super
.
updateOptions
(
newOptions
);
}
_attachModel
(
model
:
ITextModel
):
void
{
super
.
_attachModel
(
model
);
if
(
this
.
_view
)
{
...
...
@@ -350,6 +360,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
export
class
StandaloneDiffEditor
extends
DiffEditorWidget
implements
IStandaloneDiffEditor
{
private
_contextViewService
:
IEditorContextViewService
;
private
readonly
_configurationService
:
IConfigurationService
;
constructor
(
domElement
:
HTMLElement
,
...
...
@@ -362,8 +373,10 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
@
IEditorWorkerService
editorWorkerService
:
IEditorWorkerService
,
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
,
@
IStandaloneThemeService
themeService
:
IStandaloneThemeService
,
@
INotificationService
notificationService
:
INotificationService
@
INotificationService
notificationService
:
INotificationService
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
applyConfigurationValues
(
configurationService
,
options
,
true
);
options
=
options
||
{};
if
(
typeof
options
.
theme
===
'
string
'
)
{
options
.
theme
=
themeService
.
setTheme
(
options
.
theme
);
...
...
@@ -372,6 +385,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
super
(
domElement
,
options
,
editorWorkerService
,
contextKeyService
,
instantiationService
,
codeEditorService
,
themeService
,
notificationService
);
this
.
_contextViewService
=
<
IEditorContextViewService
>
contextViewService
;
this
.
_configurationService
=
configurationService
;
this
.
_register
(
toDispose
);
...
...
@@ -382,6 +396,11 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
super
.
dispose
();
}
public
updateOptions
(
newOptions
:
IDiffEditorOptions
):
void
{
applyConfigurationValues
(
this
.
_configurationService
,
newOptions
,
true
);
super
.
updateOptions
(
newOptions
);
}
protected
_createInnerEditor
(
instantiationService
:
IInstantiationService
,
container
:
HTMLElement
,
options
:
IEditorOptions
):
CodeEditor
{
return
instantiationService
.
createInstance
(
StandaloneCodeEditor
,
container
,
options
);
}
...
...
src/vs/editor/standalone/browser/standaloneEditor.ts
浏览文件 @
9f5fd606
...
...
@@ -38,6 +38,7 @@ import * as editorOptions from 'vs/editor/common/config/editorOptions';
import
{
CursorChangeReason
}
from
'
vs/editor/common/controller/cursorEvents
'
;
import
{
ITextModel
,
OverviewRulerLane
,
EndOfLinePreference
,
DefaultEndOfLine
,
EndOfLineSequence
,
TrackedRangeStickiness
,
TextModelResolvedOptions
,
FindMatch
}
from
'
vs/editor/common/model
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
function
withAllStandaloneServices
<
T
extends
editorCommon
.
IEditor
>
(
domElement
:
HTMLElement
,
override
:
IEditorOverrideServices
,
callback
:
(
services
:
DynamicStandaloneServices
)
=>
T
):
T
{
let
services
=
new
DynamicStandaloneServices
(
domElement
,
override
);
...
...
@@ -90,7 +91,8 @@ export function create(domElement: HTMLElement, options?: IEditorConstructionOpt
services
.
get
(
IKeybindingService
),
services
.
get
(
IContextViewService
),
services
.
get
(
IStandaloneThemeService
),
services
.
get
(
INotificationService
)
services
.
get
(
INotificationService
),
services
.
get
(
IConfigurationService
),
);
});
}
...
...
@@ -124,7 +126,8 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC
services
.
get
(
IEditorWorkerService
),
services
.
get
(
ICodeEditorService
),
services
.
get
(
IStandaloneThemeService
),
services
.
get
(
INotificationService
)
services
.
get
(
INotificationService
),
services
.
get
(
IConfigurationService
),
);
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录