Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c03d38e1
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
c03d38e1
编写于
11月 27, 2015
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: show breakpoint context menu on right click in editor margin.
上级
89295e16
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
44 addition
and
3 deletion
+44
-3
src/vs/workbench/parts/debug/browser/debugEditorContribution.ts
.../workbench/parts/debug/browser/debugEditorContribution.ts
+44
-3
未找到文件。
src/vs/workbench/parts/debug/browser/debugEditorContribution.ts
浏览文件 @
c03d38e1
...
...
@@ -3,15 +3,22 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
nls
=
require
(
'
vs/nls
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
env
=
require
(
'
vs/base/common/platform
'
);
import
uri
from
'
vs/base/common/uri
'
;
import
{
IAction
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
keyboard
=
require
(
'
vs/base/browser/keyboardEvent
'
);
import
editorbrowser
=
require
(
'
vs/editor/browser/editorBrowser
'
);
import
editorcommon
=
require
(
'
vs/editor/common/editorCommon
'
);
import
{
DebugHoverWidget
}
from
'
vs/workbench/parts/debug/browser/debugHoverWidget
'
;
import
debugactions
=
require
(
'
vs/workbench/parts/debug/browser/debugActions
'
);
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
import
{
IWorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
export
class
DebugEditorContribution
implements
editorcommon
.
IEditorContribution
{
...
...
@@ -24,7 +31,9 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution
constructor
(
private
editor
:
editorbrowser
.
ICodeEditor
,
@
debug
.
IDebugService
private
debugService
:
debug
.
IDebugService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
this
.
breakpointHintDecoration
=
[];
this
.
toDispose
=
[];
...
...
@@ -32,6 +41,24 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution
this
.
registerListeners
();
}
private
getContextMenuActions
(
breakpoint
:
debug
.
IBreakpoint
,
uri
:
uri
,
lineNumber
:
number
):
TPromise
<
IAction
[]
>
{
const
actions
=
[];
if
(
breakpoint
)
{
actions
.
push
(
this
.
instantiationService
.
createInstance
(
debugactions
.
RemoveBreakpointAction
,
debugactions
.
RemoveBreakpointAction
.
ID
,
debugactions
.
RemoveBreakpointAction
.
LABEL
));
actions
.
push
(
this
.
instantiationService
.
createInstance
(
debugactions
.
ToggleEnablementAction
,
debugactions
.
ToggleEnablementAction
.
ID
,
debugactions
.
ToggleEnablementAction
.
LABEL
));
}
else
{
actions
.
push
(
new
Action
(
'
addBreakpoint
'
,
nls
.
localize
(
'
addBreakpoint
'
,
"
Add Breakpoint
"
),
null
,
true
,
()
=>
this
.
debugService
.
toggleBreakpoint
(
uri
,
lineNumber
)
));
}
return
TPromise
.
as
(
actions
);
}
private
registerListeners
():
void
{
this
.
toDispose
.
push
(
this
.
editor
.
addListener2
(
editorcommon
.
EventType
.
MouseDown
,
(
e
:
editorbrowser
.
IMouseEvent
)
=>
{
if
(
e
.
target
.
type
!==
editorcommon
.
MouseTargetType
.
GUTTER_GLYPH_MARGIN
||
/* after last line */
e
.
target
.
detail
)
{
...
...
@@ -41,9 +68,23 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution
return
;
}
var
modelUrl
=
this
.
editor
.
getModel
().
getAssociatedResource
();
this
.
debugService
.
toggleBreakpoint
(
modelUrl
,
e
.
target
.
position
.
lineNumber
);
const
lineNumber
=
e
.
target
.
position
.
lineNumber
;
const
uri
=
this
.
editor
.
getModel
().
getAssociatedResource
();
if
(
e
.
event
.
rightButton
)
{
const
anchor
=
{
x
:
e
.
event
.
posx
+
1
,
y
:
e
.
event
.
posy
};
const
breakpoint
=
this
.
debugService
.
getModel
().
getBreakpoints
().
filter
(
bp
=>
bp
.
lineNumber
===
lineNumber
&&
bp
.
source
.
uri
.
toString
()
===
uri
.
toString
()).
pop
();
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
this
.
getContextMenuActions
(
breakpoint
,
uri
,
lineNumber
),
getActionsContext
:
()
=>
breakpoint
});
}
else
{
this
.
debugService
.
toggleBreakpoint
(
uri
,
lineNumber
);
}
}));
this
.
toDispose
.
push
(
this
.
editor
.
addListener2
(
editorcommon
.
EventType
.
MouseMove
,
(
e
:
editorbrowser
.
IMouseEvent
)
=>
{
var
showBreakpointHintAtLineNumber
=
-
1
;
if
(
e
.
target
.
type
===
editorcommon
.
MouseTargetType
.
GUTTER_GLYPH_MARGIN
&&
this
.
debugService
.
canSetBreakpointsIn
(
this
.
editor
.
getModel
(),
e
.
target
.
position
.
lineNumber
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录