Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
5ac625f8
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,发现更多精彩内容 >>
提交
5ac625f8
编写于
8月 24, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: fix breakpoint line for dirty files
fixes #56398
上级
ae5fff07
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
27 deletion
+34
-27
src/vs/workbench/parts/debug/browser/breakpointsView.ts
src/vs/workbench/parts/debug/browser/breakpointsView.ts
+5
-16
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
.../workbench/parts/debug/browser/debugEditorModelManager.ts
+1
-3
src/vs/workbench/parts/debug/common/debugModel.ts
src/vs/workbench/parts/debug/common/debugModel.ts
+25
-5
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+2
-2
src/vs/workbench/parts/debug/test/electron-browser/debugModel.test.ts
...ench/parts/debug/test/electron-browser/debugModel.test.ts
+1
-1
未找到文件。
src/vs/workbench/parts/debug/browser/breakpointsView.ts
浏览文件 @
5ac625f8
...
...
@@ -29,7 +29,6 @@ import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewl
import
{
attachInputBoxStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IEditorService
,
SIDE_GROUP
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ViewletPanel
,
IViewletPanelOptions
}
from
'
vs/workbench/browser/parts/views/panelViewlet
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
...
...
@@ -296,8 +295,7 @@ class BreakpointsRenderer implements IRenderer<IBreakpoint, IBreakpointTemplateD
constructor
(
@
IDebugService
private
debugService
:
IDebugService
,
@
ILabelService
private
labelService
:
ILabelService
,
@
ITextFileService
private
textFileService
:
ITextFileService
@
ILabelService
private
labelService
:
ILabelService
)
{
// noop
}
...
...
@@ -343,7 +341,7 @@ class BreakpointsRenderer implements IRenderer<IBreakpoint, IBreakpointTemplateD
data
.
filePath
.
textContent
=
this
.
labelService
.
getUriLabel
(
resources
.
dirname
(
breakpoint
.
uri
),
true
);
data
.
checkbox
.
checked
=
breakpoint
.
enabled
;
const
{
message
,
className
}
=
getBreakpointMessageAndClassName
(
this
.
debugService
,
this
.
textFileService
,
breakpoint
);
const
{
message
,
className
}
=
getBreakpointMessageAndClassName
(
this
.
debugService
,
breakpoint
);
data
.
icon
.
className
=
className
+
'
icon
'
;
data
.
breakpoint
.
title
=
breakpoint
.
message
||
message
||
''
;
...
...
@@ -413,8 +411,7 @@ class ExceptionBreakpointsRenderer implements IRenderer<IExceptionBreakpoint, IB
class
FunctionBreakpointsRenderer
implements
IRenderer
<
FunctionBreakpoint
,
IBaseBreakpointWithIconTemplateData
>
{
constructor
(
@
IDebugService
private
debugService
:
IDebugService
,
@
ITextFileService
private
textFileService
:
ITextFileService
@
IDebugService
private
debugService
:
IDebugService
)
{
// noop
}
...
...
@@ -447,7 +444,7 @@ class FunctionBreakpointsRenderer implements IRenderer<FunctionBreakpoint, IBase
renderElement
(
functionBreakpoint
:
FunctionBreakpoint
,
index
:
number
,
data
:
IBaseBreakpointWithIconTemplateData
):
void
{
data
.
context
=
functionBreakpoint
;
data
.
name
.
textContent
=
functionBreakpoint
.
name
;
const
{
className
,
message
}
=
getBreakpointMessageAndClassName
(
this
.
debugService
,
this
.
textFileService
,
functionBreakpoint
);
const
{
className
,
message
}
=
getBreakpointMessageAndClassName
(
this
.
debugService
,
functionBreakpoint
);
data
.
icon
.
className
=
className
+
'
icon
'
;
data
.
icon
.
title
=
message
?
message
:
''
;
data
.
checkbox
.
checked
=
functionBreakpoint
.
enabled
;
...
...
@@ -577,7 +574,7 @@ export function openBreakpointSource(breakpoint: IBreakpoint, sideBySide: boolea
},
sideBySide
?
SIDE_GROUP
:
ACTIVE_GROUP
);
}
export
function
getBreakpointMessageAndClassName
(
debugService
:
IDebugService
,
textFileService
:
ITextFileService
,
breakpoint
:
IBreakpoint
|
FunctionBreakpoint
):
{
message
?:
string
,
className
:
string
}
{
export
function
getBreakpointMessageAndClassName
(
debugService
:
IDebugService
,
breakpoint
:
IBreakpoint
|
FunctionBreakpoint
):
{
message
?:
string
,
className
:
string
}
{
const
state
=
debugService
.
state
;
const
debugActive
=
state
===
State
.
Running
||
state
===
State
.
Stopped
;
...
...
@@ -612,14 +609,6 @@ export function getBreakpointMessageAndClassName(debugService: IDebugService, te
};
}
if
(
debugActive
&&
textFileService
.
isDirty
(
breakpoint
.
uri
))
{
return
{
className
:
'
debug-breakpoint-unverified
'
,
message
:
appendMessage
(
nls
.
localize
(
'
breakpointDirtydHover
'
,
"
Unverified breakpoint. File is modified, please restart debug session.
"
)),
};
}
if
(
breakpoint
.
logMessage
||
breakpoint
.
condition
||
breakpoint
.
hitCondition
)
{
const
messages
=
[];
if
(
breakpoint
.
logMessage
)
{
...
...
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
浏览文件 @
5ac625f8
...
...
@@ -12,7 +12,6 @@ import { IDebugService, IBreakpoint, State, IBreakpointUpdateData } from 'vs/wor
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
MarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
getBreakpointMessageAndClassName
}
from
'
vs/workbench/parts/debug/browser/breakpointsView
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
interface
IBreakpointDecoration
{
decorationId
:
string
;
...
...
@@ -38,7 +37,6 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
constructor
(
@
IModelService
private
modelService
:
IModelService
,
@
IDebugService
private
debugService
:
IDebugService
,
@
ITextFileService
private
textFileService
:
ITextFileService
)
{
this
.
modelDataMap
=
new
Map
<
string
,
IDebugEditorModelData
>
();
this
.
toDispose
=
[];
...
...
@@ -277,7 +275,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
}
private
getBreakpointDecorationOptions
(
breakpoint
:
IBreakpoint
):
IModelDecorationOptions
{
const
{
className
,
message
}
=
getBreakpointMessageAndClassName
(
this
.
debugService
,
this
.
textFileService
,
breakpoint
);
const
{
className
,
message
}
=
getBreakpointMessageAndClassName
(
this
.
debugService
,
breakpoint
);
let
glyphMarginHoverMessage
:
MarkdownString
;
if
(
message
)
{
...
...
src/vs/workbench/parts/debug/common/debugModel.ts
浏览文件 @
5ac625f8
...
...
@@ -24,6 +24,7 @@ import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import
{
commonSuffixLength
}
from
'
vs/base/common/strings
'
;
import
{
sep
}
from
'
vs/base/common/paths
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
const
MAX_REPL_LENGTH
=
10000
;
...
...
@@ -622,6 +623,7 @@ export class Breakpoint extends BaseBreakpoint implements IBreakpoint {
hitCondition
:
string
,
logMessage
:
string
,
private
_adapterData
:
any
,
private
textFileService
:
ITextFileService
,
id
=
generateUuid
()
)
{
super
(
enabled
,
hitCondition
,
condition
,
logMessage
,
id
);
...
...
@@ -629,7 +631,16 @@ export class Breakpoint extends BaseBreakpoint implements IBreakpoint {
public
get
lineNumber
():
number
{
const
data
=
this
.
getSessionData
();
return
data
&&
typeof
data
.
line
===
'
number
'
?
data
.
line
:
this
.
_lineNumber
;
return
this
.
verified
&&
data
&&
typeof
data
.
line
===
'
number
'
?
data
.
line
:
this
.
_lineNumber
;
}
public
get
verified
():
boolean
{
const
data
=
this
.
getSessionData
();
if
(
data
)
{
return
data
.
verified
&&
!
this
.
textFileService
.
isDirty
(
this
.
uri
);
}
return
true
;
}
public
get
column
():
number
{
...
...
@@ -640,7 +651,14 @@ export class Breakpoint extends BaseBreakpoint implements IBreakpoint {
public
get
message
():
string
{
const
data
=
this
.
getSessionData
();
return
data
?
data
.
message
:
undefined
;
if
(
!
data
)
{
return
undefined
;
}
if
(
this
.
textFileService
.
isDirty
(
this
.
uri
))
{
return
nls
.
localize
(
'
breakpointDirtydHover
'
,
"
Unverified breakpoint. File is modified, please restart debug session.
"
);
}
return
data
.
message
;
}
public
get
adapterData
():
any
{
...
...
@@ -695,7 +713,8 @@ export class FunctionBreakpoint extends BaseBreakpoint implements IFunctionBreak
hitCondition
:
string
,
condition
:
string
,
logMessage
:
string
,
id
=
generateUuid
())
{
id
=
generateUuid
()
)
{
super
(
enabled
,
hitCondition
,
condition
,
logMessage
,
id
);
}
...
...
@@ -748,7 +767,8 @@ export class Model implements IModel {
private
breakpointsActivated
:
boolean
,
private
functionBreakpoints
:
FunctionBreakpoint
[],
private
exceptionBreakpoints
:
ExceptionBreakpoint
[],
private
watchExpressions
:
Expression
[]
private
watchExpressions
:
Expression
[],
private
textFileService
:
ITextFileService
)
{
this
.
sessions
=
[];
this
.
replElements
=
[];
...
...
@@ -886,7 +906,7 @@ export class Model implements IModel {
}
public
addBreakpoints
(
uri
:
uri
,
rawData
:
IBreakpointData
[],
fireEvent
=
true
):
IBreakpoint
[]
{
const
newBreakpoints
=
rawData
.
map
(
rawBp
=>
new
Breakpoint
(
uri
,
rawBp
.
lineNumber
,
rawBp
.
column
,
rawBp
.
enabled
,
rawBp
.
condition
,
rawBp
.
hitCondition
,
rawBp
.
logMessage
,
undefined
,
rawBp
.
id
));
const
newBreakpoints
=
rawData
.
map
(
rawBp
=>
new
Breakpoint
(
uri
,
rawBp
.
lineNumber
,
rawBp
.
column
,
rawBp
.
enabled
,
rawBp
.
condition
,
rawBp
.
hitCondition
,
rawBp
.
logMessage
,
undefined
,
this
.
textFileService
,
rawBp
.
id
));
newBreakpoints
.
forEach
(
bp
=>
bp
.
setSessionId
(
this
.
breakpointsSessionId
));
this
.
breakpoints
=
this
.
breakpoints
.
concat
(
newBreakpoints
);
this
.
breakpointsActivated
=
true
;
...
...
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
5ac625f8
...
...
@@ -114,7 +114,7 @@ export class DebugService implements IDebugService {
this
.
inDebugMode
=
CONTEXT_IN_DEBUG_MODE
.
bindTo
(
contextKeyService
);
this
.
model
=
new
Model
(
this
.
loadBreakpoints
(),
this
.
storageService
.
getBoolean
(
DEBUG_BREAKPOINTS_ACTIVATED_KEY
,
StorageScope
.
WORKSPACE
,
true
),
this
.
loadFunctionBreakpoints
(),
this
.
loadExceptionBreakpoints
(),
this
.
loadWatchExpressions
());
this
.
loadExceptionBreakpoints
(),
this
.
loadWatchExpressions
()
,
this
.
textFileService
);
this
.
toDispose
.
push
(
this
.
model
);
this
.
viewModel
=
new
ViewModel
(
contextKeyService
);
...
...
@@ -267,7 +267,7 @@ export class DebugService implements IDebugService {
let
result
:
Breakpoint
[];
try
{
result
=
JSON
.
parse
(
this
.
storageService
.
get
(
DEBUG_BREAKPOINTS_KEY
,
StorageScope
.
WORKSPACE
,
'
[]
'
)).
map
((
breakpoint
:
any
)
=>
{
return
new
Breakpoint
(
uri
.
parse
(
breakpoint
.
uri
.
external
||
breakpoint
.
source
.
uri
.
external
),
breakpoint
.
lineNumber
,
breakpoint
.
column
,
breakpoint
.
enabled
,
breakpoint
.
condition
,
breakpoint
.
hitCondition
,
breakpoint
.
logMessage
,
breakpoint
.
adapterData
);
return
new
Breakpoint
(
uri
.
parse
(
breakpoint
.
uri
.
external
||
breakpoint
.
source
.
uri
.
external
),
breakpoint
.
lineNumber
,
breakpoint
.
column
,
breakpoint
.
enabled
,
breakpoint
.
condition
,
breakpoint
.
hitCondition
,
breakpoint
.
logMessage
,
breakpoint
.
adapterData
,
this
.
textFileService
);
});
}
catch
(
e
)
{
}
...
...
src/vs/workbench/parts/debug/test/electron-browser/debugModel.test.ts
浏览文件 @
5ac625f8
...
...
@@ -17,7 +17,7 @@ suite('Debug - Model', () => {
let
rawSession
:
MockRawSession
;
setup
(()
=>
{
model
=
new
Model
([],
true
,
[],
[],
[]);
model
=
new
Model
([],
true
,
[],
[],
[]
,
<
any
>
{
isDirty
:
(
e
:
any
)
=>
false
}
);
rawSession
=
new
MockRawSession
();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录