Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c54e49d5
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,发现更多精彩内容 >>
未验证
提交
c54e49d5
编写于
9月 01, 2018
作者:
M
Martin Aeschlimann
提交者:
GitHub
9月 01, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #57690 from Microsoft/isidorn/lazyFormatter
label: handle lazy formaters
上级
5653b942
941701dc
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
26 addition
and
10 deletion
+26
-10
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+3
-3
src/vs/editor/standalone/browser/simpleServices.ts
src/vs/editor/standalone/browser/simpleServices.ts
+3
-3
src/vs/platform/history/electron-main/historyMainService.ts
src/vs/platform/history/electron-main/historyMainService.ts
+1
-0
src/vs/platform/label/common/label.ts
src/vs/platform/label/common/label.ts
+8
-3
src/vs/platform/label/electron-browser/label.contribution.ts
src/vs/platform/label/electron-browser/label.contribution.ts
+1
-1
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+4
-0
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+1
-0
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
...kbench/parts/files/electron-browser/views/explorerView.ts
+5
-0
未找到文件。
src/vs/code/electron-main/app.ts
浏览文件 @
c54e49d5
...
...
@@ -62,7 +62,7 @@ import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
import
{
IMenubarService
}
from
'
vs/platform/menubar/common/menubar
'
;
import
{
MenubarService
}
from
'
vs/platform/menubar/electron-main/menubarService
'
;
import
{
MenubarChannel
}
from
'
vs/platform/menubar/node/menubarIpc
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
ILabelService
,
RegisterFormatterEvent
}
from
'
vs/platform/label/common/label
'
;
import
{
CodeMenu
}
from
'
vs/code/electron-main/menus
'
;
import
{
hasArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
...
...
@@ -233,8 +233,8 @@ export class CodeApplication {
}
});
ipc
.
on
(
'
vscode:labelRegisterFormat
er
'
,
(
event
:
any
,
{
scheme
,
formater
}
)
=>
{
this
.
labelService
.
registerFormatter
(
scheme
,
forma
ter
);
ipc
.
on
(
'
vscode:labelRegisterFormat
ter
'
,
(
event
:
any
,
data
:
RegisterFormatterEvent
)
=>
{
this
.
labelService
.
registerFormatter
(
data
.
scheme
,
data
.
format
ter
);
});
ipc
.
on
(
'
vscode:toggleDevTools
'
,
(
event
:
Event
)
=>
{
...
...
src/vs/editor/standalone/browser/simpleServices.ts
浏览文件 @
c54e49d5
...
...
@@ -45,7 +45,7 @@ import { WorkspaceEdit, isResourceTextEdit, TextEdit } from 'vs/editor/common/mo
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ILabelService
,
LabelRules
}
from
'
vs/platform/label/common/label
'
;
import
{
ILabelService
,
LabelRules
,
RegisterFormatterEvent
}
from
'
vs/platform/label/common/label
'
;
export
class
SimpleModel
implements
ITextEditorModel
{
...
...
@@ -599,8 +599,8 @@ export class SimpleBulkEditService implements IBulkEditService {
export
class
SimpleUriLabelService
implements
ILabelService
{
_serviceBrand
:
any
;
private
readonly
_onDidRegisterFormatter
:
Emitter
<
{
scheme
:
string
,
formatter
:
LabelRules
}
>
=
new
Emitter
<
{
scheme
:
string
,
formatter
:
LabelRules
}
>
();
public
readonly
onDidRegisterFormatter
:
Event
<
{
scheme
:
string
,
formatter
:
LabelRules
}
>
=
this
.
_onDidRegisterFormatter
.
event
;
private
readonly
_onDidRegisterFormatter
:
Emitter
<
RegisterFormatterEvent
>
=
new
Emitter
<
RegisterFormatterEvent
>
();
public
readonly
onDidRegisterFormatter
:
Event
<
RegisterFormatterEvent
>
=
this
.
_onDidRegisterFormatter
.
event
;
public
getUriLabel
(
resource
:
URI
,
relative
?:
boolean
):
string
{
if
(
resource
.
scheme
===
'
file
'
)
{
...
...
src/vs/platform/history/electron-main/historyMainService.ts
浏览文件 @
c54e49d5
...
...
@@ -60,6 +60,7 @@ export class HistoryMainService implements IHistoryMainService {
private
registerListeners
():
void
{
this
.
workspacesMainService
.
onWorkspaceSaved
(
e
=>
this
.
onWorkspaceSaved
(
e
));
this
.
labelService
.
onDidRegisterFormatter
(()
=>
this
.
_onRecentlyOpenedChange
.
fire
());
}
private
onWorkspaceSaved
(
e
:
IWorkspaceSavedEvent
):
void
{
...
...
src/vs/platform/label/common/label.ts
浏览文件 @
c54e49d5
...
...
@@ -19,12 +19,17 @@ import { isParent } from 'vs/platform/files/common/files';
import
{
basename
,
dirname
,
join
}
from
'
vs/base/common/paths
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
export
interface
RegisterFormatterEvent
{
scheme
:
string
;
formatter
:
LabelRules
;
}
export
interface
ILabelService
{
_serviceBrand
:
any
;
getUriLabel
(
resource
:
URI
,
relative
?:
boolean
,
forceNoTildify
?:
boolean
):
string
;
getWorkspaceLabel
(
workspace
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
|
IWorkspace
),
options
?:
{
verbose
:
boolean
}):
string
;
registerFormatter
(
schema
:
string
,
formatter
:
LabelRules
):
IDisposable
;
onDidRegisterFormatter
:
Event
<
{
scheme
:
string
,
formatter
:
LabelRules
}
>
;
onDidRegisterFormatter
:
Event
<
RegisterFormatterEvent
>
;
}
export
interface
LabelRules
{
...
...
@@ -51,14 +56,14 @@ export class LabelService implements ILabelService {
_serviceBrand
:
any
;
private
readonly
formatters
=
new
Map
<
string
,
LabelRules
>
();
private
readonly
_onDidRegisterFormatter
=
new
Emitter
<
{
scheme
:
string
,
formatter
:
LabelRules
}
>
();
private
readonly
_onDidRegisterFormatter
=
new
Emitter
<
RegisterFormatterEvent
>
();
constructor
(
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
)
{
}
get
onDidRegisterFormatter
():
Event
<
{
scheme
:
string
,
formatter
:
LabelRules
}
>
{
get
onDidRegisterFormatter
():
Event
<
RegisterFormatterEvent
>
{
return
this
.
_onDidRegisterFormatter
.
event
;
}
...
...
src/vs/platform/label/electron-browser/label.contribution.ts
浏览文件 @
c54e49d5
...
...
@@ -17,7 +17,7 @@ class LabelRegistrationContribution implements IWorkbenchContribution {
constructor
(@
ILabelService
labelService
:
ILabelService
)
{
labelService
.
onDidRegisterFormatter
(
data
=>
{
ipc
.
send
(
'
vscode:labelRegisterFormater
'
,
data
);
ipc
.
send
(
'
vscode:labelRegisterFormat
t
er
'
,
data
);
});
}
}
...
...
src/vs/workbench/browser/labels.ts
浏览文件 @
c54e49d5
...
...
@@ -139,6 +139,10 @@ export class ResourceLabel extends IconLabel {
return
true
;
// same resource but different kind (file, folder)
}
if
(
newResource
&&
this
.
computedPathLabel
!==
this
.
labelService
.
getUriLabel
(
newResource
))
{
return
true
;
}
if
(
newResource
&&
oldResource
)
{
return
newResource
.
toString
()
!==
oldResource
.
toString
();
}
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
c54e49d5
...
...
@@ -102,6 +102,7 @@ export class TitlebarPart extends Part implements ITitleService {
this
.
_register
(
this
.
contextService
.
onDidChangeWorkspaceFolders
(()
=>
this
.
setTitle
(
this
.
getWindowTitle
())));
this
.
_register
(
this
.
contextService
.
onDidChangeWorkbenchState
(()
=>
this
.
setTitle
(
this
.
getWindowTitle
())));
this
.
_register
(
this
.
contextService
.
onDidChangeWorkspaceName
(()
=>
this
.
setTitle
(
this
.
getWindowTitle
())));
this
.
_register
(
this
.
labelService
.
onDidRegisterFormatter
(()
=>
this
.
setTitle
(
this
.
getWindowTitle
())));
}
private
onBlur
():
void
{
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
浏览文件 @
c54e49d5
...
...
@@ -145,6 +145,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
};
this
.
disposables
.
push
(
this
.
contextService
.
onDidChangeWorkspaceName
(
setHeader
));
this
.
disposables
.
push
(
this
.
labelService
.
onDidRegisterFormatter
(
setHeader
));
setHeader
();
}
...
...
@@ -200,6 +201,10 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
this
.
disposables
.
push
(
this
.
contextService
.
onDidChangeWorkspaceFolders
(
e
=>
this
.
refreshFromEvent
(
e
.
added
)));
this
.
disposables
.
push
(
this
.
contextService
.
onDidChangeWorkbenchState
(
e
=>
this
.
refreshFromEvent
()));
this
.
disposables
.
push
(
this
.
fileService
.
onDidChangeFileSystemProviderRegistrations
(()
=>
this
.
refreshFromEvent
()));
this
.
disposables
.
push
(
this
.
labelService
.
onDidRegisterFormatter
(()
=>
{
this
.
_onDidChangeTitleArea
.
fire
();
this
.
refreshFromEvent
();
}));
}
layoutBody
(
size
:
number
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录