Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
a07e7a54
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a07e7a54
编写于
10月 03, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
icons: show them in language picker too
上级
1bf88815
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
2 deletion
+35
-2
src/vs/editor/common/services/languagesRegistry.ts
src/vs/editor/common/services/languagesRegistry.ts
+12
-0
src/vs/editor/common/services/modeService.ts
src/vs/editor/common/services/modeService.ts
+1
-0
src/vs/editor/common/services/modeServiceImpl.ts
src/vs/editor/common/services/modeServiceImpl.ts
+4
-0
src/vs/editor/test/common/mocks/mockModeService.ts
src/vs/editor/test/common/mocks/mockModeService.ts
+3
-0
src/vs/workbench/browser/parts/editor/editorStatus.ts
src/vs/workbench/browser/parts/editor/editorStatus.ts
+15
-2
未找到文件。
src/vs/editor/common/services/languagesRegistry.ts
浏览文件 @
a07e7a54
...
...
@@ -26,6 +26,7 @@ export class LanguagesRegistry {
private
name2LanguageId
:
{
[
name
:
string
]:
string
;
};
private
id2Name
:
{
[
id
:
string
]:
string
;
};
private
id2Extensions
:
{
[
id
:
string
]:
string
[];
};
private
id2Filenames
:
{
[
id
:
string
]:
string
[];
};
private
compatModes
:
{
[
id
:
string
]:
ICompatModeDescriptor
;
};
private
lowerName2Id
:
{
[
name
:
string
]:
string
;
};
private
id2ConfigurationFiles
:
{
[
id
:
string
]:
string
[];
};
...
...
@@ -39,6 +40,7 @@ export class LanguagesRegistry {
this
.
name2LanguageId
=
{};
this
.
id2Name
=
{};
this
.
id2Extensions
=
{};
this
.
id2Filenames
=
{};
this
.
compatModes
=
{};
this
.
lowerName2Id
=
{};
this
.
id2ConfigurationFiles
=
{};
...
...
@@ -127,8 +129,10 @@ export class LanguagesRegistry {
}
if
(
Array
.
isArray
(
lang
.
filenames
))
{
this
.
id2Filenames
[
lang
.
id
]
=
this
.
id2Filenames
[
lang
.
id
]
||
[];
for
(
let
filename
of
lang
.
filenames
)
{
mime
.
registerTextMime
({
mime
:
primaryMime
,
filename
:
filename
});
this
.
id2Filenames
[
lang
.
id
].
push
(
filename
);
}
}
...
...
@@ -270,4 +274,12 @@ export class LanguagesRegistry {
}
return
this
.
id2Extensions
[
languageId
];
}
public
getFilenames
(
languageName
:
string
):
string
[]
{
let
languageId
=
this
.
name2LanguageId
[
languageName
];
if
(
!
languageId
)
{
return
[];
}
return
this
.
id2Filenames
[
languageId
];
}
}
src/vs/editor/common/services/modeService.ts
浏览文件 @
a07e7a54
...
...
@@ -50,6 +50,7 @@ export interface IModeService {
getRegisteredModes
():
string
[];
getRegisteredLanguageNames
():
string
[];
getExtensions
(
alias
:
string
):
string
[];
getFilenames
(
alias
:
string
):
string
[];
getMimeForMode
(
modeId
:
string
):
string
;
getLanguageName
(
modeId
:
string
):
string
;
getModeIdForLanguageName
(
alias
:
string
):
string
;
...
...
src/vs/editor/common/services/modeServiceImpl.ts
浏览文件 @
a07e7a54
...
...
@@ -183,6 +183,10 @@ export class ModeServiceImpl implements IModeService {
return
this
.
_registry
.
getExtensions
(
alias
);
}
public
getFilenames
(
alias
:
string
):
string
[]
{
return
this
.
_registry
.
getFilenames
(
alias
);
}
public
getMimeForMode
(
modeId
:
string
):
string
{
return
this
.
_registry
.
getMimeForMode
(
modeId
);
}
...
...
src/vs/editor/test/common/mocks/mockModeService.ts
浏览文件 @
a07e7a54
...
...
@@ -32,6 +32,9 @@ export class MockModeService implements IModeService {
getExtensions
(
alias
:
string
):
string
[]
{
throw
new
Error
(
'
Not implemented
'
);
}
getFilenames
(
alias
:
string
):
string
[]
{
throw
new
Error
(
'
Not implemented
'
);
}
getMimeForMode
(
modeId
:
string
):
string
{
throw
new
Error
(
'
Not implemented
'
);
}
...
...
src/vs/workbench/browser/parts/editor/editorStatus.ts
浏览文件 @
a07e7a54
...
...
@@ -34,7 +34,7 @@ import {BaseBinaryResourceEditor} from 'vs/workbench/browser/parts/editor/binary
import
{
BinaryResourceDiffEditor
}
from
'
vs/workbench/browser/parts/editor/binaryDiffEditor
'
;
import
{
IEditor
as
IBaseEditor
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IQuickOpenService
,
IPickOpenEntry
}
from
'
vs/workbench/services/quickopen/common/quickOpenService
'
;
import
{
IQuickOpenService
,
IPickOpenEntry
,
IFilePickOpenEntry
}
from
'
vs/workbench/services/quickopen/common/quickOpenService
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IFilesConfiguration
,
SUPPORTED_ENCODINGS
}
from
'
vs/platform/files/common/files
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -716,8 +716,21 @@ export class ChangeModeAction extends Action {
description
=
nls
.
localize
(
'
languageDescriptionConfigured
'
,
"
({0})
"
,
this
.
modeService
.
getModeIdForLanguageName
(
lang
.
toLowerCase
()));
}
return
<
IPickOpenEntry
>
{
// construct a fake resource to be able to show nice icons if any
let
fakeResource
:
uri
;
const
extensions
=
this
.
modeService
.
getExtensions
(
lang
);
if
(
extensions
&&
extensions
.
length
)
{
fakeResource
=
uri
.
file
(
extensions
[
0
]);
}
else
{
const
filenames
=
this
.
modeService
.
getFilenames
(
lang
);
if
(
filenames
&&
filenames
.
length
)
{
fakeResource
=
uri
.
file
(
filenames
[
0
]);
}
}
return
<
IFilePickOpenEntry
>
{
label
:
lang
,
resource
:
fakeResource
,
description
};
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录