Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f06db31f
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,发现更多精彩内容 >>
提交
f06db31f
编写于
7月 10, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Debug: save view state when it changes and not on shutdown
fixes #77060
上级
dea3abbb
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
54 addition
and
38 deletion
+54
-38
src/vs/workbench/contrib/debug/browser/breakpointWidget.ts
src/vs/workbench/contrib/debug/browser/breakpointWidget.ts
+2
-1
src/vs/workbench/contrib/debug/browser/debugEditorModelManager.ts
...orkbench/contrib/debug/browser/debugEditorModelManager.ts
+2
-1
src/vs/workbench/contrib/debug/browser/debugService.ts
src/vs/workbench/contrib/debug/browser/debugService.ts
+46
-34
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+1
-1
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
+3
-1
未找到文件。
src/vs/workbench/contrib/debug/browser/breakpointWidget.ts
浏览文件 @
f06db31f
...
...
@@ -34,6 +34,7 @@ import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
getSimpleEditorOptions
,
getSimpleCodeEditorWidgetOptions
}
from
'
vs/workbench/contrib/codeEditor/browser/simpleEditorOptions
'
;
import
{
IRange
,
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
const
$
=
dom
.
$
;
const
IPrivateBreakpointWidgetService
=
createDecorator
<
IPrivateBreakpointWidgetService
>
(
'
privateBreakopintWidgetService
'
);
...
...
@@ -190,7 +191,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
hitCondition
,
logMessage
});
this
.
debugService
.
updateBreakpoints
(
this
.
breakpoint
.
uri
,
data
,
false
);
this
.
debugService
.
updateBreakpoints
(
this
.
breakpoint
.
uri
,
data
,
false
)
.
then
(
undefined
,
onUnexpectedError
)
;
}
else
{
const
model
=
this
.
editor
.
getModel
();
if
(
model
)
{
...
...
src/vs/workbench/contrib/debug/browser/debugEditorModelManager.ts
浏览文件 @
f06db31f
...
...
@@ -15,6 +15,7 @@ import { getBreakpointMessageAndClassName } from 'vs/workbench/contrib/debug/bro
import
{
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
registerColor
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
interface
IBreakpointDecoration
{
decorationId
:
string
;
...
...
@@ -199,7 +200,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
}
}
this
.
debugService
.
updateBreakpoints
(
modelUri
,
data
,
true
);
this
.
debugService
.
updateBreakpoints
(
modelUri
,
data
,
true
)
.
then
(
undefined
,
onUnexpectedError
)
;
}
private
onBreakpointsChange
():
void
{
...
...
src/vs/workbench/contrib/debug/browser/debugService.ts
浏览文件 @
f06db31f
...
...
@@ -133,7 +133,6 @@ export class DebugService implements IDebugService {
this
.
viewModel
=
new
ViewModel
(
contextKeyService
);
this
.
toDispose
.
push
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
toDispose
.
push
(
this
.
storageService
.
onWillSaveState
(
this
.
saveState
,
this
));
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
event
=>
{
...
...
@@ -817,67 +816,82 @@ export class DebugService implements IDebugService {
addWatchExpression
(
name
:
string
):
void
{
const
we
=
this
.
model
.
addWatchExpression
(
name
);
this
.
viewModel
.
setSelectedExpression
(
we
);
this
.
storeWatchExpressions
();
}
renameWatchExpression
(
id
:
string
,
newName
:
string
):
void
{
return
this
.
model
.
renameWatchExpression
(
id
,
newName
);
this
.
model
.
renameWatchExpression
(
id
,
newName
);
this
.
storeWatchExpressions
();
}
moveWatchExpression
(
id
:
string
,
position
:
number
):
void
{
this
.
model
.
moveWatchExpression
(
id
,
position
);
this
.
storeWatchExpressions
();
}
removeWatchExpressions
(
id
?:
string
):
void
{
this
.
model
.
removeWatchExpressions
(
id
);
this
.
storeWatchExpressions
();
}
//---- breakpoints
enableOrDisableBreakpoints
(
enable
:
boolean
,
breakpoint
?:
IEnablement
):
Promise
<
void
>
{
async
enableOrDisableBreakpoints
(
enable
:
boolean
,
breakpoint
?:
IEnablement
):
Promise
<
void
>
{
if
(
breakpoint
)
{
this
.
model
.
setEnablement
(
breakpoint
,
enable
);
if
(
breakpoint
instanceof
Breakpoint
)
{
return
this
.
sendBreakpoints
(
breakpoint
.
uri
);
await
this
.
sendBreakpoints
(
breakpoint
.
uri
);
}
else
if
(
breakpoint
instanceof
FunctionBreakpoint
)
{
return
this
.
sendFunctionBreakpoints
();
}
return
this
.
sendExceptionBreakpoints
();
await
this
.
sendFunctionBreakpoints
();
}
else
{
await
this
.
sendExceptionBreakpoints
();
}
}
else
{
this
.
model
.
enableOrDisableAllBreakpoints
(
enable
);
return
this
.
sendAllBreakpoints
();
await
this
.
sendAllBreakpoints
();
}
this
.
storeBreakpoints
();
}
addBreakpoints
(
uri
:
uri
,
rawBreakpoints
:
IBreakpointData
[],
context
:
string
):
Promise
<
IBreakpoint
[]
>
{
a
sync
a
ddBreakpoints
(
uri
:
uri
,
rawBreakpoints
:
IBreakpointData
[],
context
:
string
):
Promise
<
IBreakpoint
[]
>
{
const
breakpoints
=
this
.
model
.
addBreakpoints
(
uri
,
rawBreakpoints
);
breakpoints
.
forEach
(
bp
=>
aria
.
status
(
nls
.
localize
(
'
breakpointAdded
'
,
"
Added breakpoint, line {0}, file {1}
"
,
bp
.
lineNumber
,
uri
.
fsPath
)));
breakpoints
.
forEach
(
bp
=>
this
.
telemetryDebugAddBreakpoint
(
bp
,
context
));
return
this
.
sendBreakpoints
(
uri
).
then
(()
=>
breakpoints
);
await
this
.
sendBreakpoints
(
uri
);
this
.
storeBreakpoints
();
return
breakpoints
;
}
updateBreakpoints
(
uri
:
uri
,
data
:
Map
<
string
,
DebugProtocol
.
Breakpoint
>
,
sendOnResourceSaved
:
boolean
):
void
{
async
updateBreakpoints
(
uri
:
uri
,
data
:
Map
<
string
,
DebugProtocol
.
Breakpoint
>
,
sendOnResourceSaved
:
boolean
):
Promise
<
void
>
{
this
.
model
.
updateBreakpoints
(
data
);
if
(
sendOnResourceSaved
)
{
this
.
breakpointsToSendOnResourceSaved
.
add
(
uri
.
toString
());
}
else
{
this
.
sendBreakpoints
(
uri
);
await
this
.
sendBreakpoints
(
uri
);
}
this
.
storeBreakpoints
();
}
removeBreakpoints
(
id
?:
string
):
Promise
<
any
>
{
async
removeBreakpoints
(
id
?:
string
):
Promise
<
void
>
{
const
toRemove
=
this
.
model
.
getBreakpoints
().
filter
(
bp
=>
!
id
||
bp
.
getId
()
===
id
);
toRemove
.
forEach
(
bp
=>
aria
.
status
(
nls
.
localize
(
'
breakpointRemoved
'
,
"
Removed breakpoint, line {0}, file {1}
"
,
bp
.
lineNumber
,
bp
.
uri
.
fsPath
)));
const
urisToClear
=
distinct
(
toRemove
,
bp
=>
bp
.
uri
.
toString
()).
map
(
bp
=>
bp
.
uri
);
this
.
model
.
removeBreakpoints
(
toRemove
);
return
Promise
.
all
(
urisToClear
.
map
(
uri
=>
this
.
sendBreakpoints
(
uri
)));
await
Promise
.
all
(
urisToClear
.
map
(
uri
=>
this
.
sendBreakpoints
(
uri
)));
this
.
storeBreakpoints
();
}
setBreakpointsActivated
(
activated
:
boolean
):
Promise
<
void
>
{
this
.
model
.
setBreakpointsActivated
(
activated
);
if
(
activated
)
{
this
.
storageService
.
store
(
DEBUG_BREAKPOINTS_ACTIVATED_KEY
,
'
false
'
,
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
DEBUG_BREAKPOINTS_ACTIVATED_KEY
,
StorageScope
.
WORKSPACE
);
}
return
this
.
sendAllBreakpoints
();
}
...
...
@@ -886,14 +900,16 @@ export class DebugService implements IDebugService {
this
.
viewModel
.
setSelectedFunctionBreakpoint
(
newFunctionBreakpoint
);
}
renameFunctionBreakpoint
(
id
:
string
,
newFunctionName
:
string
):
Promise
<
void
>
{
async
renameFunctionBreakpoint
(
id
:
string
,
newFunctionName
:
string
):
Promise
<
void
>
{
this
.
model
.
renameFunctionBreakpoint
(
id
,
newFunctionName
);
return
this
.
sendFunctionBreakpoints
();
await
this
.
sendFunctionBreakpoints
();
this
.
storeBreakpoints
();
}
removeFunctionBreakpoints
(
id
?:
string
):
Promise
<
void
>
{
async
removeFunctionBreakpoints
(
id
?:
string
):
Promise
<
void
>
{
this
.
model
.
removeFunctionBreakpoints
(
id
);
return
this
.
sendFunctionBreakpoints
();
await
this
.
sendFunctionBreakpoints
();
this
.
storeBreakpoints
();
}
sendAllBreakpoints
(
session
?:
IDebugSession
):
Promise
<
any
>
{
...
...
@@ -993,7 +1009,16 @@ export class DebugService implements IDebugService {
return
result
||
[];
}
private
saveState
():
void
{
private
storeWatchExpressions
():
void
{
const
watchExpressions
=
this
.
model
.
getWatchExpressions
();
if
(
watchExpressions
.
length
)
{
this
.
storageService
.
store
(
DEBUG_WATCH_EXPRESSIONS_KEY
,
JSON
.
stringify
(
watchExpressions
.
map
(
we
=>
({
name
:
we
.
name
,
id
:
we
.
getId
()
}))),
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
DEBUG_WATCH_EXPRESSIONS_KEY
,
StorageScope
.
WORKSPACE
);
}
}
private
storeBreakpoints
():
void
{
const
breakpoints
=
this
.
model
.
getBreakpoints
();
if
(
breakpoints
.
length
)
{
this
.
storageService
.
store
(
DEBUG_BREAKPOINTS_KEY
,
JSON
.
stringify
(
breakpoints
),
StorageScope
.
WORKSPACE
);
...
...
@@ -1001,12 +1026,6 @@ export class DebugService implements IDebugService {
this
.
storageService
.
remove
(
DEBUG_BREAKPOINTS_KEY
,
StorageScope
.
WORKSPACE
);
}
if
(
!
this
.
model
.
areBreakpointsActivated
())
{
this
.
storageService
.
store
(
DEBUG_BREAKPOINTS_ACTIVATED_KEY
,
'
false
'
,
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
DEBUG_BREAKPOINTS_ACTIVATED_KEY
,
StorageScope
.
WORKSPACE
);
}
const
functionBreakpoints
=
this
.
model
.
getFunctionBreakpoints
();
if
(
functionBreakpoints
.
length
)
{
this
.
storageService
.
store
(
DEBUG_FUNCTION_BREAKPOINTS_KEY
,
JSON
.
stringify
(
functionBreakpoints
),
StorageScope
.
WORKSPACE
);
...
...
@@ -1020,13 +1039,6 @@ export class DebugService implements IDebugService {
}
else
{
this
.
storageService
.
remove
(
DEBUG_EXCEPTION_BREAKPOINTS_KEY
,
StorageScope
.
WORKSPACE
);
}
const
watchExpressions
=
this
.
model
.
getWatchExpressions
();
if
(
watchExpressions
.
length
)
{
this
.
storageService
.
store
(
DEBUG_WATCH_EXPRESSIONS_KEY
,
JSON
.
stringify
(
watchExpressions
.
map
(
we
=>
({
name
:
we
.
name
,
id
:
we
.
getId
()
}))),
StorageScope
.
WORKSPACE
);
}
else
{
this
.
storageService
.
remove
(
DEBUG_WATCH_EXPRESSIONS_KEY
,
StorageScope
.
WORKSPACE
);
}
}
//---- telemetry
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
f06db31f
...
...
@@ -722,7 +722,7 @@ export interface IDebugService {
/**
* Updates the breakpoints.
*/
updateBreakpoints
(
uri
:
uri
,
data
:
Map
<
string
,
IBreakpointUpdateData
>
,
sendOnResourceSaved
:
boolean
):
void
;
updateBreakpoints
(
uri
:
uri
,
data
:
Map
<
string
,
IBreakpointUpdateData
>
,
sendOnResourceSaved
:
boolean
):
Promise
<
void
>
;
/**
* Enables or disables all breakpoints. If breakpoint is passed only enables or disables the passed breakpoint.
...
...
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
浏览文件 @
f06db31f
...
...
@@ -51,7 +51,9 @@ export class MockDebugService implements IDebugService {
throw
new
Error
(
'
not implemented
'
);
}
public
updateBreakpoints
(
uri
:
uri
,
data
:
Map
<
string
,
IBreakpointUpdateData
>
,
sendOnResourceSaved
:
boolean
):
void
{
}
public
updateBreakpoints
(
uri
:
uri
,
data
:
Map
<
string
,
IBreakpointUpdateData
>
,
sendOnResourceSaved
:
boolean
):
Promise
<
void
>
{
throw
new
Error
(
'
not implemented
'
);
}
public
enableOrDisableBreakpoints
(
enabled
:
boolean
):
Promise
<
void
>
{
throw
new
Error
(
'
not implemented
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录