Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a73d87ac
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,发现更多精彩内容 >>
提交
a73d87ac
编写于
11月 14, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editor - getName() is required
上级
929fab18
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
54 addition
and
45 deletion
+54
-45
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+1
-1
src/vs/workbench/browser/parts/editor/binaryEditor.ts
src/vs/workbench/browser/parts/editor/binaryEditor.ts
+1
-1
src/vs/workbench/browser/parts/editor/editorGroupView.ts
src/vs/workbench/browser/parts/editor/editorGroupView.ts
+1
-1
src/vs/workbench/browser/parts/editor/editorPicker.ts
src/vs/workbench/browser/parts/editor/editorPicker.ts
+2
-3
src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts
src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts
+1
-1
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+2
-2
src/vs/workbench/browser/parts/editor/titleControl.ts
src/vs/workbench/browser/parts/editor/titleControl.ts
+1
-1
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+3
-3
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+4
-4
src/vs/workbench/common/editor/binaryEditorModel.ts
src/vs/workbench/common/editor/binaryEditorModel.ts
+3
-3
src/vs/workbench/common/editor/dataUriEditorInput.ts
src/vs/workbench/common/editor/dataUriEditorInput.ts
+15
-9
src/vs/workbench/common/editor/diffEditorInput.ts
src/vs/workbench/common/editor/diffEditorInput.ts
+7
-1
src/vs/workbench/common/editor/untitledTextEditorInput.ts
src/vs/workbench/common/editor/untitledTextEditorInput.ts
+1
-3
src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts
...rkbench/contrib/files/browser/editors/binaryFileEditor.ts
+1
-1
src/vs/workbench/contrib/files/browser/views/openEditorsView.ts
.../workbench/contrib/files/browser/views/openEditorsView.ts
+3
-3
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
...s/workbench/contrib/webview/browser/webviewEditorInput.ts
+1
-1
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+1
-1
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+2
-2
src/vs/workbench/services/preferences/common/preferencesEditorInput.ts
...nch/services/preferences/common/preferencesEditorInput.ts
+1
-1
src/vs/workbench/test/common/editor/dataUriEditorInput.test.ts
...s/workbench/test/common/editor/dataUriEditorInput.test.ts
+1
-1
src/vs/workbench/test/common/editor/editorInput.test.ts
src/vs/workbench/test/common/editor/editorInput.test.ts
+2
-2
未找到文件。
src/vs/workbench/browser/labels.ts
浏览文件 @
a73d87ac
...
...
@@ -367,7 +367,7 @@ class ResourceLabelWidget extends IconLabel {
setEditor
(
editor
:
IEditorInput
,
options
?:
IResourceLabelOptions
):
void
{
this
.
setResource
({
resource
:
toResource
(
editor
,
{
supportSideBySide
:
SideBySideEditor
.
MASTER
}),
name
:
withNullAsUndefined
(
editor
.
getName
()
),
name
:
editor
.
getName
(
),
description
:
editor
.
getDescription
(
options
?
options
.
descriptionVerbosity
:
undefined
)
},
options
);
}
...
...
src/vs/workbench/browser/parts/editor/binaryEditor.ts
浏览文件 @
a73d87ac
...
...
@@ -56,7 +56,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
this
.
callbacks
=
callbacks
;
}
getTitle
()
{
getTitle
()
:
string
{
return
this
.
input
?
this
.
input
.
getName
()
:
nls
.
localize
(
'
binaryEditor
'
,
"
Binary Viewer
"
);
}
...
...
src/vs/workbench/browser/parts/editor/editorGroupView.ts
浏览文件 @
a73d87ac
...
...
@@ -1262,7 +1262,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
await
this
.
openEditor
(
editor
);
const
editorResource
=
toResource
(
editor
,
{
supportSideBySide
:
SideBySideEditor
.
MASTER
});
const
res
=
await
this
.
fileDialogService
.
showSaveConfirm
(
editorResource
?
[
editorResource
]
:
editor
.
getName
()
!
);
const
res
=
await
this
.
fileDialogService
.
showSaveConfirm
(
editorResource
?
[
editorResource
]
:
editor
.
getName
());
// It could be that the editor saved meanwhile, so we check again
// to see if anything needs to happen before closing for good.
...
...
src/vs/workbench/browser/parts/editor/editorPicker.ts
浏览文件 @
a73d87ac
...
...
@@ -18,7 +18,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
toResource
,
SideBySideEditor
,
IEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
compareItemsByScore
,
scoreItem
,
ScorerCache
,
prepareQuery
}
from
'
vs/base/parts/quickopen/common/quickOpenScorer
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
export
class
EditorPickerEntry
extends
QuickOpenEntryGroup
{
...
...
@@ -38,8 +37,8 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
};
}
getLabel
()
{
return
withNullAsUndefined
(
this
.
editor
.
getName
()
);
getLabel
()
:
string
{
return
this
.
editor
.
getName
(
);
}
getIcon
():
string
{
...
...
src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts
浏览文件 @
a73d87ac
...
...
@@ -248,7 +248,7 @@ export class NoTabsTitleControl extends TitleControl {
// Editor Label
const
resource
=
toResource
(
editor
,
{
supportSideBySide
:
SideBySideEditor
.
MASTER
});
const
name
=
editor
.
getName
()
||
''
;
const
name
=
editor
.
getName
();
const
{
labelFormat
}
=
this
.
accessor
.
partOptions
;
let
description
:
string
;
...
...
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
a73d87ac
...
...
@@ -65,7 +65,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
return
new
EditorMemento
(
this
.
getId
(),
key
,
Object
.
create
(
null
),
limit
,
editorGroupService
);
// do not persist in storage as diff editors are never persisted
}
getTitle
():
string
|
undefined
{
getTitle
():
string
{
if
(
this
.
input
)
{
return
this
.
input
.
getName
();
}
...
...
@@ -219,7 +219,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
protected
getAriaLabel
():
string
{
let
ariaLabel
:
string
;
const
inputName
=
this
.
input
&&
this
.
input
.
getName
();
const
inputName
=
this
.
input
?
.
getName
();
if
(
this
.
isReadOnly
())
{
ariaLabel
=
inputName
?
nls
.
localize
(
'
readonlyEditorWithInputAriaLabel
'
,
"
{0}. Readonly text compare editor.
"
,
inputName
)
:
nls
.
localize
(
'
readonlyEditorAriaLabel
'
,
"
Readonly text compare editor.
"
);
}
else
{
...
...
src/vs/workbench/browser/parts/editor/titleControl.ts
浏览文件 @
a73d87ac
...
...
@@ -287,7 +287,7 @@ export abstract class TitleControl extends Themable {
label
=
localize
(
'
draggedEditorGroup
'
,
"
{0} (+{1})
"
,
label
,
this
.
group
.
count
-
1
);
}
applyDragImage
(
e
,
withUndefinedAsNull
(
label
)
,
'
monaco-editor-group-drag-image
'
);
applyDragImage
(
e
,
label
,
'
monaco-editor-group-drag-image
'
);
}
}));
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
a73d87ac
...
...
@@ -724,7 +724,7 @@ export class EditorHistoryEntryGroup extends QuickOpenEntryGroup {
export
class
EditorHistoryEntry
extends
EditorQuickOpenEntry
{
private
input
:
IEditorInput
|
IResourceInput
;
private
resource
:
URI
|
undefined
;
private
label
:
string
|
undefined
;
private
label
:
string
;
private
description
?:
string
;
private
dirty
:
boolean
;
...
...
@@ -745,7 +745,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
if
(
input
instanceof
EditorInput
)
{
this
.
resource
=
resourceForEditorHistory
(
input
,
fileService
);
this
.
label
=
types
.
withNullAsUndefined
(
input
.
getName
()
);
this
.
label
=
input
.
getName
(
);
this
.
description
=
input
.
getDescription
();
this
.
dirty
=
input
.
isDirty
();
}
else
{
...
...
@@ -765,7 +765,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
return
this
.
dirty
?
'
dirty
'
:
''
;
}
getLabel
():
string
|
undefined
{
getLabel
():
string
{
return
this
.
label
;
}
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
a73d87ac
...
...
@@ -294,7 +294,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns the display name of this input.
*/
getName
():
string
|
undefined
;
getName
():
string
;
/**
* Returns the display description of this input.
...
...
@@ -360,8 +360,8 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the name of this input that can be shown to the user. Examples include showing the name of the input
* above the editor area when the input is shown.
*/
getName
():
string
|
undefined
{
return
undefined
;
getName
():
string
{
return
`Editor
${
this
.
getTypeId
()}
`
;
}
/**
...
...
@@ -376,7 +376,7 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the title of this input that can be shown to the user. Examples include showing the title of
* the input above the editor area as hover over the input label.
*/
getTitle
(
verbosity
?:
Verbosity
):
string
|
undefined
{
getTitle
(
verbosity
?:
Verbosity
):
string
{
return
this
.
getName
();
}
...
...
src/vs/workbench/common/editor/binaryEditorModel.ts
浏览文件 @
a73d87ac
...
...
@@ -7,7 +7,7 @@ import { EditorModel } from 'vs/workbench/common/editor';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
DataUri
,
basename
}
from
'
vs/base/common/resources
'
;
import
{
DataUri
}
from
'
vs/base/common/resources
'
;
import
{
MIME_BINARY
}
from
'
vs/base/common/mime
'
;
/**
...
...
@@ -20,7 +20,7 @@ export class BinaryEditorModel extends EditorModel {
constructor
(
public
readonly
resource
:
URI
,
private
readonly
name
:
string
|
undefined
,
private
readonly
name
:
string
,
@
IFileService
private
readonly
fileService
:
IFileService
)
{
super
();
...
...
@@ -46,7 +46,7 @@ export class BinaryEditorModel extends EditorModel {
* The name of the binary resource.
*/
getName
():
string
{
return
this
.
name
||
basename
(
this
.
resource
)
;
return
this
.
name
;
}
/**
...
...
src/vs/workbench/common/editor/dataUriEditorInput.ts
浏览文件 @
a73d87ac
...
...
@@ -7,7 +7,7 @@ import { EditorInput } from 'vs/workbench/common/editor';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
BinaryEditorModel
}
from
'
vs/workbench/common/editor/binaryEditorModel
'
;
import
{
DataUri
}
from
'
vs/base/common/resources
'
;
import
{
DataUri
,
basename
}
from
'
vs/base/common/resources
'
;
/**
* An editor input to present data URIs in a binary editor. Data URIs have the form of:
...
...
@@ -17,25 +17,31 @@ export class DataUriEditorInput extends EditorInput {
static
readonly
ID
:
string
=
'
workbench.editors.dataUriEditorInput
'
;
private
readonly
name
:
string
;
private
readonly
description
:
string
|
undefined
;
constructor
(
private
readonly
name
:
string
|
undefined
,
private
readonly
description
:
string
|
undefined
,
name
:
string
|
undefined
,
description
:
string
|
undefined
,
private
readonly
resource
:
URI
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
)
{
super
();
if
(
!
this
.
name
||
!
this
.
description
)
{
if
(
!
name
||
!
description
)
{
const
metadata
=
DataUri
.
parseMetaData
(
this
.
resource
);
if
(
!
this
.
name
)
{
this
.
name
=
metadata
.
get
(
DataUri
.
META_DATA_LABEL
);
if
(
!
name
)
{
name
=
metadata
.
get
(
DataUri
.
META_DATA_LABEL
)
||
basename
(
resource
);
}
if
(
!
this
.
description
)
{
this
.
description
=
metadata
.
get
(
DataUri
.
META_DATA_DESCRIPTION
);
if
(
!
description
)
{
description
=
metadata
.
get
(
DataUri
.
META_DATA_DESCRIPTION
);
}
}
this
.
name
=
name
;
this
.
description
=
description
;
}
getResource
():
URI
{
...
...
@@ -46,7 +52,7 @@ export class DataUriEditorInput extends EditorInput {
return
DataUriEditorInput
.
ID
;
}
getName
():
string
|
undefined
{
getName
():
string
{
return
this
.
name
;
}
...
...
src/vs/workbench/common/editor/diffEditorInput.ts
浏览文件 @
a73d87ac
...
...
@@ -18,7 +18,13 @@ export class DiffEditorInput extends SideBySideEditorInput {
private
cachedModel
:
DiffEditorModel
|
null
=
null
;
constructor
(
name
:
string
,
description
:
string
|
undefined
,
original
:
EditorInput
,
modified
:
EditorInput
,
private
readonly
forceOpenAsBinary
?:
boolean
)
{
constructor
(
name
:
string
,
description
:
string
|
undefined
,
original
:
EditorInput
,
modified
:
EditorInput
,
private
readonly
forceOpenAsBinary
?:
boolean
)
{
super
(
name
,
description
,
original
,
modified
);
}
...
...
src/vs/workbench/common/editor/untitledTextEditorInput.ts
浏览文件 @
a73d87ac
...
...
@@ -109,7 +109,7 @@ export class UntitledTextEditorInput extends EditorInput implements IEncodingSup
return
this
.
labelService
.
getUriLabel
(
this
.
resource
);
}
getTitle
(
verbosity
:
Verbosity
):
string
|
undefined
{
getTitle
(
verbosity
:
Verbosity
):
string
{
if
(
!
this
.
hasAssociatedFilePath
)
{
return
this
.
getName
();
}
...
...
@@ -122,8 +122,6 @@ export class UntitledTextEditorInput extends EditorInput implements IEncodingSup
case
Verbosity
.
LONG
:
return
this
.
longTitle
;
}
return
undefined
;
}
isDirty
():
boolean
{
...
...
src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts
浏览文件 @
a73d87ac
...
...
@@ -51,7 +51,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
}
}
getTitle
():
string
|
undefined
{
getTitle
():
string
{
return
this
.
input
?
this
.
input
.
getName
()
:
nls
.
localize
(
'
binaryFileEditor
'
,
"
Binary File Viewer
"
);
}
}
src/vs/workbench/contrib/files/browser/views/openEditorsView.ts
浏览文件 @
a73d87ac
...
...
@@ -39,7 +39,7 @@ import { IDragAndDropData, DataTransfers } from 'vs/base/browser/dnd';
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
ElementsDragAndDropData
,
DesktopDragAndDropData
}
from
'
vs/base/browser/ui/list/listView
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
with
NullAsUndefined
,
with
UndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
import
{
IWorkingCopyService
}
from
'
vs/workbench/services/workingCopy/common/workingCopyService
'
;
...
...
@@ -619,13 +619,13 @@ class OpenEditorsDragAndDrop implements IListDragAndDrop<OpenEditor | IEditorGro
return
null
;
}
getDragLabel
?(
elements
:
(
OpenEditor
|
IEditorGroup
)[]):
string
|
undefined
{
getDragLabel
?(
elements
:
(
OpenEditor
|
IEditorGroup
)[]):
string
{
if
(
elements
.
length
>
1
)
{
return
String
(
elements
.
length
);
}
const
element
=
elements
[
0
];
return
element
instanceof
OpenEditor
?
withNullAsUndefined
(
element
.
editor
.
getName
()
)
:
element
.
label
;
return
element
instanceof
OpenEditor
?
element
.
editor
.
getName
(
)
:
element
.
label
;
}
onDragStart
(
data
:
IDragAndDropData
,
originalEvent
:
DragEvent
):
void
{
...
...
src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts
浏览文件 @
a73d87ac
...
...
@@ -101,7 +101,7 @@ export class WebviewInput extends EditorInput {
return
this
.
_name
;
}
public
getTitle
(
_verbosity
?:
Verbosity
)
{
public
getTitle
(
_verbosity
?:
Verbosity
)
:
string
{
return
this
.
getName
();
}
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
a73d87ac
...
...
@@ -623,7 +623,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
// Data URI
else
if
(
resource
.
scheme
===
Schemas
.
data
)
{
input
=
instantiationService
.
createInstance
(
DataUriEditorInput
,
label
,
description
,
resource
);
input
=
instantiationService
.
createInstance
(
DataUriEditorInput
,
label
||
basename
(
resource
)
,
description
,
resource
);
}
// Resource
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
a73d87ac
...
...
@@ -484,8 +484,8 @@ export class HistoryService extends Disposable implements IHistoryService {
private
handleEditorEventInHistory
(
editor
?:
IBaseEditor
):
void
{
const
input
=
editor
?.
input
;
// Ensure we have
at least a name to show and
not configured to exclude input
if
(
!
input
||
!
input
.
getName
()
||
!
this
.
include
(
input
))
{
// Ensure we have not configured to exclude input
if
(
!
input
||
!
this
.
include
(
input
))
{
return
;
}
...
...
src/vs/workbench/services/preferences/common/preferencesEditorInput.ts
浏览文件 @
a73d87ac
...
...
@@ -21,7 +21,7 @@ export class PreferencesEditorInput extends SideBySideEditorInput {
return
PreferencesEditorInput
.
ID
;
}
getTitle
(
verbosity
:
Verbosity
):
string
|
undefined
{
getTitle
(
verbosity
:
Verbosity
):
string
{
return
this
.
master
.
getTitle
(
verbosity
);
}
}
...
...
src/vs/workbench/test/common/editor/dataUriEditorInput.test.ts
浏览文件 @
a73d87ac
...
...
@@ -31,4 +31,4 @@ suite('DataUriEditorInput', () => {
assert
.
equal
(
model
.
getMime
(),
'
image/png
'
);
});
});
});
\ No newline at end of file
});
src/vs/workbench/test/common/editor/editorInput.test.ts
浏览文件 @
a73d87ac
...
...
@@ -22,7 +22,7 @@ suite('Workbench editor input', () => {
assert
(
input
.
matches
(
input
));
assert
(
!
input
.
matches
(
otherInput
));
assert
(
!
input
.
matches
(
null
));
assert
(
!
input
.
getName
());
assert
(
input
.
getName
());
input
.
onDispose
(()
=>
{
assert
(
true
);
...
...
@@ -84,4 +84,4 @@ suite('Workbench editor input', () => {
otherInput
.
dispose
();
assert
.
equal
(
counter
,
2
);
});
});
\ No newline at end of file
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录