Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fb887afc
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,发现更多精彩内容 >>
提交
fb887afc
编写于
1月 17, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1587 Read the editor settings for language and update the editor
上级
8ba62c61
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
57 addition
and
13 deletion
+57
-13
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+4
-2
src/vs/workbench/browser/parts/editor/textEditor.ts
src/vs/workbench/browser/parts/editor/textEditor.ts
+39
-3
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
+4
-2
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
...s/workbench/parts/files/browser/editors/textFileEditor.ts
+4
-2
src/vs/workbench/parts/output/browser/outputPanel.ts
src/vs/workbench/parts/output/browser/outputPanel.ts
+4
-2
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+2
-2
未找到文件。
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
fb887afc
...
...
@@ -33,6 +33,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
/**
* The text editor that leverages the diff text editor for the editing experience.
...
...
@@ -52,9 +53,10 @@ export class TextDiffEditor extends BaseTextEditor {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IThemeService
themeService
:
IThemeService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IModeService
modeService
:
IModeService
)
{
super
(
TextDiffEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
);
super
(
TextDiffEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
modeService
);
}
public
getTitle
():
string
{
...
...
src/vs/workbench/browser/parts/editor/textEditor.ts
浏览文件 @
fb887afc
...
...
@@ -10,7 +10,7 @@ import { Dimension, Builder } from 'vs/base/browser/builder';
import
objects
=
require
(
'
vs/base/common/objects
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
{
CodeEditor
}
from
'
vs/editor/browser/codeEditor
'
;
import
{
EditorInput
,
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorInput
,
EditorOptions
,
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
IEditorViewState
,
IEditor
,
IEditorOptions
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/platform/editor/common/editor
'
;
...
...
@@ -20,6 +20,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
Scope
}
from
'
vs/workbench/common/memento
'
;
import
{
getCodeEditor
}
from
'
vs/editor/common/services/codeEditorService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
const
TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
textEditorViewState
'
;
...
...
@@ -49,7 +51,8 @@ export abstract class BaseTextEditor extends BaseEditor {
@
IInstantiationService
private
_instantiationService
:
IInstantiationService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IThemeService
private
themeService
:
IThemeService
@
IThemeService
private
themeService
:
IThemeService
,
@
IModeService
private
modeService
:
IModeService
)
{
super
(
id
,
telemetryService
);
...
...
@@ -91,6 +94,10 @@ export abstract class BaseTextEditor extends BaseEditor {
// Specific editor options always overwrite user configuration
const
editorConfiguration
=
types
.
isObject
(
configuration
.
editor
)
?
objects
.
clone
(
configuration
.
editor
)
:
Object
.
create
(
null
);
const
language
=
this
.
getLanguage
();
if
(
language
)
{
objects
.
assign
(
editorConfiguration
,
this
.
configurationService
.
getConfiguration
<
IEditorConfiguration
>
({
language
,
section
:
'
editor
'
}));
}
objects
.
assign
(
editorConfiguration
,
this
.
getConfigurationOverrides
());
return
editorConfiguration
;
...
...
@@ -110,6 +117,11 @@ export abstract class BaseTextEditor extends BaseEditor {
// Editor for Text
this
.
_editorContainer
=
parent
;
this
.
editorControl
=
this
.
createEditorControl
(
parent
,
this
.
computeConfiguration
(
this
.
configurationService
.
getConfiguration
<
IEditorConfiguration
>
()));
const
codeEditor
=
getCodeEditor
(
this
);
if
(
codeEditor
)
{
this
.
toUnbind
.
push
(
codeEditor
.
onDidChangeModelLanguage
(
e
=>
this
.
updateEditorConfiguration
()));
this
.
toUnbind
.
push
(
codeEditor
.
onDidChangeModel
(
e
=>
this
.
updateEditorConfiguration
()));
}
}
/**
...
...
@@ -129,7 +141,7 @@ export abstract class BaseTextEditor extends BaseEditor {
// Update editor options after having set the input. We do this because there can be
// editor input specific options (e.g. an ARIA label depending on the input showing)
this
.
editorControl
.
updateOptions
(
this
.
getConfigurationOverrides
()
);
this
.
updateEditorConfiguration
(
);
});
}
...
...
@@ -211,6 +223,30 @@ export abstract class BaseTextEditor extends BaseEditor {
return
null
;
}
private
updateEditorConfiguration
():
void
{
this
.
editorControl
.
updateOptions
(
this
.
computeConfiguration
(
this
.
configurationService
.
getConfiguration
<
IEditorConfiguration
>
()));
}
private
getLanguage
():
string
{
const
codeEditor
=
getCodeEditor
(
this
);
if
(
codeEditor
)
{
const
model
=
codeEditor
.
getModel
();
if
(
model
)
{
return
model
.
getLanguageIdentifier
().
language
;
}
}
if
(
this
.
input
)
{
const
resource
=
toResource
(
this
.
input
);
if
(
resource
)
{
const
modeId
=
this
.
modeService
.
getModeIdByFilenameOrFirstLine
(
resource
.
fsPath
);
if
(
modeId
)
{
return
this
.
modeService
.
getLanguageName
(
modeId
);
}
}
}
return
null
;
}
public
dispose
():
void
{
// Destroy Editor Control
...
...
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
浏览文件 @
fb887afc
...
...
@@ -21,6 +21,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
/**
* An editor implementation that is capable of showing the contents of resource inputs. Uses
...
...
@@ -37,9 +38,10 @@ export class TextResourceEditor extends BaseTextEditor {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IThemeService
themeService
:
IThemeService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IModeService
modeService
:
IModeService
)
{
super
(
TextResourceEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
);
super
(
TextResourceEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
modeService
);
this
.
toUnbind
.
push
(
this
.
untitledEditorService
.
onDidChangeDirty
(
e
=>
this
.
onUntitledDirtyChange
(
e
)));
}
...
...
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
浏览文件 @
fb887afc
...
...
@@ -31,6 +31,7 @@ import { CancelAction } from 'vs/platform/message/common/message';
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
/**
* An implementation of editor for file system resources.
...
...
@@ -50,9 +51,10 @@ export class TextFileEditor extends BaseTextEditor {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IThemeService
themeService
:
IThemeService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IModeService
modeService
:
IModeService
)
{
super
(
TextFileEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
);
super
(
TextFileEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
modeService
);
// Clear view state for deleted files
this
.
toUnbind
.
push
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFilesChanged
(
e
)));
...
...
src/vs/workbench/parts/output/browser/outputPanel.ts
浏览文件 @
fb887afc
...
...
@@ -23,6 +23,7 @@ import { SwitchOutputAction, SwitchOutputActionItem, ClearOutputAction } from 'v
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
export
class
OutputPanel
extends
TextResourceEditor
{
private
toDispose
:
IDisposable
[];
...
...
@@ -38,9 +39,10 @@ export class OutputPanel extends TextResourceEditor {
@
IOutputService
private
outputService
:
IOutputService
,
@
IUntitledEditorService
untitledEditorService
:
IUntitledEditorService
,
@
IContextKeyService
private
contextKeyService
:
IContextKeyService
,
@
IEditorGroupService
editorGroupService
:
IEditorGroupService
@
IEditorGroupService
editorGroupService
:
IEditorGroupService
,
@
IModeService
modeService
:
IModeService
)
{
super
(
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
untitledEditorService
,
editorGroupService
);
super
(
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
untitledEditorService
,
editorGroupService
,
modeService
);
this
.
scopedInstantiationService
=
instantiationService
;
this
.
toDispose
=
[];
...
...
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
fb887afc
...
...
@@ -112,9 +112,9 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
@
IPreferencesService
private
preferencesService
:
IPreferencesService
,
@
IModelService
private
modelService
:
IModelService
,
@
IModeService
private
modeService
:
IModeService
@
IModeService
modeService
:
IModeService
,
)
{
super
(
DefaultPreferencesEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
);
super
(
DefaultPreferencesEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
modeService
);
this
.
delayedFilterLogging
=
new
Delayer
<
void
>
(
1000
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录