Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8bb9ce0c
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,发现更多精彩内容 >>
提交
8bb9ce0c
编写于
5月 18, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - some cleanup
上级
d2baa66b
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
42 addition
and
56 deletion
+42
-56
src/vs/editor/browser/services/codeEditorService.ts
src/vs/editor/browser/services/codeEditorService.ts
+7
-10
src/vs/workbench/browser/composite.ts
src/vs/workbench/browser/composite.ts
+2
-3
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+5
-10
src/vs/workbench/browser/parts/editor/textEditor.ts
src/vs/workbench/browser/parts/editor/textEditor.ts
+5
-9
src/vs/workbench/common/composite.ts
src/vs/workbench/common/composite.ts
+6
-2
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+2
-1
src/vs/workbench/parts/debug/browser/debugCommands.ts
src/vs/workbench/parts/debug/browser/debugCommands.ts
+5
-8
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
...parts/debug/electron-browser/debugConfigurationManager.ts
+10
-13
未找到文件。
src/vs/editor/browser/services/codeEditorService.ts
浏览文件 @
8bb9ce0c
...
...
@@ -48,9 +48,14 @@ export interface ICodeEditorService {
}
/**
* Uses `editor.getControl()` and returns either
a `codeEditor` or a `diffEditor`
or nothing.
* Uses `editor.getControl()` and returns either
the code editor, or the modified editor of a diff editor
or nothing.
*/
export
function
getCodeOrDiffEditor
(
editor
:
{
getControl
:
()
=>
any
}):
{
codeEditor
:
ICodeEditor
;
diffEditor
:
IDiffEditor
}
{
export
function
getCodeEditor
(
editor
:
{
getControl
:
()
=>
any
}):
ICodeEditor
{
let
r
=
getCodeOrDiffEditor
(
editor
);
return
r
.
codeEditor
||
(
r
.
diffEditor
&&
<
ICodeEditor
>
r
.
diffEditor
.
getModifiedEditor
())
||
null
;
}
function
getCodeOrDiffEditor
(
editor
:
{
getControl
:
()
=>
any
}):
{
codeEditor
:
ICodeEditor
;
diffEditor
:
IDiffEditor
}
{
if
(
editor
)
{
let
control
=
editor
.
getControl
();
if
(
control
)
{
...
...
@@ -74,11 +79,3 @@ export function getCodeOrDiffEditor(editor: { getControl: () => any }): { codeEd
diffEditor
:
null
};
}
/**
* Uses `editor.getControl()` and returns either the code editor, or the modified editor of a diff editor or nothing.
*/
export
function
getCodeEditor
(
editor
:
{
getControl
:
()
=>
any
}):
ICodeEditor
{
let
r
=
getCodeOrDiffEditor
(
editor
);
return
r
.
codeEditor
||
(
r
.
diffEditor
&&
<
ICodeEditor
>
r
.
diffEditor
.
getModifiedEditor
())
||
null
;
}
src/vs/workbench/browser/composite.ts
浏览文件 @
8bb9ce0c
...
...
@@ -8,8 +8,7 @@ import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
import
{
IActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
Component
}
from
'
vs/workbench/common/component
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IComposite
}
from
'
vs/workbench/common/composite
'
;
import
{
IEditorControl
}
from
'
vs/workbench/common/editor
'
;
import
{
IComposite
,
ICompositeControl
}
from
'
vs/workbench/common/composite
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IConstructorSignature0
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -193,7 +192,7 @@ export abstract class Composite extends Component implements IComposite {
/**
* Returns the underlying composite control or null if it is not accessible.
*/
public
getControl
():
I
Editor
Control
{
public
getControl
():
I
Composite
Control
{
return
null
;
}
...
...
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
8bb9ce0c
...
...
@@ -35,7 +35,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
getCodeOrDiffEditor
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
once
}
from
'
vs/base/common/event
'
;
import
{
DelegatingWorkbenchEditorService
}
from
'
vs/workbench/services/editor/browser/nextEditorService
'
;
import
{
INextEditorGroup
,
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
...
...
@@ -150,7 +149,7 @@ export class TextDiffEditor extends BaseTextEditor {
}
// Set Editor Model
const
diffEditor
=
<
IDiffEditor
>
this
.
getControl
();
const
diffEditor
=
this
.
getControl
();
diffEditor
.
setModel
((
<
TextDiffEditorModel
>
resolvedModel
).
textDiffEditorModel
);
// Apply Options from TextOptions
...
...
@@ -192,7 +191,7 @@ export class TextDiffEditor extends BaseTextEditor {
public
setOptions
(
options
:
EditorOptions
):
void
{
const
textOptions
=
<
TextEditorOptions
>
options
;
if
(
textOptions
&&
types
.
isFunction
(
textOptions
.
apply
))
{
textOptions
.
apply
(
<
IDiffEditor
>
this
.
getControl
(),
ScrollType
.
Smooth
);
textOptions
.
apply
(
this
.
getControl
(),
ScrollType
.
Smooth
);
}
}
...
...
@@ -367,12 +366,8 @@ export class TextDiffEditor extends BaseTextEditor {
}
private
retrieveTextDiffEditorViewState
(
resource
:
URI
):
IDiffEditorViewState
{
const
editor
=
getCodeOrDiffEditor
(
this
).
diffEditor
;
if
(
!
editor
)
{
return
null
;
// not supported for non-diff editors
}
const
model
=
editor
.
getModel
();
const
control
=
this
.
getControl
();
const
model
=
control
.
getModel
();
if
(
!
model
||
!
model
.
modified
||
!
model
.
original
)
{
return
null
;
// view state always needs a model
}
...
...
@@ -386,7 +381,7 @@ export class TextDiffEditor extends BaseTextEditor {
return
null
;
// prevent saving view state for a model that is not the expected one
}
return
editor
.
saveViewState
();
return
control
.
saveViewState
();
}
private
toDiffEditorViewStateResource
(
modelOrInput
:
IDiffEditorModel
|
DiffEditorInput
):
URI
{
...
...
src/vs/workbench/browser/parts/editor/textEditor.ts
浏览文件 @
8bb9ce0c
...
...
@@ -20,11 +20,11 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Scope
}
from
'
vs/workbench/common/memento
'
;
import
{
getCodeEditor
,
getCodeOrDiffEditor
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
getCodeEditor
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
ITextFileService
,
SaveReason
,
AutoSaveMode
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ITextResourceConfigurationService
}
from
'
vs/editor/common/services/resourceConfiguration
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
isDiffEditor
,
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
isDiffEditor
,
isCodeEditor
,
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
INextEditorGroupsService
,
INextEditorGroup
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
...
...
@@ -238,12 +238,8 @@ export abstract class BaseTextEditor extends BaseEditor {
}
protected
retrieveTextEditorViewState
(
resource
:
URI
):
IEditorViewState
{
const
editor
=
getCodeOrDiffEditor
(
this
).
codeEditor
;
if
(
!
editor
)
{
return
null
;
// not supported for diff editors
}
const
model
=
editor
.
getModel
();
const
control
=
this
.
getControl
()
as
ICodeEditor
;
const
model
=
control
.
getModel
();
if
(
!
model
)
{
return
null
;
// view state always needs a model
}
...
...
@@ -257,7 +253,7 @@ export abstract class BaseTextEditor extends BaseEditor {
return
null
;
// prevent saving view state for a model that is not the expected one
}
return
editor
.
saveViewState
();
return
control
.
saveViewState
();
}
/**
...
...
src/vs/workbench/common/composite.ts
浏览文件 @
8bb9ce0c
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
{
IAction
,
IActionItem
}
from
'
vs/base/common/actions
'
;
import
{
IEditorControl
}
from
'
vs/workbench/common/editor
'
;
export
interface
IComposite
{
...
...
@@ -41,10 +40,15 @@ export interface IComposite {
/**
* Returns the underlying control of this composite.
*/
getControl
():
I
Editor
Control
;
getControl
():
I
Composite
Control
;
/**
* Asks the underlying control to focus.
*/
focus
():
void
;
}
/**
* Marker interface for the composite control
*/
export
interface
ICompositeControl
{
}
src/vs/workbench/common/editor.ts
浏览文件 @
8bb9ce0c
...
...
@@ -19,6 +19,7 @@ import { ITextModel } from 'vs/editor/common/model';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
LRUCache
}
from
'
vs/base/common/map
'
;
import
{
INextEditorGroupsService
,
INextEditorGroup
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
ICompositeControl
}
from
'
vs/workbench/common/composite
'
;
export
const
EditorsVisibleContext
=
new
RawContextKey
<
boolean
>
(
'
editorIsOpen
'
,
false
);
export
const
NoEditorsVisibleContext
:
ContextKeyExpr
=
EditorsVisibleContext
.
toNegated
();
...
...
@@ -79,7 +80,7 @@ export interface IEditor {
/**
* Marker interface for the editor control
*/
export
interface
IEditorControl
{
}
export
interface
IEditorControl
extends
ICompositeControl
{
}
export
interface
IFileInputFactory
{
...
...
src/vs/workbench/parts/debug/browser/debugCommands.ts
浏览文件 @
8bb9ce0c
...
...
@@ -15,7 +15,7 @@ import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_
import
{
Expression
,
Variable
,
Breakpoint
,
FunctionBreakpoint
}
from
'
vs/workbench/parts/debug/common/debugModel
'
;
import
{
IExtensionsViewlet
,
VIEWLET_ID
as
EXTENSIONS_VIEWLET_ID
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
,
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
...
...
@@ -54,10 +54,8 @@ export function registerCommands(): void {
handler
:
(
accessor
)
=>
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
editorService
=
accessor
.
get
(
INextEditorService
);
const
editor
=
editorService
.
activeControl
;
const
control
=
<
ICodeEditor
>
editor
.
getControl
();
if
(
control
)
{
const
control
=
editorService
.
activeTextEditorControl
;
if
(
isCodeEditor
(
control
))
{
const
model
=
control
.
getModel
();
if
(
model
)
{
const
position
=
control
.
getPosition
();
...
...
@@ -203,9 +201,8 @@ export function registerCommands(): void {
const
inlineBreakpointHandler
=
(
accessor
:
ServicesAccessor
)
=>
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
editorService
=
accessor
.
get
(
INextEditorService
);
const
editor
=
editorService
.
activeControl
;
const
control
=
editor
&&
<
ICodeEditor
>
editor
.
getControl
();
if
(
control
)
{
const
control
=
editorService
.
activeTextEditorControl
;
if
(
isCodeEditor
(
control
))
{
const
position
=
control
.
getPosition
();
const
modelUri
=
control
.
getModel
().
uri
;
const
bp
=
debugService
.
getModel
().
getBreakpoints
({
lineNumber
:
position
.
lineNumber
,
uri
:
modelUri
})
...
...
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
浏览文件 @
8bb9ce0c
...
...
@@ -328,10 +328,8 @@ export class ConfigurationManager implements IConfigurationManager {
return
TPromise
.
as
(
adapter
);
}
const
editor
=
this
.
editorService
.
active
Control
;
const
codeEditor
=
this
.
editorService
.
activeTextEditor
Control
;
let
candidates
:
Debugger
[];
if
(
editor
)
{
const
codeEditor
=
editor
.
getControl
();
if
(
isCodeEditor
(
codeEditor
))
{
const
model
=
codeEditor
.
getModel
();
const
language
=
model
?
model
.
getLanguageIdentifier
().
language
:
undefined
;
...
...
@@ -343,7 +341,6 @@ export class ConfigurationManager implements IConfigurationManager {
candidates
=
adapters
;
}
}
}
if
(
!
candidates
)
{
candidates
=
this
.
debuggers
.
filter
(
a
=>
a
.
hasInitialConfiguration
()
||
a
.
hasConfigurationProvider
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录