Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2d07f086
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,发现更多精彩内容 >>
提交
2d07f086
编写于
5月 19, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no more EditorInput#status
上级
6d1d5d42
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
22 addition
and
132 deletion
+22
-132
src/vs/workbench/browser/parts/editor/editorPicker.ts
src/vs/workbench/browser/parts/editor/editorPicker.ts
+2
-6
src/vs/workbench/browser/parts/editor/media/close-dirty-inverse.svg
...kbench/browser/parts/editor/media/close-dirty-inverse.svg
+0
-0
src/vs/workbench/browser/parts/editor/media/close-dirty.svg
src/vs/workbench/browser/parts/editor/media/close-dirty.svg
+0
-0
src/vs/workbench/browser/parts/editor/media/close-inverse.svg
...vs/workbench/browser/parts/editor/media/close-inverse.svg
+0
-0
src/vs/workbench/browser/parts/editor/media/sidebyside.css
src/vs/workbench/browser/parts/editor/media/sidebyside.css
+10
-10
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
...workbench/browser/parts/editor/sideBySideEditorControl.ts
+2
-4
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+1
-35
src/vs/workbench/common/editor/diffEditorInput.ts
src/vs/workbench/common/editor/diffEditorInput.ts
+1
-21
src/vs/workbench/common/editor/untitledEditorInput.ts
src/vs/workbench/common/editor/untitledEditorInput.ts
+1
-10
src/vs/workbench/parts/files/browser/editors/fileEditorInput.ts
.../workbench/parts/files/browser/editors/fileEditorInput.ts
+3
-43
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+2
-3
未找到文件。
src/vs/workbench/browser/parts/editor/editorPicker.ts
浏览文件 @
2d07f086
...
...
@@ -34,12 +34,8 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
this
.
stacks
=
editorService
.
getStacksModel
();
}
public
getPrefix
():
string
{
if
(
this
.
editor
.
isDirty
())
{
return
'
\
u25cf
'
;
// dirty decoration
}
return
void
0
;
public
getIcon
():
string
{
return
this
.
editor
.
isDirty
()
?
'
dirty
'
:
''
;
}
public
getLabel
():
string
{
...
...
src/vs/workbench/browser/parts/editor/media/close-d
ecorated
-inverse.svg
→
src/vs/workbench/browser/parts/editor/media/close-d
irty
-inverse.svg
浏览文件 @
2d07f086
文件已移动
src/vs/workbench/browser/parts/editor/media/close-d
ecorated
.svg
→
src/vs/workbench/browser/parts/editor/media/close-d
irty
.svg
浏览文件 @
2d07f086
文件已移动
src/vs/workbench/browser/parts/editor/media/close-
dark
.svg
→
src/vs/workbench/browser/parts/editor/media/close-
inverse
.svg
浏览文件 @
2d07f086
文件已移动
src/vs/workbench/browser/parts/editor/media/sidebyside.css
浏览文件 @
2d07f086
...
...
@@ -169,21 +169,21 @@
}
.monaco-workbench
.close-editor-action
,
.monaco-workbench
.close-editor-d
ecorated
-action
:hover
{
.monaco-workbench
.close-editor-d
irty
-action
:hover
{
background
:
url('close.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
.close-editor-action
,
.vs-dark
.monaco-workbench
.close-editor-d
ecorated
-action
:hover
{
background
:
url('close-
dark
.svg')
center
center
no-repeat
;
.vs-dark
.monaco-workbench
.close-editor-d
irty
-action
:hover
{
background
:
url('close-
inverse
.svg')
center
center
no-repeat
;
}
.monaco-workbench
.close-editor-d
ecorated
-action
{
background
:
url('close-d
ecorated
.svg')
center
center
no-repeat
;
.monaco-workbench
.close-editor-d
irty
-action
{
background
:
url('close-d
irty
.svg')
center
center
no-repeat
;
}
.vs-dark
.monaco-workbench
.close-editor-d
ecorated
-action
{
background
:
url('close-d
ecorated
-inverse.svg')
center
center
no-repeat
;
.vs-dark
.monaco-workbench
.close-editor-d
irty
-action
{
background
:
url('close-d
irty
-inverse.svg')
center
center
no-repeat
;
}
.monaco-workbench
.split-editor-action
{
...
...
@@ -213,7 +213,7 @@
/* High Contrast Theming */
.hc-black
.monaco-workbench
.close-editor-action
,
.hc-black
.monaco-workbench
.close-editor-d
ecorated
-action
,
.hc-black
.monaco-workbench
.close-editor-d
irty
-action
,
.hc-black
.monaco-workbench
.show-group-editors-action
,
.hc-black
.monaco-workbench
.show-group-editors-overflowing-action
,
.hc-black
.monaco-workbench
.split-editor-action
{
...
...
@@ -242,7 +242,7 @@
width
:
16px
;
}
.hc-black
.monaco-workbench
.close-editor-d
ecorated
-action
:before
{
.hc-black
.monaco-workbench
.close-editor-d
irty
-action
:before
{
content
:
url('close-decorated-inverse.svg')
;
position
:
absolute
;
top
:
12px
;
...
...
@@ -252,7 +252,7 @@
}
.hc-black
.monaco-workbench
.close-editor-action
:before
{
content
:
url('close-
dark
.svg')
;
content
:
url('close-
inverse
.svg')
;
position
:
absolute
;
top
:
12px
;
left
:
8px
;
...
...
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
浏览文件 @
2d07f086
...
...
@@ -1185,8 +1185,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
// Update the input title actions in each position according to the new status
POSITIONS
.
forEach
((
position
)
=>
{
if
(
this
.
visibleEditors
[
position
]
&&
isInputRelated
(
this
.
visibleEditors
[
position
].
input
,
input
))
{
const
status
=
input
.
getStatus
();
this
.
closeEditorActions
[
position
].
class
=
(
status
&&
status
.
decoration
)
?
'
close-editor-decorated-action
'
:
'
close-editor-action
'
;
this
.
closeEditorActions
[
position
].
class
=
input
.
isDirty
()
?
'
close-editor-dirty-action
'
:
'
close-editor-action
'
;
}
});
}
...
...
@@ -1334,8 +1333,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
editorActionsToolbar
[
position
].
setActions
(
primaryActions
,
secondaryActions
)();
// Update title actions accordingly
const
status
=
input
.
getStatus
();
this
.
closeEditorActions
[
position
].
class
=
(
status
&&
status
.
decoration
)
?
'
close-editor-decorated-action
'
:
'
close-editor-action
'
;
this
.
closeEditorActions
[
position
].
class
=
input
.
isDirty
()
?
'
close-editor-dirty-action
'
:
'
close-editor-action
'
;
}
public
setLoading
(
position
:
Position
,
input
:
EditorInput
):
void
{
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
2d07f086
...
...
@@ -14,32 +14,6 @@ import {IEditorInput, IEditorModel, IEditorOptions, IResourceInput} from 'vs/pla
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
/**
* A simple bag for input related status that can be shown in the UI
*/
export
interface
IInputStatus
{
/**
* An identifier of the state that can be used e.g. as CSS class when displaying the input.
*/
state
?:
string
;
/**
* A label to display describing the current input status.
*/
displayText
?:
string
;
/**
* A longer description giving more detail about the current input status.
*/
description
?:
string
;
/**
* Preferably a short label to append to the input name to indicate the input status.
*/
decoration
?:
string
;
}
export
enum
ConfirmResult
{
SAVE
,
DONT_SAVE
,
...
...
@@ -55,7 +29,7 @@ export abstract class EditorInput extends EventEmitter implements IEditorInput {
constructor
()
{
super
();
this
.
disposed
=
false
;
}
...
...
@@ -82,14 +56,6 @@ export abstract class EditorInput extends EventEmitter implements IEditorInput {
return
null
;
}
/**
* Returns status information about this input that can be shown to the user. Examples include showing the status
* of the input when hovering over the name of the input.
*/
public
getStatus
():
IInputStatus
{
return
null
;
}
/**
* Returns the preferred editor for this input. A list of candidate editors is passed in that whee registered
* for the input. This allows subclasses to decide late which editor to use for the input on a case by case basis.
...
...
src/vs/workbench/common/editor/diffEditorInput.ts
浏览文件 @
2d07f086
...
...
@@ -11,7 +11,7 @@ import URI from 'vs/base/common/uri';
import
{
getPathLabel
,
IWorkspaceProvider
}
from
'
vs/base/common/labels
'
;
import
{
isBinaryMime
}
from
'
vs/base/common/mime
'
;
import
{
EventType
}
from
'
vs/base/common/events
'
;
import
{
EditorModel
,
IFileEditorInput
,
EditorInput
,
IInputStatus
,
BaseDiffEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorModel
,
IFileEditorInput
,
EditorInput
,
BaseDiffEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
BaseTextEditorModel
}
from
'
vs/workbench/common/editor/textEditorModel
'
;
import
{
DiffEditorModel
}
from
'
vs/workbench/common/editor/diffEditorModel
'
;
import
{
TextDiffEditorModel
}
from
'
vs/workbench/common/editor/textDiffEditorModel
'
;
...
...
@@ -74,26 +74,6 @@ export class DiffEditorInput extends BaseDiffEditorInput {
return
this
.
description
;
}
public
getStatus
():
IInputStatus
{
if
(
this
.
modifiedInput
)
{
let
modifiedStatus
=
this
.
modifiedInput
.
getStatus
();
if
(
modifiedStatus
)
{
return
modifiedStatus
;
}
}
if
(
this
.
originalInput
)
{
let
originalStatus
=
this
.
originalInput
.
getStatus
();
if
(
originalStatus
)
{
return
originalStatus
;
}
}
return
super
.
getStatus
();
}
public
setOriginalInput
(
input
:
EditorInput
):
void
{
this
.
originalInput
=
input
;
}
...
...
src/vs/workbench/common/editor/untitledEditorInput.ts
浏览文件 @
2d07f086
...
...
@@ -9,7 +9,7 @@ import URI from 'vs/base/common/uri';
import
{
isUnspecific
,
guessMimeTypes
,
MIME_TEXT
,
suggestFilename
}
from
'
vs/base/common/mime
'
;
import
labels
=
require
(
'
vs/base/common/labels
'
);
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
UntitledEditorInput
as
AbstractUntitledEditorInput
,
EditorModel
,
EncodingMode
,
IInputStatus
,
ConfirmResult
}
from
'
vs/workbench/common/editor
'
;
import
{
UntitledEditorInput
as
AbstractUntitledEditorInput
,
EditorModel
,
EncodingMode
,
ConfirmResult
}
from
'
vs/workbench/common/editor
'
;
import
{
UntitledEditorModel
}
from
'
vs/workbench/common/editor/untitledEditorModel
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
...
...
@@ -68,15 +68,6 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
return
this
.
cachedModel
&&
this
.
cachedModel
.
isDirty
();
}
public
getStatus
():
IInputStatus
{
let
isDirty
=
this
.
isDirty
();
if
(
isDirty
)
{
return
{
state
:
'
dirty
'
,
decoration
:
'
\
u25cf
'
};
}
return
null
;
}
public
confirmSave
():
ConfirmResult
{
return
this
.
textFileService
.
confirmSave
([
this
.
resource
]);
}
...
...
src/vs/workbench/parts/files/browser/editors/fileEditorInput.ts
浏览文件 @
2d07f086
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
types
=
require
(
'
vs/base/common/types
'
);
...
...
@@ -14,13 +13,13 @@ import labels = require('vs/base/common/labels');
import
URI
from
'
vs/base/common/uri
'
;
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
assert
=
require
(
'
vs/base/common/assert
'
);
import
{
EditorModel
,
IInputStatus
,
EncodingMode
,
ConfirmResult
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorModel
,
EncodingMode
,
ConfirmResult
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorRegistry
,
Extensions
,
EditorDescriptor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
BinaryEditorModel
}
from
'
vs/workbench/common/editor/binaryEditorModel
'
;
import
{
IFileOperationResult
,
FileOperationResult
}
from
'
vs/platform/files/common/files
'
;
import
{
FileEditorDescriptor
}
from
'
vs/workbench/parts/files/browser/files
'
;
import
{
ITextFileService
,
BINARY_FILE_EDITOR_ID
,
FILE_EDITOR_INPUT_ID
,
FileEditorInput
as
CommonFileEditorInput
,
AutoSaveMode
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
CACHE
,
TextFileEditorModel
,
State
}
from
'
vs/workbench/parts/files/common/editors/textFileEditorModel
'
;
import
{
ITextFileService
,
BINARY_FILE_EDITOR_ID
,
FILE_EDITOR_INPUT_ID
,
FileEditorInput
as
CommonFileEditorInput
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
CACHE
,
TextFileEditorModel
}
from
'
vs/workbench/parts/files/common/editors/textFileEditorModel
'
;
import
{
IWorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -35,18 +34,6 @@ export class FileEditorInput extends CommonFileEditorInput {
// Keep promises that load a file editor model to avoid loading the same model twice
private
static
FILE_EDITOR_MODEL_LOADERS
:
{
[
resource
:
string
]:
TPromise
<
EditorModel
>
;
}
=
Object
.
create
(
null
);
// These nls things are looked up way too often to not cache them..
private
static
nlsSavedDisplay
=
nls
.
localize
(
'
savedDisplay
'
,
"
Saved
"
);
private
static
nlsSavedMeta
=
nls
.
localize
(
'
savedMeta
'
,
"
All changes saved
"
);
private
static
nlsDirtyDisplay
=
nls
.
localize
(
'
dirtyDisplay
'
,
"
Dirty
"
);
private
static
nlsDirtyMeta
=
nls
.
localize
(
'
dirtyMeta
'
,
"
Changes have been made to the file...
"
);
private
static
nlsPendingSaveDisplay
=
nls
.
localize
(
'
savingDisplay
'
,
"
Saving...
"
);
private
static
nlsPendingSaveMeta
=
nls
.
localize
(
'
pendingSaveMeeta
'
,
"
Changes are currently being saved...
"
);
private
static
nlsErrorDisplay
=
nls
.
localize
(
'
saveErorDisplay
'
,
"
Save error
"
);
private
static
nlsErrorMeta
=
nls
.
localize
(
'
saveErrorMeta
'
,
"
Sorry, we are having trouble saving your changes
"
);
private
static
nlsConflictDisplay
=
nls
.
localize
(
'
saveConflictDisplay
'
,
"
Conflict
"
);
private
static
nlsConflictMeta
=
nls
.
localize
(
'
saveConflictMeta
'
,
"
Changes cannot be saved because they conflict with the version on disk
"
);
private
resource
:
URI
;
private
mime
:
string
;
private
preferredEncoding
:
string
;
...
...
@@ -148,33 +135,6 @@ export class FileEditorInput extends CommonFileEditorInput {
return
this
.
verboseDescription
;
}
public
getStatus
():
IInputStatus
{
let
textModel
=
CACHE
.
get
(
this
.
resource
);
if
(
textModel
)
{
let
state
=
textModel
.
getState
();
switch
(
state
)
{
case
State
.
SAVED
:
{
return
{
state
:
'
saved
'
,
displayText
:
FileEditorInput
.
nlsSavedDisplay
,
description
:
FileEditorInput
.
nlsSavedMeta
};
}
case
State
.
DIRTY
:
{
return
{
state
:
'
dirty
'
,
decoration
:
(
this
.
textFileService
.
getAutoSaveMode
()
!==
AutoSaveMode
.
AFTER_SHORT_DELAY
)
?
'
\
u25cf
'
:
''
,
displayText
:
FileEditorInput
.
nlsDirtyDisplay
,
description
:
FileEditorInput
.
nlsDirtyMeta
};
}
case
State
.
PENDING_SAVE
:
return
{
state
:
'
saving
'
,
decoration
:
(
this
.
textFileService
.
getAutoSaveMode
()
!==
AutoSaveMode
.
AFTER_SHORT_DELAY
)
?
'
\
u25cf
'
:
''
,
displayText
:
FileEditorInput
.
nlsPendingSaveDisplay
,
description
:
FileEditorInput
.
nlsPendingSaveMeta
};
case
State
.
ERROR
:
return
{
state
:
'
error
'
,
decoration
:
'
\
u25cf
'
,
displayText
:
FileEditorInput
.
nlsErrorDisplay
,
description
:
FileEditorInput
.
nlsErrorMeta
};
case
State
.
CONFLICT
:
return
{
state
:
'
conflict
'
,
decoration
:
'
\
u25cf
'
,
displayText
:
FileEditorInput
.
nlsConflictDisplay
,
description
:
FileEditorInput
.
nlsConflictMeta
};
}
}
return
null
;
}
public
isDirty
():
boolean
{
return
this
.
textFileService
.
isDirty
(
this
.
resource
);
}
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
2d07f086
...
...
@@ -166,9 +166,8 @@ export abstract class BaseHistoryService {
let
prefix
=
input
&&
input
.
getName
();
if
(
prefix
&&
input
)
{
let
status
=
(
<
EditorInput
>
input
).
getStatus
();
if
(
status
&&
status
.
decoration
&&
!
platform
.
isMacintosh
/* Mac has its own decoration in window */
)
{
prefix
=
nls
.
localize
(
'
prefixDecoration
'
,
"
{0} {1}
"
,
status
.
decoration
,
prefix
);
if
((
<
EditorInput
>
input
).
isDirty
()
&&
!
platform
.
isMacintosh
/* Mac has its own decoration in window */
)
{
prefix
=
nls
.
localize
(
'
prefixDecoration
'
,
"
\
u25cf {0}
"
,
prefix
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录