Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b0d714d2
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,发现更多精彩内容 >>
未验证
提交
b0d714d2
编写于
9月 26, 2019
作者:
I
Isidor Nikolic
提交者:
GitHub
9月 26, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #81392 from dgozman/on-did-change-repl-elements
Fire onDidChangeReplElements directly from ReplModel
上级
6d933821
6c1cebbb
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
14 addition
and
7 deletion
+14
-7
src/vs/workbench/contrib/debug/browser/debugSession.ts
src/vs/workbench/contrib/debug/browser/debugSession.ts
+2
-7
src/vs/workbench/contrib/debug/common/replModel.ts
src/vs/workbench/contrib/debug/common/replModel.ts
+5
-0
src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts
...s/workbench/contrib/debug/test/browser/debugModel.test.ts
+7
-0
未找到文件。
src/vs/workbench/contrib/debug/browser/debugSession.ts
浏览文件 @
b0d714d2
...
...
@@ -86,6 +86,7 @@ export class DebugSession implements IDebugSession {
}
else
{
this
.
repl
=
(
this
.
parentSession
as
DebugSession
).
repl
;
}
this
.
repl
.
onDidChangeElements
(()
=>
this
.
_onDidChangeREPLElements
.
fire
());
}
getId
():
string
{
...
...
@@ -967,25 +968,19 @@ export class DebugSession implements IDebugSession {
removeReplExpressions
():
void
{
this
.
repl
.
removeReplExpressions
();
this
.
_onDidChangeREPLElements
.
fire
();
}
async
addReplExpression
(
stackFrame
:
IStackFrame
|
undefined
,
name
:
string
):
Promise
<
void
>
{
const
expressionEvaluated
=
this
.
repl
.
addReplExpression
(
this
,
stackFrame
,
name
);
this
.
_onDidChangeREPLElements
.
fire
();
await
expressionEvaluated
;
this
.
_onDidChangeREPLElements
.
fire
();
await
this
.
repl
.
addReplExpression
(
this
,
stackFrame
,
name
);
// Evaluate all watch expressions and fetch variables again since repl evaluation might have changed some.
variableSetEmitter
.
fire
();
}
appendToRepl
(
data
:
string
|
IExpression
,
severity
:
severity
,
source
?:
IReplElementSource
):
void
{
this
.
repl
.
appendToRepl
(
this
,
data
,
severity
,
source
);
this
.
_onDidChangeREPLElements
.
fire
();
}
logToRepl
(
sev
:
severity
,
args
:
any
[],
frame
?:
{
uri
:
URI
,
line
:
number
,
column
:
number
})
{
this
.
repl
.
logToRepl
(
this
,
sev
,
args
,
frame
);
this
.
_onDidChangeREPLElements
.
fire
();
}
}
src/vs/workbench/contrib/debug/common/replModel.ts
浏览文件 @
b0d714d2
...
...
@@ -12,6 +12,7 @@ import { basenameOrAuthority } from 'vs/base/common/resources';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
endsWith
}
from
'
vs/base/common/strings
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
const
MAX_REPL_LENGTH
=
10000
;
let
topReplElementCounter
=
0
;
...
...
@@ -108,6 +109,8 @@ export class ReplEvaluationResult extends ExpressionContainer implements IReplEl
export
class
ReplModel
{
private
replElements
:
IReplElement
[]
=
[];
private
readonly
_onDidChangeElements
=
new
Emitter
<
void
>
();
readonly
onDidChangeElements
=
this
.
_onDidChangeElements
.
event
;
getReplElements
():
IReplElement
[]
{
return
this
.
replElements
;
...
...
@@ -150,6 +153,7 @@ export class ReplModel {
if
(
this
.
replElements
.
length
>
MAX_REPL_LENGTH
)
{
this
.
replElements
.
splice
(
0
,
this
.
replElements
.
length
-
MAX_REPL_LENGTH
);
}
this
.
_onDidChangeElements
.
fire
();
}
logToRepl
(
session
:
IDebugSession
,
sev
:
severity
,
args
:
any
[],
frame
?:
{
uri
:
URI
,
line
:
number
,
column
:
number
})
{
...
...
@@ -228,6 +232,7 @@ export class ReplModel {
removeReplExpressions
():
void
{
if
(
this
.
replElements
.
length
>
0
)
{
this
.
replElements
=
[];
this
.
_onDidChangeElements
.
fire
();
}
}
}
src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts
浏览文件 @
b0d714d2
...
...
@@ -513,7 +513,11 @@ suite('Debug - Model', () => {
const
grandChild
=
createMockSession
(
model
,
'
grandChild
'
,
{
parentSession
:
child2
,
repl
:
'
mergeWithParent
'
});
const
child3
=
createMockSession
(
model
,
'
child3
'
,
{
parentSession
:
parent
});
let
parentChanges
=
0
;
parent
.
onDidChangeReplElements
(()
=>
++
parentChanges
);
parent
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
1
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
1
);
...
...
@@ -521,6 +525,7 @@ suite('Debug - Model', () => {
assert
.
equal
(
child3
.
getReplElements
().
length
,
0
);
grandChild
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
...
...
@@ -528,6 +533,7 @@ suite('Debug - Model', () => {
assert
.
equal
(
child3
.
getReplElements
().
length
,
0
);
child3
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
...
...
@@ -535,6 +541,7 @@ suite('Debug - Model', () => {
assert
.
equal
(
child3
.
getReplElements
().
length
,
1
);
child1
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录