Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3e9dc784
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,发现更多精彩内容 >>
提交
3e9dc784
编写于
10月 03, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
check for model lang id for icons too (part of #11806)
上级
7ca6f5ed
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
36 addition
and
16 deletion
+36
-16
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+23
-10
src/vs/workbench/browser/parts/editor/editorPicker.ts
src/vs/workbench/browser/parts/editor/editorPicker.ts
+3
-1
src/vs/workbench/browser/parts/editor/editorStatus.ts
src/vs/workbench/browser/parts/editor/editorStatus.ts
+1
-1
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+6
-3
src/vs/workbench/parts/search/browser/openFileHandler.ts
src/vs/workbench/parts/search/browser/openFileHandler.ts
+3
-1
未找到文件。
src/vs/workbench/browser/labels.ts
浏览文件 @
3e9dc784
...
...
@@ -13,9 +13,11 @@ import {IModeService} from 'vs/editor/common/services/modeService';
import
{
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
getResource
}
from
'
vs/workbench/common/editor
'
;
import
{
getPathLabel
}
from
'
vs/base/common/labels
'
;
import
{
PLAINTEXT_MODE_ID
}
from
'
vs/editor/common/modes/modesRegistry
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
export
interface
IEditorLabel
{
name
:
string
;
...
...
@@ -38,7 +40,8 @@ export class ResourceLabel extends IconLabel {
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IWorkspaceContextService
protected
contextService
:
IWorkspaceContextService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IModeService
private
modeService
:
IModeService
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
)
{
super
(
container
,
options
);
...
...
@@ -80,7 +83,7 @@ export class ResourceLabel extends IconLabel {
title
=
getPathLabel
(
resource
.
fsPath
);
}
const
extraClasses
=
getIconClasses
(
this
.
modeService
,
resource
,
this
.
options
&&
this
.
options
.
isFolder
);
const
extraClasses
=
getIconClasses
(
this
.
mode
lService
,
this
.
mode
Service
,
resource
,
this
.
options
&&
this
.
options
.
isFolder
);
if
(
this
.
options
&&
this
.
options
.
extraClasses
)
{
extraClasses
.
push
(...
this
.
options
.
extraClasses
);
}
...
...
@@ -127,12 +130,18 @@ export class FileLabel extends ResourceLabel {
}
}
export
function
getIconClasses
(
mode
Service
:
IModeService
,
arg1
?:
uri
|
string
,
isFolder
?:
boolean
):
string
[]
{
export
function
getIconClasses
(
mode
lService
:
IModelService
,
modeService
:
IModeService
,
resource
:
uri
,
isFolder
?:
boolean
):
string
[]
{
let
path
:
string
;
if
(
typeof
arg1
===
'
string
'
)
{
path
=
arg1
;
}
else
if
(
arg1
)
{
path
=
arg1
.
fsPath
;
let
configuredLangId
:
string
;
if
(
resource
)
{
path
=
resource
.
fsPath
;
const
model
=
modelService
.
getModel
(
resource
);
if
(
model
)
{
const
modeId
=
model
.
getModeId
();
if
(
modeId
&&
modeId
!==
PLAINTEXT_MODE_ID
)
{
configuredLangId
=
modeId
;
// only take if the mode is specific (aka no just plain text)
}
}
}
// we always set these base classes even if we do not have a path
...
...
@@ -151,11 +160,14 @@ export function getIconClasses(modeService: IModeService, arg1?: uri | string, i
// Files
else
{
// Name
const
name
=
dotSegments
[
0
];
// file.txt => "file", .dockerfile => "", file.some.txt => "file"
if
(
name
)
{
classes
.
push
(
`
${
cssEscape
(
name
.
toLowerCase
())}
-name-file-icon`
);
}
// Extension(s)
const
extensions
=
dotSegments
.
splice
(
1
);
if
(
extensions
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
extensions
.
length
;
i
++
)
{
...
...
@@ -163,9 +175,10 @@ export function getIconClasses(modeService: IModeService, arg1?: uri | string, i
}
}
const
langId
=
modeService
.
getModeIdByFilenameOrFirstLine
(
path
);
if
(
langId
)
{
classes
.
push
(
`
${
cssEscape
(
langId
)}
-lang-file-icon`
);
// Configured Language
configuredLangId
=
configuredLangId
||
modeService
.
getModeIdByFilenameOrFirstLine
(
path
);
if
(
configuredLangId
)
{
classes
.
push
(
`
${
cssEscape
(
configuredLangId
)}
-lang-file-icon`
);
}
}
}
...
...
src/vs/workbench/browser/parts/editor/editorPicker.ts
浏览文件 @
3e9dc784
...
...
@@ -17,6 +17,7 @@ import {QuickOpenModel, QuickOpenEntry, QuickOpenEntryGroup} from 'vs/base/parts
import
scorer
=
require
(
'
vs/base/common/scorer
'
);
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
getIconClasses
}
from
'
vs/workbench/browser/labels
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
QuickOpenHandler
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
Position
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
...
...
@@ -33,6 +34,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
private
_group
:
IEditorGroup
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
,
@
IEditorGroupService
editorGroupService
:
IEditorGroupService
)
{
super
();
...
...
@@ -42,7 +44,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
public
getLabelOptions
():
IIconLabelOptions
{
return
{
extraClasses
:
getIconClasses
(
this
.
modeService
,
this
.
getResource
()),
extraClasses
:
getIconClasses
(
this
.
mode
lService
,
this
.
mode
Service
,
this
.
getResource
()),
italic
:
this
.
_group
.
isPreview
(
this
.
editor
)
};
}
...
...
src/vs/workbench/browser/parts/editor/editorStatus.ts
浏览文件 @
3e9dc784
...
...
@@ -774,7 +774,7 @@ export class ChangeModeAction extends Action {
}
// Change mode
models
.
forEach
(
(
textModel
)
=>
{
models
.
forEach
(
textModel
=>
{
this
.
modelService
.
setMode
(
textModel
,
mode
);
});
}
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
3e9dc784
...
...
@@ -27,6 +27,7 @@ import paths = require('vs/base/common/paths');
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
getIconClasses
}
from
'
vs/workbench/browser/labels
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
EditorInput
,
getUntitledOrFileResource
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
WorkbenchComponent
}
from
'
vs/workbench/common/component
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -948,7 +949,8 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
constructor
(
item
:
IPickOpenEntry
,
private
onPreview
:
()
=>
void
,
@
IModeService
private
modeService
:
IModeService
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
)
{
super
(
item
.
label
);
...
...
@@ -965,7 +967,7 @@ class PickOpenEntry extends PlaceholderQuickOpenEntry {
public
getLabelOptions
():
IIconLabelOptions
{
return
{
extraClasses
:
this
.
resource
?
getIconClasses
(
this
.
modeService
,
this
.
resource
,
this
.
isFolder
)
:
[]
extraClasses
:
this
.
resource
?
getIconClasses
(
this
.
mode
lService
,
this
.
mode
Service
,
this
.
resource
,
this
.
isFolder
)
:
[]
};
}
...
...
@@ -1020,6 +1022,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
input
:
EditorInput
,
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
super
(
editorService
);
...
...
@@ -1038,7 +1041,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
public
getLabelOptions
():
IIconLabelOptions
{
return
{
extraClasses
:
getIconClasses
(
this
.
modeService
,
this
.
resource
)
extraClasses
:
getIconClasses
(
this
.
mode
lService
,
this
.
mode
Service
,
this
.
resource
)
};
}
...
...
src/vs/workbench/parts/search/browser/openFileHandler.ts
浏览文件 @
3e9dc784
...
...
@@ -16,6 +16,7 @@ import {IIconLabelOptions} from 'vs/base/browser/ui/iconLabel/iconLabel';
import
{
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
getIconClasses
}
from
'
vs/workbench/browser/labels
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
IAutoFocus
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
QuickOpenEntry
,
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
...
...
@@ -47,6 +48,7 @@ export class FileEntry extends EditorQuickOpenEntry {
private
icon
:
string
,
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
)
{
...
...
@@ -59,7 +61,7 @@ export class FileEntry extends EditorQuickOpenEntry {
public
getLabelOptions
():
IIconLabelOptions
{
return
{
extraClasses
:
getIconClasses
(
this
.
modeService
,
this
.
resource
)
extraClasses
:
getIconClasses
(
this
.
mode
lService
,
this
.
mode
Service
,
this
.
resource
)
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录