Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
07af5660
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
07af5660
编写于
9月 21, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
icons: polish and fixes
上级
e3ed701a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
68 deletion
+43
-68
src/vs/base/browser/ui/fileLabel/fileLabel.css
src/vs/base/browser/ui/fileLabel/fileLabel.css
+0
-15
src/vs/base/browser/ui/fileLabel/fileLabel.ts
src/vs/base/browser/ui/fileLabel/fileLabel.ts
+12
-45
src/vs/base/browser/ui/iconLabel/iconLabel.ts
src/vs/base/browser/ui/iconLabel/iconLabel.ts
+6
-0
src/vs/base/browser/ui/iconLabel/iconlabel.css
src/vs/base/browser/ui/iconLabel/iconlabel.css
+4
-0
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+2
-1
src/vs/workbench/parts/files/browser/views/explorerViewer.ts
src/vs/workbench/parts/files/browser/views/explorerViewer.ts
+16
-7
src/vs/workbench/parts/markers/browser/markersTreeViewer.ts
src/vs/workbench/parts/markers/browser/markersTreeViewer.ts
+3
-0
未找到文件。
src/vs/base/browser/ui/fileLabel/fileLabel.css
已删除
100644 → 0
浏览文件 @
e3ed701a
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* ---------- File label ---------- */
.monaco-file-label
.file-name
{
color
:
inherit
;
}
.monaco-file-label
.file-path
{
opacity
:
0.7
;
margin-left
:
0.5em
;
font-size
:
0.9em
;
}
\ No newline at end of file
src/vs/base/browser/ui/fileLabel/fileLabel.ts
浏览文件 @
07af5660
...
...
@@ -4,69 +4,36 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
'
vs/css!./fileLabel
'
;
import
dom
=
require
(
'
vs/base/browser/dom
'
);
import
{
IconLabel
}
from
'
vs/base/browser/ui/iconLabel/iconLabel
'
;
import
uri
from
'
vs/base/common/uri
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
{
HighlightedLabel
}
from
'
vs/base/browser/ui/highlightedlabel/highlightedLabel
'
;
import
{
IMatch
}
from
'
vs/base/common/filters
'
;
import
{
IWorkspaceProvider
,
getPathLabel
}
from
'
vs/base/common/labels
'
;
export
class
FileLabel
{
private
domNode
:
HTMLElement
;
private
labelNode
:
HighlightedLabel
;
private
directoryNode
:
HTMLElement
;
private
basepath
:
string
;
private
path
:
string
;
private
labelHighlights
:
IMatch
[]
=
[];
export
class
FileLabel
extends
IconLabel
{
constructor
(
container
:
HTMLElement
,
arg2
?:
uri
|
string
,
arg3
?:
uri
|
string
|
IWorkspaceProvider
)
{
this
.
domNode
=
dom
.
append
(
container
,
dom
.
$
(
'
.monaco-file-label
'
));
this
.
labelNode
=
new
HighlightedLabel
(
dom
.
append
(
this
.
domNode
,
dom
.
$
(
'
span.file-name
'
)));
this
.
directoryNode
=
dom
.
append
(
this
.
domNode
,
dom
.
$
(
'
span.file-path
'
));
constructor
(
container
:
HTMLElement
,
file
:
uri
,
provider
:
IWorkspaceProvider
)
{
super
(
container
);
if
(
arg3
)
{
this
.
basepath
=
getPath
(
arg3
);
}
if
(
arg2
)
{
this
.
setValue
(
arg2
);
}
}
public
getHTMLElement
():
HTMLElement
{
return
this
.
domNode
;
}
public
setValue
(
arg1
:
uri
|
string
,
labelHighlights
?:
IMatch
[]):
void
{
const
newPath
=
getPath
(
arg1
);
this
.
path
=
newPath
;
this
.
labelHighlights
=
labelHighlights
;
this
.
render
();
this
.
setFile
(
file
,
provider
);
}
private
render
():
void
{
this
.
domNode
.
title
=
this
.
path
;
this
.
labelNode
.
set
(
paths
.
basename
(
this
.
path
),
this
.
labelHighlights
);
const
parent
=
paths
.
dirname
(
this
.
path
);
this
.
directoryNode
.
textContent
=
parent
&&
parent
!==
'
.
'
?
getPathLabel
(
parent
,
this
.
basepath
)
:
''
;
public
setFile
(
file
:
uri
,
provider
:
IWorkspaceProvider
):
void
{
const
path
=
getPath
(
file
);
const
parent
=
paths
.
dirname
(
path
);
this
.
setValue
(
paths
.
basename
(
path
),
parent
&&
parent
!==
'
.
'
?
getPathLabel
(
parent
,
provider
)
:
''
,
{
title
:
path
});
}
}
function
getPath
(
arg1
:
uri
|
string
|
IWorkspaceProvider
):
string
{
function
getPath
(
arg1
:
uri
|
IWorkspaceProvider
):
string
{
if
(
!
arg1
)
{
return
null
;
}
if
(
typeof
arg1
===
'
string
'
)
{
return
arg1
;
}
if
(
types
.
isFunction
((
<
IWorkspaceProvider
>
arg1
).
getWorkspace
))
{
const
ws
=
(
<
IWorkspaceProvider
>
arg1
).
getWorkspace
();
return
ws
?
ws
.
resource
.
fsPath
:
void
0
;
}
...
...
src/vs/base/browser/ui/iconLabel/iconLabel.ts
浏览文件 @
07af5660
...
...
@@ -50,6 +50,12 @@ export class IconLabel {
this
.
descriptionNode
.
textContent
=
description
||
''
;
if
(
!
description
)
{
dom
.
addClass
(
this
.
descriptionNode
,
'
empty
'
);
}
else
{
dom
.
removeClass
(
this
.
descriptionNode
,
'
empty
'
);
}
this
.
domNode
.
title
=
options
&&
options
.
title
?
options
.
title
:
''
;
const
classes
=
[
'
monaco-icon-label
'
];
...
...
src/vs/base/browser/ui/iconLabel/iconlabel.css
浏览文件 @
07af5660
...
...
@@ -37,6 +37,10 @@
white-space
:
pre
;
/* enable to show labels that include multiple whitespaces */
}
.monaco-icon-label
>
.label-description.empty
{
margin-left
:
0
;
}
.monaco-icon-label.italic
>
.label-name
,
.monaco-icon-label.italic
>
.label-description
{
font-style
:
italic
;
...
...
src/vs/workbench/browser/labels.ts
浏览文件 @
07af5660
...
...
@@ -151,6 +151,7 @@ export class EditorLabel extends ResourceLabel {
}
export
interface
IFileLabelOptions
extends
IResourceLabelOptions
{
hideLabel
?:
boolean
;
hidePath
?:
boolean
;
}
...
...
@@ -159,7 +160,7 @@ export class FileLabel extends ResourceLabel {
public
setFile
(
resource
:
uri
,
options
:
IFileLabelOptions
=
Object
.
create
(
null
)):
void
{
this
.
setLabel
({
resource
,
name
:
paths
.
basename
(
resource
.
fsPath
)
,
name
:
!
options
.
hideLabel
?
paths
.
basename
(
resource
.
fsPath
)
:
void
0
,
description
:
!
options
.
hidePath
?
getPathLabel
(
paths
.
dirname
(
resource
.
fsPath
),
this
.
contextService
)
:
void
0
},
options
);
}
...
...
src/vs/workbench/parts/files/browser/views/explorerViewer.ts
浏览文件 @
07af5660
...
...
@@ -21,7 +21,7 @@ import {InputBox} from 'vs/base/browser/ui/inputbox/inputBox';
import
{
$
,
Builder
}
from
'
vs/base/browser/builder
'
;
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
glob
=
require
(
'
vs/base/common/glob
'
);
import
{
FileLabel
}
from
'
vs/workbench/browser/labels
'
;
import
{
FileLabel
,
IFileLabelOptions
}
from
'
vs/workbench/browser/labels
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ContributableActionProvider
}
from
'
vs/workbench/browser/actionBarRegistry
'
;
import
{
LocalFileChangeEvent
,
IFilesConfiguration
,
ITextFileService
}
from
'
vs/workbench/parts/files/common/files
'
;
...
...
@@ -284,10 +284,7 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
// File Rename/Add Input Field
const
editableData
:
IEditableData
=
this
.
state
.
getEditableData
(
stat
);
if
(
editableData
)
{
const
item
=
$
(
'
.explorer-item
'
);
item
.
appendTo
(
el
);
return
this
.
renderInputBox
(
item
,
tree
,
stat
,
editableData
);
return
this
.
renderInputBox
(
el
,
tree
,
stat
,
editableData
);
}
// Label
...
...
@@ -304,9 +301,15 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
}
private
renderInputBox
(
container
:
Builder
,
tree
:
ITree
,
stat
:
FileStat
,
editableData
:
IEditableData
):
IElementCallback
{
const
label
=
this
.
instantiationService
.
createInstance
(
FileLabel
,
container
.
getHTMLElement
(),
void
0
);
const
extraClasses
=
[
'
explorer-item
'
];
const
isFolder
=
stat
.
isDirectory
||
(
stat
instanceof
NewStatPlaceholder
&&
stat
.
isDirectoryPlaceholder
());
const
labelOptions
:
IFileLabelOptions
=
{
hidePath
:
true
,
hideLabel
:
true
,
isFolder
,
extraClasses
};
label
.
setFile
(
stat
.
resource
,
labelOptions
);
// Input field (when creating a new file or folder or renaming)
const
inputBox
=
new
InputBox
(
container
.
getHTMLElement
(),
this
.
contextViewService
,
{
const
inputBox
=
new
InputBox
(
label
.
getHTMLElement
(),
this
.
contextViewService
,
{
validationOptions
:
{
validation
:
editableData
.
validator
,
showMessage
:
true
...
...
@@ -314,6 +317,11 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
ariaLabel
:
nls
.
localize
(
'
fileInputAriaLabel
'
,
"
Type file name. Press Enter to confirm or Escape to cancel.
"
)
});
const
parent
=
paths
.
dirname
(
stat
.
resource
.
fsPath
);
inputBox
.
onDidChange
(
value
=>
{
label
.
setFile
(
URI
.
file
(
paths
.
join
(
parent
,
value
)),
labelOptions
);
// update label icon while typing!
});
const
value
=
stat
.
name
||
''
;
const
lastDot
=
value
.
lastIndexOf
(
'
.
'
);
...
...
@@ -347,7 +355,8 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
}),
DOM
.
addDisposableListener
(
inputBox
.
inputElement
,
'
blur
'
,
()
=>
{
done
(
inputBox
.
isInputValid
());
})
}),
label
];
return
()
=>
done
(
true
);
...
...
src/vs/workbench/parts/markers/browser/markersTreeViewer.ts
浏览文件 @
07af5660
...
...
@@ -164,6 +164,9 @@ export class Renderer implements IRenderer {
}
public
disposeTemplate
(
tree
:
ITree
,
templateId
:
string
,
templateData
:
any
):
void
{
if
(
templateId
===
Renderer
.
RESOURCE_TEMPLATE_ID
)
{
(
<
IResourceTemplateData
>
templateData
).
file
.
dispose
();
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录