Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
6d8cbf85
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,发现更多精彩内容 >>
提交
6d8cbf85
编写于
10月 04, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #8826
上级
1d080314
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
41 addition
and
42 deletion
+41
-42
src/vs/platform/editor/common/editor.ts
src/vs/platform/editor/common/editor.ts
+8
-0
src/vs/workbench/browser/parts/editor/textEditor.ts
src/vs/workbench/browser/parts/editor/textEditor.ts
+2
-2
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+2
-2
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+8
-18
src/vs/workbench/common/editor/editorStacksModel.ts
src/vs/workbench/common/editor/editorStacksModel.ts
+1
-1
src/vs/workbench/common/editor/rangeDecorations.ts
src/vs/workbench/common/editor/rangeDecorations.ts
+2
-2
src/vs/workbench/parts/files/browser/fileActions.ts
src/vs/workbench/parts/files/browser/fileActions.ts
+3
-2
src/vs/workbench/parts/files/common/editors/fileEditorTracker.ts
...workbench/parts/files/common/editors/fileEditorTracker.ts
+2
-2
src/vs/workbench/parts/markers/browser/markersPanel.ts
src/vs/workbench/parts/markers/browser/markersPanel.ts
+2
-2
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+5
-5
src/vs/workbench/parts/search/browser/searchActions.ts
src/vs/workbench/parts/search/browser/searchActions.ts
+2
-2
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+4
-4
未找到文件。
src/vs/platform/editor/common/editor.ts
浏览文件 @
6d8cbf85
...
...
@@ -194,8 +194,16 @@ export enum Verbosity {
export
interface
IEditorInput
extends
IDisposable
{
/**
* Triggered when this input is disposed.
*/
onDispose
:
Event
<
void
>
;
/**
* Returns the associated resource of this input.
*/
getResource
():
URI
;
/**
* Returns the display name of this input.
*/
...
...
src/vs/workbench/browser/parts/editor/textEditor.ts
浏览文件 @
6d8cbf85
...
...
@@ -14,7 +14,7 @@ import types = require('vs/base/common/types');
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
{
CodeEditor
}
from
'
vs/editor/browser/codeEditor
'
;
import
{
EditorInput
,
EditorOptions
,
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorInput
,
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
IEditorViewState
,
IEditor
,
isCommonCodeEditor
,
isCommonDiffEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/platform/editor/common/editor
'
;
...
...
@@ -318,7 +318,7 @@ export abstract class BaseTextEditor extends BaseEditor {
}
if
(
this
.
input
)
{
return
t
oResource
(
this
.
input
);
return
t
his
.
input
.
getResource
(
);
}
return
null
;
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
6d8cbf85
...
...
@@ -31,7 +31,7 @@ import { IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor';
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
getIconClasses
}
from
'
vs/workbench/browser/labels
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
EditorInput
,
toResource
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorInput
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
Component
}
from
'
vs/workbench/common/component
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
...
...
@@ -1332,7 +1332,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
}
function
resourceForEditorHistory
(
input
:
EditorInput
,
fileService
:
IFileService
):
URI
{
const
resource
=
toResource
(
input
)
;
const
resource
=
input
?
input
.
getResource
()
:
void
0
;
// For the editor history we only prefer resources that are either untitled or
// can be handled by the file service which indicates they are editable resources.
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
6d8cbf85
...
...
@@ -124,6 +124,13 @@ export abstract class EditorInput implements IEditorInput {
return
this
.
_onDispose
.
event
;
}
/**
* Returns the associated resource of this input if any.
*/
public
getResource
():
URI
{
return
null
;
}
/**
* 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.
...
...
@@ -285,11 +292,6 @@ export interface IEncodingSupport {
*/
export
interface
IFileEditorInput
extends
IEditorInput
,
IEncodingSupport
{
/**
* Gets the absolute file resource URI this input is about.
*/
getResource
():
URI
;
/**
* Sets the preferred encodingt to use for this input.
*/
...
...
@@ -829,7 +831,7 @@ export function toResource(editor: IEditorInput, options?: IResourceOptions): UR
editor
=
editor
.
master
;
}
const
resource
=
doGetEditorResource
(
editor
);
const
resource
=
editor
.
getResource
(
);
if
(
!
options
||
!
options
.
filter
)
{
return
resource
;
// return early if no filter is specified
}
...
...
@@ -859,18 +861,6 @@ export function toResource(editor: IEditorInput, options?: IResourceOptions): UR
return
null
;
}
// TODO@Ben every editor should have an associated resource
function
doGetEditorResource
(
editor
:
IEditorInput
):
URI
{
if
(
editor
instanceof
EditorInput
&&
typeof
(
<
any
>
editor
).
getResource
===
'
function
'
)
{
const
candidate
=
(
<
any
>
editor
).
getResource
();
if
(
candidate
instanceof
URI
)
{
return
candidate
;
}
}
return
null
;
}
class
EditorInputFactoryRegistry
implements
IEditorInputFactoryRegistry
{
private
instantiationService
:
IInstantiationService
;
private
fileInputFactory
:
IFileInputFactory
;
...
...
src/vs/workbench/common/editor/editorStacksModel.ts
浏览文件 @
6d8cbf85
...
...
@@ -1215,7 +1215,7 @@ export class EditorStacksModel implements IEditorStacksModel {
// Close the editor when it is no longer open in any group including diff editors
editorsToClose
.
forEach
(
editorToClose
=>
{
const
resource
=
toResource
(
editorToClose
)
;
// prefer resource to not close right-hand side editors of a diff editor
const
resource
=
editorToClose
?
editorToClose
.
getResource
()
:
void
0
;
// prefer resource to not close right-hand side editors of a diff editor
if
(
!
this
.
isOpen
(
resource
||
editorToClose
))
{
editorToClose
.
close
();
}
...
...
src/vs/workbench/common/editor/rangeDecorations.ts
浏览文件 @
6d8cbf85
...
...
@@ -8,7 +8,6 @@ import URI from 'vs/base/common/uri';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
CursorChangeReason
,
ICursorPositionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
import
{
ModelDecorationOptions
}
from
'
vs/editor/common/model/textModelWithDecorations
'
;
...
...
@@ -55,7 +54,8 @@ export class RangeHighlightDecorations implements IDisposable {
}
private
getEditor
(
resourceRange
:
IRangeHighlightDecoration
):
editorCommon
.
ICommonCodeEditor
{
const
resource
=
toResource
(
this
.
editorService
.
getActiveEditorInput
());
const
activeInput
=
this
.
editorService
.
getActiveEditorInput
();
const
resource
=
activeInput
&&
activeInput
.
getResource
();
if
(
resource
)
{
if
(
resource
.
toString
()
===
resourceRange
.
resource
.
toString
())
{
return
<
editorCommon
.
ICommonCodeEditor
>
this
.
editorService
.
getActiveEditor
().
getControl
();
...
...
src/vs/workbench/parts/files/browser/fileActions.ts
浏览文件 @
6d8cbf85
...
...
@@ -1177,7 +1177,8 @@ export class GlobalCompareResourcesAction extends Action {
}
public
run
():
TPromise
<
any
>
{
const
activeResource
=
toResource
(
this
.
editorService
.
getActiveEditorInput
());
const
activeInput
=
this
.
editorService
.
getActiveEditorInput
();
const
activeResource
=
activeInput
?
activeInput
.
getResource
()
:
void
0
;
if
(
activeResource
)
{
// Keep as resource to compare
...
...
@@ -1195,7 +1196,7 @@ export class GlobalCompareResourcesAction extends Action {
let
description
:
string
;
if
(
input
instanceof
EditorInput
)
{
resource
=
toResource
(
input
);
resource
=
input
.
getResource
(
);
}
else
{
resource
=
(
input
as
IResourceInput
).
resource
;
}
...
...
src/vs/workbench/parts/files/common/editors/fileEditorTracker.ts
浏览文件 @
6d8cbf85
...
...
@@ -240,8 +240,8 @@ export class FileEditorTracker implements IWorkbenchContribution {
for
(
let
i
=
0
;
i
<
editors
.
length
;
i
++
)
{
const
editor
=
editors
[
i
];
if
(
editor
&&
editor
.
position
===
stacks
.
positionOfGroup
(
group
))
{
const
editorResource
=
toResource
(
editor
.
input
);
if
(
editor
&&
editor
.
input
&&
editor
.
position
===
stacks
.
positionOfGroup
(
group
))
{
const
editorResource
=
editor
.
input
.
getResource
(
);
if
(
editorResource
&&
resource
.
toString
()
===
editorResource
.
toString
())
{
const
control
=
editor
.
getControl
();
if
(
isCommonCodeEditor
(
control
))
{
...
...
src/vs/workbench/parts/markers/browser/markersPanel.ts
浏览文件 @
6d8cbf85
...
...
@@ -16,7 +16,6 @@ import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
Panel
}
from
'
vs/workbench/browser/panel
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
Constants
from
'
vs/workbench/parts/markers/common/constants
'
;
...
...
@@ -285,7 +284,8 @@ export class MarkersPanel extends Panel {
}
private
onEditorsChanged
():
void
{
this
.
currentActiveResource
=
toResource
(
this
.
editorService
.
getActiveEditorInput
());
const
activeInput
=
this
.
editorService
.
getActiveEditorInput
();
this
.
currentActiveResource
=
activeInput
?
activeInput
.
getResource
()
:
void
0
;
this
.
autoReveal
();
}
...
...
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
6d8cbf85
...
...
@@ -12,7 +12,7 @@ import { Dimension, Builder } from 'vs/base/browser/builder';
import
{
ArrayNavigator
,
INavigator
}
from
'
vs/base/common/iterator
'
;
import
{
Disposable
,
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
toResource
,
SideBySideEditorInput
,
EditorOptions
,
EditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
SideBySideEditorInput
,
EditorOptions
,
EditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
ResourceEditorModel
}
from
'
vs/workbench/common/editor/resourceEditorModel
'
;
import
{
IEditorControl
,
Position
,
Verbosity
}
from
'
vs/platform/editor/common/editor
'
;
...
...
@@ -226,7 +226,7 @@ export class PreferencesEditor extends BaseEditor {
}
private
updateInput
(
oldInput
:
PreferencesEditorInput
,
newInput
:
PreferencesEditorInput
,
options
?:
EditorOptions
):
TPromise
<
void
>
{
const
resource
=
toResource
(
newInput
.
master
);
const
resource
=
newInput
.
master
.
getResource
(
);
this
.
settingsTargetsWidget
.
updateTargets
(
this
.
getSettingsConfigurationTargetUri
(
resource
),
this
.
getSettingsConfigurationTarget
(
resource
));
return
this
.
sideBySidePreferencesWidget
.
setInput
(
<
DefaultPreferencesEditorInput
>
newInput
.
details
,
<
EditorInput
>
newInput
.
master
,
options
).
then
(({
defaultPreferencesRenderer
,
editablePreferencesRenderer
})
=>
{
...
...
@@ -267,7 +267,7 @@ export class PreferencesEditor extends BaseEditor {
private
onWorkspaceFoldersChanged
():
void
{
if
(
this
.
input
)
{
const
settingsResource
=
toResource
((
<
PreferencesEditorInput
>
this
.
input
).
master
);
const
settingsResource
=
(
<
PreferencesEditorInput
>
this
.
input
).
master
.
getResource
(
);
const
targetResource
=
this
.
getSettingsConfigurationTargetUri
(
settingsResource
);
if
(
!
targetResource
)
{
this
.
switchSettings
(
this
.
preferencesService
.
userSettingsResource
);
...
...
@@ -277,7 +277,7 @@ export class PreferencesEditor extends BaseEditor {
private
onWorkbenchStateChanged
():
void
{
if
(
this
.
input
)
{
const
editableSettingsResource
=
toResource
((
<
PreferencesEditorInput
>
this
.
input
).
master
);
const
editableSettingsResource
=
(
<
PreferencesEditorInput
>
this
.
input
).
master
.
getResource
(
);
const
newConfigurationTarget
=
this
.
getSettingsConfigurationTarget
(
editableSettingsResource
);
if
(
newConfigurationTarget
)
{
if
(
newConfigurationTarget
!==
this
.
settingsTargetsWidget
.
configurationTarget
)
{
...
...
@@ -528,7 +528,7 @@ class SideBySidePreferencesWidget extends Widget {
public
setInput
(
defaultPreferencesEditorInput
:
DefaultPreferencesEditorInput
,
editablePreferencesEditorInput
:
EditorInput
,
options
?:
EditorOptions
):
TPromise
<
{
defaultPreferencesRenderer
:
IPreferencesRenderer
<
ISetting
>
,
editablePreferencesRenderer
:
IPreferencesRenderer
<
ISetting
>
}
>
{
this
.
getOrCreateEditablePreferencesEditor
(
editablePreferencesEditorInput
);
this
.
dolayout
(
this
.
sash
.
getVerticalSashLeft
());
return
TPromise
.
join
([
this
.
updateInput
(
this
.
defaultPreferencesEditor
,
defaultPreferencesEditorInput
,
DefaultSettingsEditorContribution
.
ID
,
toResource
(
editablePreferencesEditorInput
),
options
),
return
TPromise
.
join
([
this
.
updateInput
(
this
.
defaultPreferencesEditor
,
defaultPreferencesEditorInput
,
DefaultSettingsEditorContribution
.
ID
,
editablePreferencesEditorInput
.
getResource
(
),
options
),
this
.
updateInput
(
this
.
editablePreferencesEditor
,
editablePreferencesEditorInput
,
SettingsEditorContribution
.
ID
,
defaultPreferencesEditorInput
.
getResource
(),
options
)])
.
then
(([
defaultPreferencesRenderer
,
editablePreferencesRenderer
])
=>
({
defaultPreferencesRenderer
,
editablePreferencesRenderer
}));
}
...
...
src/vs/workbench/parts/search/browser/searchActions.ts
浏览文件 @
6d8cbf85
...
...
@@ -23,7 +23,6 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ResolvedKeybinding
,
createKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
explorerItemToFileResource
}
from
'
vs/workbench/parts/files/common/files
'
;
...
...
@@ -639,7 +638,8 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction {
}
private
hasToOpenFile
():
boolean
{
const
file
=
toResource
(
this
.
editorService
.
getActiveEditorInput
());
const
activeInput
=
this
.
editorService
.
getActiveEditorInput
();
const
file
=
activeInput
?
activeInput
.
getResource
()
:
void
0
;
if
(
file
)
{
return
file
.
toString
()
===
this
.
element
.
parent
().
resource
().
toString
();
}
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
6d8cbf85
...
...
@@ -10,7 +10,7 @@ import errors = require('vs/base/common/errors');
import
URI
from
'
vs/base/common/uri
'
;
import
{
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
as
IBaseEditor
,
IEditorInput
,
ITextEditorOptions
,
IResourceInput
,
ITextEditorSelection
,
Position
as
GroupPosition
}
from
'
vs/platform/editor/common/editor
'
;
import
{
Extensions
as
EditorExtensions
,
EditorInput
,
IEditorCloseEvent
,
toResource
,
IEditorGroup
,
IEditorInputFactoryRegistry
}
from
'
vs/workbench/common/editor
'
;
import
{
Extensions
as
EditorExtensions
,
EditorInput
,
IEditorCloseEvent
,
IEditorGroup
,
IEditorInputFactoryRegistry
}
from
'
vs/workbench/common/editor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
FileChangesEvent
,
IFileService
,
FileChangeType
}
from
'
vs/platform/files/common/files
'
;
...
...
@@ -245,7 +245,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
// Track closing of pinned editor to support to reopen closed editors
if
(
event
.
pinned
)
{
const
resource
=
toResource
(
event
.
editor
)
;
const
resource
=
event
.
editor
?
event
.
editor
.
getResource
()
:
void
0
;
const
supportsReopen
=
resource
&&
this
.
fileService
.
canHandleResource
(
resource
);
// we only support file'ish things to reopen
if
(
supportsReopen
)
{
...
...
@@ -592,7 +592,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
private
preferResourceInput
(
input
:
IEditorInput
):
IEditorInput
|
IResourceInput
{
const
resource
=
toResource
(
input
)
;
const
resource
=
input
?
input
.
getResource
()
:
void
0
;
const
preferResourceInput
=
resource
&&
this
.
fileService
.
canHandleResource
(
resource
);
// file'ish things prefer resources
if
(
preferResourceInput
)
{
return
{
resource
};
...
...
@@ -680,7 +680,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
if
(
arg2
instanceof
EditorInput
)
{
const
inputResource
=
toResource
(
arg2
);
const
inputResource
=
arg2
.
getResource
(
);
return
inputResource
&&
this
.
fileService
.
canHandleResource
(
inputResource
)
&&
inputResource
.
toString
()
===
resource
.
toString
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录