Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c9c396c7
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,发现更多精彩内容 >>
提交
c9c396c7
编写于
4月 10, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tildify path label if possible (fixes #24045)
上级
ebf71dae
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
62 addition
and
35 deletion
+62
-35
src/vs/base/browser/ui/iconLabel/iconLabel.ts
src/vs/base/browser/ui/iconLabel/iconLabel.ts
+5
-5
src/vs/base/common/labels.ts
src/vs/base/common/labels.ts
+11
-2
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+5
-3
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+4
-2
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+1
-1
src/vs/workbench/common/editor/untitledEditorInput.ts
src/vs/workbench/common/editor/untitledEditorInput.ts
+4
-2
src/vs/workbench/parts/files/browser/fileActions.ts
src/vs/workbench/parts/files/browser/fileActions.ts
+4
-2
src/vs/workbench/parts/files/browser/views/explorerView.ts
src/vs/workbench/parts/files/browser/views/explorerView.ts
+4
-2
src/vs/workbench/parts/files/common/editors/fileEditorInput.ts
...s/workbench/parts/files/common/editors/fileEditorInput.ts
+3
-3
src/vs/workbench/parts/search/browser/openFileHandler.ts
src/vs/workbench/parts/search/browser/openFileHandler.ts
+4
-2
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
+4
-2
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+13
-9
未找到文件。
src/vs/base/browser/ui/iconLabel/iconLabel.ts
浏览文件 @
c9c396c7
...
...
@@ -12,7 +12,7 @@ import { IMatch } from 'vs/base/common/filters';
import
uri
from
'
vs/base/common/uri
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
{
IWorkspaceProvider
,
getPathLabel
}
from
'
vs/base/common/labels
'
;
import
{
IWorkspaceProvider
,
getPathLabel
,
IUserHomeProvider
}
from
'
vs/base/common/labels
'
;
export
interface
IIconLabelCreationOptions
{
supportHighlights
?:
boolean
;
...
...
@@ -99,17 +99,17 @@ export class IconLabel {
export
class
FileLabel
extends
IconLabel
{
constructor
(
container
:
HTMLElement
,
file
:
uri
,
provider
:
IWorkspaceProvider
)
{
constructor
(
container
:
HTMLElement
,
file
:
uri
,
provider
:
IWorkspaceProvider
,
userHome
?:
IUserHomeProvider
)
{
super
(
container
);
this
.
setFile
(
file
,
provider
);
this
.
setFile
(
file
,
provider
,
userHome
);
}
public
setFile
(
file
:
uri
,
provider
:
IWorkspaceProvider
):
void
{
public
setFile
(
file
:
uri
,
provider
:
IWorkspaceProvider
,
userHome
:
IUserHomeProvider
):
void
{
const
path
=
getPath
(
file
);
const
parent
=
paths
.
dirname
(
path
);
this
.
setValue
(
paths
.
basename
(
path
),
parent
&&
parent
!==
'
.
'
?
getPathLabel
(
parent
,
provider
)
:
''
,
{
title
:
path
});
this
.
setValue
(
paths
.
basename
(
path
),
parent
&&
parent
!==
'
.
'
?
getPathLabel
(
parent
,
provider
,
userHome
)
:
''
,
{
title
:
path
});
}
}
...
...
src/vs/base/common/labels.ts
浏览文件 @
c9c396c7
...
...
@@ -25,6 +25,10 @@ export interface IWorkspaceProvider {
};
}
export
interface
IUserHomeProvider
{
userHome
:
string
;
}
export
class
PathLabelProvider
implements
ILabelProvider
{
private
root
:
string
;
...
...
@@ -37,7 +41,7 @@ export class PathLabelProvider implements ILabelProvider {
}
}
export
function
getPathLabel
(
resource
:
URI
|
string
,
basePathProvider
?:
URI
|
string
|
IWorkspaceProvider
):
string
{
export
function
getPathLabel
(
resource
:
URI
|
string
,
basePathProvider
?:
URI
|
string
|
IWorkspaceProvider
,
userHomeProvider
?:
IUserHomeProvider
):
string
{
const
absolutePath
=
getPath
(
resource
);
if
(
!
absolutePath
)
{
return
null
;
...
...
@@ -57,7 +61,12 @@ export function getPathLabel(resource: URI | string, basePathProvider?: URI | st
return
normalize
(
absolutePath
.
charAt
(
0
).
toUpperCase
()
+
absolutePath
.
slice
(
1
),
true
);
// convert c:\something => C:\something
}
return
normalize
(
absolutePath
,
true
);
let
res
=
normalize
(
absolutePath
,
true
);
if
(
!
platform
.
isWindows
&&
userHomeProvider
)
{
res
=
tildify
(
res
,
userHomeProvider
.
userHome
);
}
return
res
;
}
function
getPath
(
arg1
:
URI
|
string
|
IWorkspaceProvider
):
string
{
...
...
src/vs/workbench/browser/labels.ts
浏览文件 @
c9c396c7
...
...
@@ -18,6 +18,7 @@ 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
'
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
export
interface
IEditorLabel
{
name
:
string
;
...
...
@@ -43,7 +44,8 @@ export class ResourceLabel extends IconLabel {
@
IWorkspaceContextService
protected
contextService
:
IWorkspaceContextService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
@
IModelService
private
modelService
:
IModelService
,
@
IEnvironmentService
protected
environmentService
:
IEnvironmentService
)
{
super
(
container
,
options
);
...
...
@@ -113,7 +115,7 @@ export class ResourceLabel extends IconLabel {
if
(
this
.
options
&&
typeof
this
.
options
.
title
===
'
string
'
)
{
title
=
this
.
options
.
title
;
}
else
if
(
resource
)
{
title
=
getPathLabel
(
resource
.
fsPath
);
title
=
getPathLabel
(
resource
.
fsPath
,
void
0
,
this
.
environmentService
);
}
if
(
!
this
.
computedIconClasses
)
{
...
...
@@ -164,7 +166,7 @@ export class FileLabel extends ResourceLabel {
this
.
setLabel
({
resource
,
name
:
!
options
.
hideLabel
?
paths
.
basename
(
resource
.
fsPath
)
:
void
0
,
description
:
!
options
.
hidePath
?
getPathLabel
(
paths
.
dirname
(
resource
.
fsPath
),
this
.
contextService
)
:
void
0
description
:
!
options
.
hidePath
?
getPathLabel
(
paths
.
dirname
(
resource
.
fsPath
),
this
.
contextService
,
this
.
environmentService
)
:
void
0
},
options
);
}
}
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
c9c396c7
...
...
@@ -51,6 +51,7 @@ import { IListService } from 'vs/platform/list/browser/listService';
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
SIDE_BAR_BACKGROUND
}
from
"
vs/workbench/common/theme
"
;
import
{
attachQuickOpenStyler
}
from
"
vs/platform/theme/common/styler
"
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
const
HELP_PREFIX
=
'
?
'
;
...
...
@@ -1112,7 +1113,8 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
@
IModelService
private
modelService
:
IModelService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
super
(
editorService
);
...
...
@@ -1127,7 +1129,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
const
resourceInput
=
input
as
IResourceInput
;
this
.
resource
=
resourceInput
.
resource
;
this
.
label
=
paths
.
basename
(
resourceInput
.
resource
.
fsPath
);
this
.
description
=
labels
.
getPathLabel
(
paths
.
dirname
(
this
.
resource
.
fsPath
),
contextService
);
this
.
description
=
labels
.
getPathLabel
(
paths
.
dirname
(
this
.
resource
.
fsPath
),
contextService
,
environmentService
);
this
.
dirty
=
this
.
resource
&&
this
.
textFileService
.
isDirty
(
this
.
resource
);
if
(
this
.
dirty
&&
this
.
textFileService
.
getAutoSaveMode
()
===
AutoSaveMode
.
AFTER_SHORT_DELAY
)
{
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
c9c396c7
...
...
@@ -71,7 +71,7 @@ export class TitlebarPart extends Part implements ITitleService {
this
.
isPure
=
true
;
this
.
activeEditorListeners
=
[];
this
.
workspacePath
=
contextService
.
hasWorkspace
()
?
labels
.
tildify
(
labels
.
getPathLabel
(
contextService
.
getWorkspace
().
resource
),
environmentService
.
userHom
e
)
:
''
;
this
.
workspacePath
=
contextService
.
hasWorkspace
()
?
labels
.
getPathLabel
(
contextService
.
getWorkspace
().
resource
,
void
0
,
environmentServic
e
)
:
''
;
this
.
init
();
...
...
src/vs/workbench/common/editor/untitledEditorInput.ts
浏览文件 @
c9c396c7
...
...
@@ -18,6 +18,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
telemetryURIDescriptor
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
/**
* An editor input to be used for untitled text buffers.
...
...
@@ -46,7 +47,8 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
initialValue
:
string
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
ITextFileService
private
textFileService
:
ITextFileService
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
super
();
...
...
@@ -92,7 +94,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
}
public
getDescription
():
string
{
return
this
.
hasAssociatedFilePath
?
labels
.
getPathLabel
(
paths
.
dirname
(
this
.
resource
.
fsPath
),
this
.
contextService
)
:
null
;
return
this
.
hasAssociatedFilePath
?
labels
.
getPathLabel
(
paths
.
dirname
(
this
.
resource
.
fsPath
),
this
.
contextService
,
this
.
environmentService
)
:
null
;
}
public
isDirty
():
boolean
{
...
...
src/vs/workbench/parts/files/browser/fileActions.ts
浏览文件 @
c9c396c7
...
...
@@ -48,6 +48,7 @@ import { ITextModelResolverService } from 'vs/editor/common/services/resolverSer
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
withFocussedFilesExplorer
,
revealInOSCommand
,
revealInExplorerCommand
,
copyPathCommand
}
from
'
vs/workbench/parts/files/browser/fileCommands
'
;
import
{
ITelemetryData
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
export
interface
IEditableData
{
action
:
IAction
;
...
...
@@ -1168,7 +1169,8 @@ export class GlobalCompareResourcesAction extends Action {
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IHistoryService
private
historyService
:
IHistoryService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IMessageService
private
messageService
:
IMessageService
@
IMessageService
private
messageService
:
IMessageService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
super
(
id
,
label
);
}
...
...
@@ -1202,7 +1204,7 @@ export class GlobalCompareResourcesAction extends Action {
}
label
=
paths
.
basename
(
resource
.
fsPath
);
description
=
resource
.
scheme
===
'
file
'
?
labels
.
getPathLabel
(
paths
.
dirname
(
resource
.
fsPath
),
this
.
contextService
)
:
void
0
;
description
=
resource
.
scheme
===
'
file
'
?
labels
.
getPathLabel
(
paths
.
dirname
(
resource
.
fsPath
),
this
.
contextService
,
this
.
environmentService
)
:
void
0
;
return
<
IHistoryPickEntry
>
{
input
,
resource
,
label
,
description
};
}).
filter
(
p
=>
!!
p
);
...
...
src/vs/workbench/parts/files/browser/views/explorerView.ts
浏览文件 @
c9c396c7
...
...
@@ -41,6 +41,7 @@ import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/c
import
{
ResourceContextKey
}
from
'
vs/workbench/common/resourceContextKey
'
;
import
{
IWorkbenchThemeService
,
IFileIconTheme
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
export
class
ExplorerView
extends
CollapsibleViewletView
{
...
...
@@ -90,7 +91,8 @@ export class ExplorerView extends CollapsibleViewletView {
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IWorkbenchThemeService
private
themeService
:
IWorkbenchThemeService
@
IWorkbenchThemeService
private
themeService
:
IWorkbenchThemeService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
super
(
actionRunner
,
false
,
nls
.
localize
(
'
explorerSection
'
,
"
Files Explorer Section
"
),
messageService
,
keybindingService
,
contextMenuService
,
headerSize
);
...
...
@@ -111,7 +113,7 @@ export class ExplorerView extends CollapsibleViewletView {
public
renderHeader
(
container
:
HTMLElement
):
void
{
const
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
$
(
'
span
'
).
text
(
this
.
contextService
.
getWorkspace
().
name
).
title
(
labels
.
getPathLabel
(
this
.
contextService
.
getWorkspace
().
resource
.
fsPath
)).
appendTo
(
titleDiv
);
$
(
'
span
'
).
text
(
this
.
contextService
.
getWorkspace
().
name
).
title
(
labels
.
getPathLabel
(
this
.
contextService
.
getWorkspace
().
resource
.
fsPath
,
void
0
,
this
.
environmentService
)).
appendTo
(
titleDiv
);
super
.
renderHeader
(
container
);
}
...
...
src/vs/workbench/parts/files/common/editors/fileEditorInput.ts
浏览文件 @
c9c396c7
...
...
@@ -143,7 +143,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
public
getDescription
():
string
{
if
(
!
this
.
description
)
{
this
.
description
=
labels
.
getPathLabel
(
paths
.
dirname
(
this
.
resource
.
fsPath
),
this
.
contextService
);
this
.
description
=
labels
.
getPathLabel
(
paths
.
dirname
(
this
.
resource
.
fsPath
),
this
.
contextService
,
this
.
environmentService
);
}
return
this
.
description
;
...
...
@@ -156,10 +156,10 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput {
title
=
this
.
shortTitle
?
this
.
shortTitle
:
(
this
.
shortTitle
=
this
.
getName
());
break
;
case
Verbosity
.
MEDIUM
:
title
=
this
.
mediumTitle
?
this
.
mediumTitle
:
(
this
.
mediumTitle
=
labels
.
getPathLabel
(
this
.
resource
,
this
.
contextService
));
title
=
this
.
mediumTitle
?
this
.
mediumTitle
:
(
this
.
mediumTitle
=
labels
.
getPathLabel
(
this
.
resource
,
this
.
contextService
,
this
.
environmentService
));
break
;
case
Verbosity
.
LONG
:
title
=
this
.
longTitle
?
this
.
longTitle
:
(
this
.
longTitle
=
labels
.
tildify
(
labels
.
getPathLabel
(
this
.
resource
),
this
.
environmentService
.
userHom
e
));
title
=
this
.
longTitle
?
this
.
longTitle
:
(
this
.
longTitle
=
labels
.
getPathLabel
(
this
.
resource
,
void
0
,
this
.
environmentServic
e
));
break
;
}
...
...
src/vs/workbench/parts/search/browser/openFileHandler.ts
浏览文件 @
c9c396c7
...
...
@@ -30,6 +30,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IQueryOptions
,
ISearchService
,
ISearchStats
,
ISearchQuery
}
from
'
vs/platform/search/common/search
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
export
class
FileQuickOpenModel
extends
QuickOpenModel
{
...
...
@@ -119,7 +120,8 @@ export class OpenFileHandler extends QuickOpenHandler {
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IWorkbenchThemeService
private
themeService
:
IWorkbenchThemeService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
ISearchService
private
searchService
:
ISearchService
@
ISearchService
private
searchService
:
ISearchService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
super
();
...
...
@@ -166,7 +168,7 @@ export class OpenFileHandler extends QuickOpenHandler {
const
fileMatch
=
complete
.
results
[
i
];
const
label
=
paths
.
basename
(
fileMatch
.
resource
.
fsPath
);
const
description
=
labels
.
getPathLabel
(
paths
.
dirname
(
fileMatch
.
resource
.
fsPath
),
this
.
contextService
);
const
description
=
labels
.
getPathLabel
(
paths
.
dirname
(
fileMatch
.
resource
.
fsPath
),
this
.
contextService
,
this
.
environmentService
);
results
.
push
(
this
.
instantiationService
.
createInstance
(
FileEntry
,
fileMatch
.
resource
,
label
,
description
,
iconClass
));
}
...
...
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
浏览文件 @
c9c396c7
...
...
@@ -24,6 +24,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IWorkspaceSymbolProvider
,
getWorkspaceSymbols
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
class
SymbolEntry
extends
EditorQuickOpenEntry
{
...
...
@@ -34,7 +35,8 @@ class SymbolEntry extends EditorQuickOpenEntry {
private
_provider
:
IWorkspaceSymbolProvider
,
@
IConfigurationService
private
_configurationService
:
IConfigurationService
,
@
IWorkspaceContextService
private
_contextService
:
IWorkspaceContextService
,
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
,
@
IEnvironmentService
private
_environmentService
:
IEnvironmentService
)
{
super
(
editorService
);
}
...
...
@@ -50,7 +52,7 @@ class SymbolEntry extends EditorQuickOpenEntry {
public
getDescription
():
string
{
let
result
=
this
.
_bearing
.
containerName
;
if
(
!
result
&&
this
.
_bearing
.
location
.
uri
)
{
result
=
labels
.
getPathLabel
(
this
.
_bearing
.
location
.
uri
,
this
.
_contextService
);
result
=
labels
.
getPathLabel
(
this
.
_bearing
.
location
.
uri
,
this
.
_contextService
,
this
.
_environmentService
);
}
return
result
;
}
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
c9c396c7
...
...
@@ -22,6 +22,7 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
getPathLabel
,
IWorkspaceProvider
}
from
'
vs/base/common/labels
'
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
export
interface
IEditorPart
{
openEditor
(
input
?:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
,
sideBySide
?:
boolean
):
TPromise
<
BaseEditor
>
;
...
...
@@ -47,7 +48,8 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
editorPart
:
IEditorPart
|
IWorkbenchEditorService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
@
IWorkspaceContextService
private
workspaceContextService
:
IWorkspaceContextService
,
@
IInstantiationService
private
instantiationService
?:
IInstantiationService
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
this
.
editorPart
=
editorPart
;
this
.
fileInputDescriptor
=
Registry
.
as
<
IEditorRegistry
>
(
Extensions
.
Editors
).
getDefaultFileInput
();
...
...
@@ -224,7 +226,7 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
if
(
resourceDiffInput
.
leftResource
&&
resourceDiffInput
.
rightResource
)
{
return
this
.
createInput
({
resource
:
resourceDiffInput
.
leftResource
}).
then
(
leftInput
=>
{
return
this
.
createInput
({
resource
:
resourceDiffInput
.
rightResource
}).
then
(
rightInput
=>
{
const
label
=
resourceDiffInput
.
label
||
t
oDiffLabel
(
resourceDiffInput
.
leftResource
,
resourceDiffInput
.
rightResource
,
this
.
workspaceContex
tService
);
const
label
=
resourceDiffInput
.
label
||
t
his
.
toDiffLabel
(
resourceDiffInput
.
leftResource
,
resourceDiffInput
.
rightResource
,
this
.
workspaceContextService
,
this
.
environmen
tService
);
return
new
DiffEditorInput
(
label
,
resourceDiffInput
.
description
,
leftInput
,
rightInput
);
});
...
...
@@ -265,13 +267,13 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
return
typedFileInput
;
});
}
}
function
toDiffLabel
(
res1
:
URI
,
res2
:
URI
,
context
:
IWorkspaceProvider
):
string
{
const
leftName
=
getPathLabel
(
res1
.
fsPath
,
contex
t
);
const
rightName
=
getPathLabel
(
res2
.
fsPath
,
contex
t
);
private
toDiffLabel
(
res1
:
URI
,
res2
:
URI
,
context
:
IWorkspaceProvider
,
environment
:
IEnvironmentService
):
string
{
const
leftName
=
getPathLabel
(
res1
.
fsPath
,
context
,
environmen
t
);
const
rightName
=
getPathLabel
(
res2
.
fsPath
,
context
,
environmen
t
);
return
nls
.
localize
(
'
compareLabels
'
,
"
{0} ↔ {1}
"
,
leftName
,
rightName
);
}
}
export
interface
IEditorOpenHandler
{
...
...
@@ -297,13 +299,15 @@ export class DelegatingWorkbenchEditorService extends WorkbenchEditorService {
@
IUntitledEditorService
untitledEditorService
:
IUntitledEditorService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IWorkspaceContextService
workspaceContextService
:
IWorkspaceContextService
,
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
super
(
editorService
,
untitledEditorService
,
workspaceContextService
,
instantiationService
instantiationService
,
environmentService
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录