Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6afc0546
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,发现更多精彩内容 >>
提交
6afc0546
编写于
5月 11, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: get specific source name
fixes #30686
上级
30cf40c4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
16 deletion
+51
-16
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+1
-0
src/vs/workbench/parts/debug/common/debugModel.ts
src/vs/workbench/parts/debug/common/debugModel.ts
+18
-0
src/vs/workbench/parts/debug/common/debugSource.ts
src/vs/workbench/parts/debug/common/debugSource.ts
+1
-1
src/vs/workbench/parts/debug/electron-browser/callStackView.ts
...s/workbench/parts/debug/electron-browser/callStackView.ts
+3
-15
src/vs/workbench/parts/debug/test/node/debugModel.test.ts
src/vs/workbench/parts/debug/test/node/debugModel.test.ts
+28
-0
未找到文件。
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
6afc0546
...
...
@@ -219,6 +219,7 @@ export interface IStackFrame extends ITreeElement {
readonly
source
:
Source
;
getScopes
():
TPromise
<
ReadonlyArray
<
IScope
>>
;
getMostSpecificScopes
(
range
:
IRange
):
TPromise
<
ReadonlyArray
<
IScope
>>
;
getSpecificSourceName
():
string
;
restart
():
TPromise
<
any
>
;
toString
():
string
;
openInEditor
(
editorService
:
IWorkbenchEditorService
,
preserveFocus
?:
boolean
,
sideBySide
?:
boolean
):
TPromise
<
any
>
;
...
...
src/vs/workbench/parts/debug/common/debugModel.ts
浏览文件 @
6afc0546
...
...
@@ -25,6 +25,8 @@ import {
import
{
Source
}
from
'
vs/workbench/parts/debug/common/debugSource
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
mixin
}
from
'
vs/base/common/objects
'
;
import
{
commonSuffixLength
}
from
'
vs/base/common/strings
'
;
import
{
sep
}
from
'
vs/base/common/paths
'
;
const
MAX_REPL_LENGTH
=
10000
;
...
...
@@ -360,6 +362,22 @@ export class StackFrame implements IStackFrame {
return
this
.
scopes
;
}
public
getSpecificSourceName
():
string
{
const
otherSources
=
this
.
thread
.
getCallStack
().
map
(
sf
=>
sf
.
source
).
filter
(
s
=>
s
!==
this
.
source
);
let
suffixLength
=
0
;
otherSources
.
forEach
(
s
=>
{
if
(
s
.
name
===
this
.
source
.
name
)
{
suffixLength
=
Math
.
max
(
suffixLength
,
commonSuffixLength
(
this
.
source
.
uri
.
path
,
s
.
uri
.
path
));
}
});
if
(
suffixLength
===
0
)
{
return
this
.
source
.
name
;
}
const
from
=
Math
.
max
(
0
,
this
.
source
.
uri
.
path
.
lastIndexOf
(
sep
,
this
.
source
.
uri
.
path
.
length
-
suffixLength
-
1
));
return
(
from
>
0
?
'
...
'
:
''
)
+
this
.
source
.
uri
.
path
.
substr
(
from
);
}
public
getMostSpecificScopes
(
range
:
IRange
):
TPromise
<
IScope
[]
>
{
return
this
.
getScopes
().
then
(
scopes
=>
{
scopes
=
scopes
.
filter
(
s
=>
!
s
.
expensive
);
...
...
src/vs/workbench/parts/debug/common/debugSource.ts
浏览文件 @
6afc0546
...
...
@@ -53,7 +53,7 @@ export class Source {
}
public
get
name
()
{
return
this
.
raw
.
name
;
return
this
.
raw
.
name
||
resources
.
basenameOrAuthority
(
this
.
uri
)
;
}
public
get
origin
()
{
...
...
src/vs/workbench/parts/debug/electron-browser/callStackView.ts
浏览文件 @
6afc0546
...
...
@@ -21,9 +21,6 @@ import { IAction, IActionItem } from 'vs/base/common/actions';
import
{
RestartAction
,
StopAction
,
ContinueAction
,
StepOverAction
,
StepIntoAction
,
StepOutAction
,
PauseAction
,
RestartFrameAction
,
TerminateThreadAction
}
from
'
vs/workbench/parts/debug/browser/debugActions
'
;
import
{
CopyStackTraceAction
}
from
'
vs/workbench/parts/debug/electron-browser/electronDebugActions
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
Source
}
from
'
vs/workbench/parts/debug/common/debugSource
'
;
import
{
basenameOrAuthority
}
from
'
vs/base/common/resources
'
;
import
{
TreeResourceNavigator
,
WorkbenchTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -383,7 +380,6 @@ class CallStackRenderer implements IRenderer {
constructor
(
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
)
{
// noop
}
...
...
@@ -508,7 +504,7 @@ class CallStackRenderer implements IRenderer {
}
data
.
label
.
textContent
=
stackFrame
.
name
;
data
.
label
.
title
=
stackFrame
.
name
;
data
.
fileName
.
textContent
=
getSourceName
(
stackFrame
.
source
,
this
.
contextService
,
this
.
environmentService
);
data
.
fileName
.
textContent
=
stackFrame
.
getSpecificSourceName
(
);
if
(
stackFrame
.
range
.
startLineNumber
!==
undefined
)
{
data
.
lineNumber
.
textContent
=
`
${
stackFrame
.
range
.
startLineNumber
}
`
;
if
(
stackFrame
.
range
.
startColumn
)
{
...
...
@@ -527,7 +523,7 @@ class CallStackRenderer implements IRenderer {
class
CallstackAccessibilityProvider
implements
IAccessibilityProvider
{
constructor
(
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
)
{
constructor
()
{
// noop
}
...
...
@@ -536,17 +532,9 @@ class CallstackAccessibilityProvider implements IAccessibilityProvider {
return
nls
.
localize
(
'
threadAriaLabel
'
,
"
Thread {0}, callstack, debug
"
,
(
<
Thread
>
element
).
name
);
}
if
(
element
instanceof
StackFrame
)
{
return
nls
.
localize
(
'
stackFrameAriaLabel
'
,
"
Stack Frame {0} line {1} {2}, callstack, debug
"
,
(
<
StackFrame
>
element
).
name
,
(
<
StackFrame
>
element
).
range
.
startLineNumber
,
getSourceName
((
<
StackFrame
>
element
).
source
,
this
.
contextService
));
return
nls
.
localize
(
'
stackFrameAriaLabel
'
,
"
Stack Frame {0} line {1} {2}, callstack, debug
"
,
element
.
name
,
element
.
range
.
startLineNumber
,
element
.
getSpecificSourceName
(
));
}
return
null
;
}
}
function
getSourceName
(
source
:
Source
,
contextService
:
IWorkspaceContextService
,
environmentService
?:
IEnvironmentService
):
string
{
if
(
source
.
name
)
{
return
source
.
name
;
}
return
basenameOrAuthority
(
source
.
uri
);
}
src/vs/workbench/parts/debug/test/node/debugModel.test.ts
浏览文件 @
6afc0546
...
...
@@ -9,6 +9,7 @@ import severity from 'vs/base/common/severity';
import
{
SimpleReplElement
,
Model
,
Session
,
Expression
,
RawObjectReplElement
,
StackFrame
,
Thread
}
from
'
vs/workbench/parts/debug/common/debugModel
'
;
import
*
as
sinon
from
'
sinon
'
;
import
{
MockSession
}
from
'
vs/workbench/parts/debug/test/common/mockDebug
'
;
import
{
Source
}
from
'
vs/workbench/parts/debug/common/debugSource
'
;
suite
(
'
Debug - Model
'
,
()
=>
{
let
model
:
Model
;
...
...
@@ -366,6 +367,33 @@ suite('Debug - Model', () => {
assert
.
equal
(
model
.
getReplElements
().
length
,
0
);
});
test
(
'
stack frame get specific source name
'
,
()
=>
{
const
session
=
new
Session
({
resolved
:
{
name
:
'
mockSession
'
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
rawSession
);
let
firstStackFrame
:
StackFrame
;
let
secondStackFrame
:
StackFrame
;
const
thread
=
new
class
extends
Thread
{
public
getCallStack
():
StackFrame
[]
{
return
[
firstStackFrame
,
secondStackFrame
];
}
}(
session
,
'
mockthread
'
,
1
);
const
firstSource
=
new
Source
({
name
:
'
internalModule.js
'
,
path
:
'
a/b/c/d/internalModule.js
'
,
sourceReference
:
10
,
},
'
aDebugSessionId
'
);
const
secondSource
=
new
Source
({
name
:
'
internalModule.js
'
,
path
:
'
z/x/c/d/internalModule.js
'
,
sourceReference
:
11
,
},
'
aDebugSessionId
'
);
firstStackFrame
=
new
StackFrame
(
thread
,
1
,
firstSource
,
'
app.js
'
,
'
normal
'
,
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
10
},
1
);
secondStackFrame
=
new
StackFrame
(
thread
,
1
,
secondSource
,
'
app.js
'
,
'
normal
'
,
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
10
},
1
);
assert
.
equal
(
firstStackFrame
.
getSpecificSourceName
(),
'
.../b/c/d/internalModule.js
'
);
assert
.
equal
(
secondStackFrame
.
getSpecificSourceName
(),
'
.../x/c/d/internalModule.js
'
);
});
// Repl output
test
(
'
repl output
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录