Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ff39ebfa
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,发现更多精彩内容 >>
提交
ff39ebfa
编写于
5月 06, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: move getSpecificSourceName to a helper method
上级
af3c79ed
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
27 addition
and
28 deletion
+27
-28
src/vs/workbench/contrib/debug/browser/callStackView.ts
src/vs/workbench/contrib/debug/browser/callStackView.ts
+24
-2
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+0
-1
src/vs/workbench/contrib/debug/common/debugModel.ts
src/vs/workbench/contrib/debug/common/debugModel.ts
+0
-22
src/vs/workbench/contrib/debug/test/browser/callStack.test.ts
...vs/workbench/contrib/debug/test/browser/callStack.test.ts
+3
-3
未找到文件。
src/vs/workbench/contrib/debug/browser/callStackView.ts
浏览文件 @
ff39ebfa
...
...
@@ -41,6 +41,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
attachStylerCallback
}
from
'
vs/platform/theme/common/styler
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
commonSuffixLength
}
from
'
vs/base/common/strings
'
;
import
{
posix
}
from
'
vs/base/common/path
'
;
const
$
=
dom
.
$
;
...
...
@@ -78,6 +80,26 @@ export function getContextForContributedActions(element: CallStackItem | null):
return
''
;
}
export
function
getSpecificSourceName
(
stackFrame
:
IStackFrame
):
string
{
// To reduce flashing of the path name and the way we fetch stack frames
// We need to compute the source name based on the other frames in the stale call stack
let
callStack
=
(
<
Thread
>
stackFrame
.
thread
).
getStaleCallStack
();
callStack
=
callStack
.
length
>
0
?
callStack
:
stackFrame
.
thread
.
getCallStack
();
const
otherSources
=
callStack
.
map
(
sf
=>
sf
.
source
).
filter
(
s
=>
s
!==
stackFrame
.
source
);
let
suffixLength
=
0
;
otherSources
.
forEach
(
s
=>
{
if
(
s
.
name
===
stackFrame
.
source
.
name
)
{
suffixLength
=
Math
.
max
(
suffixLength
,
commonSuffixLength
(
stackFrame
.
source
.
uri
.
path
,
s
.
uri
.
path
));
}
});
if
(
suffixLength
===
0
)
{
return
stackFrame
.
source
.
name
;
}
const
from
=
Math
.
max
(
0
,
stackFrame
.
source
.
uri
.
path
.
lastIndexOf
(
posix
.
sep
,
stackFrame
.
source
.
uri
.
path
.
length
-
suffixLength
-
1
));
return
(
from
>
0
?
'
...
'
:
''
)
+
stackFrame
.
source
.
uri
.
path
.
substr
(
from
);
}
export
class
CallStackView
extends
ViewPane
{
private
pauseMessage
!
:
HTMLSpanElement
;
private
pauseMessageLabel
!
:
HTMLSpanElement
;
...
...
@@ -582,7 +604,7 @@ class StackFramesRenderer implements ITreeRenderer<IStackFrame, FuzzyScore, ISta
data
.
file
.
title
+=
`\n
${
stackFrame
.
source
.
raw
.
origin
}
`
;
}
data
.
label
.
set
(
stackFrame
.
name
,
createMatches
(
element
.
filterData
),
stackFrame
.
name
);
data
.
fileName
.
textContent
=
stackFrame
.
getSpecificSourceName
(
);
data
.
fileName
.
textContent
=
getSpecificSourceName
(
stackFrame
);
if
(
stackFrame
.
range
.
startLineNumber
!==
undefined
)
{
data
.
lineNumber
.
textContent
=
`
${
stackFrame
.
range
.
startLineNumber
}
`
;
if
(
stackFrame
.
range
.
startColumn
)
{
...
...
@@ -855,7 +877,7 @@ class CallStackAccessibilityProvider implements IListAccessibilityProvider<CallS
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
"
,
element
.
name
,
element
.
range
.
startLineNumber
,
element
.
getSpecificSourceName
(
));
return
nls
.
localize
(
'
stackFrameAriaLabel
'
,
"
Stack Frame {0}, line {1}, {2}, callstack, debug
"
,
element
.
name
,
element
.
range
.
startLineNumber
,
getSpecificSourceName
(
element
));
}
if
(
isDebugSession
(
element
))
{
return
nls
.
localize
(
'
sessionLabel
'
,
"
Debug Session {0}
"
,
element
.
getLabel
());
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
ff39ebfa
...
...
@@ -318,7 +318,6 @@ export interface IStackFrame extends ITreeElement {
readonly
source
:
Source
;
getScopes
():
Promise
<
IScope
[]
>
;
getMostSpecificScopes
(
range
:
IRange
):
Promise
<
ReadonlyArray
<
IScope
>>
;
getSpecificSourceName
():
string
;
forgetScopes
():
void
;
restart
():
Promise
<
any
>
;
toString
():
string
;
...
...
src/vs/workbench/contrib/debug/common/debugModel.ts
浏览文件 @
ff39ebfa
...
...
@@ -17,8 +17,6 @@ import {
IThread
,
IRawModelUpdate
,
IScope
,
IRawStoppedDetails
,
IEnablement
,
IBreakpointData
,
IExceptionInfo
,
IBreakpointsChangeEvent
,
IBreakpointUpdateData
,
IBaseBreakpoint
,
State
,
IDataBreakpoint
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
Source
,
UNKNOWN_SOURCE_LABEL
,
getUriFromSource
}
from
'
vs/workbench/contrib/debug/common/debugSource
'
;
import
{
commonSuffixLength
}
from
'
vs/base/common/strings
'
;
import
{
posix
}
from
'
vs/base/common/path
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ITextEditorPane
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -325,26 +323,6 @@ export class StackFrame implements IStackFrame {
return
this
.
scopes
;
}
getSpecificSourceName
():
string
{
// To reduce flashing of the path name and the way we fetch stack frames
// We need to compute the source name based on the other frames in the stale call stack
let
callStack
=
(
<
Thread
>
this
.
thread
).
getStaleCallStack
();
callStack
=
callStack
.
length
>
0
?
callStack
:
this
.
thread
.
getCallStack
();
const
otherSources
=
callStack
.
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
(
posix
.
sep
,
this
.
source
.
uri
.
path
.
length
-
suffixLength
-
1
));
return
(
from
>
0
?
'
...
'
:
''
)
+
this
.
source
.
uri
.
path
.
substr
(
from
);
}
async
getMostSpecificScopes
(
range
:
IRange
):
Promise
<
IScope
[]
>
{
const
scopes
=
await
this
.
getScopes
();
const
nonExpensiveScopes
=
scopes
.
filter
(
s
=>
!
s
.
expensive
);
...
...
src/vs/workbench/contrib/debug/test/browser/callStack.test.ts
浏览文件 @
ff39ebfa
...
...
@@ -14,7 +14,7 @@ import { IDebugSessionOptions, State } from 'vs/workbench/contrib/debug/common/d
import
{
NullOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
createDecorationsForStackFrame
}
from
'
vs/workbench/contrib/debug/browser/callStackEditorContribution
'
;
import
{
Constants
}
from
'
vs/base/common/uint
'
;
import
{
getContext
,
getContextForContributedActions
}
from
'
vs/workbench/contrib/debug/browser/callStackView
'
;
import
{
getContext
,
getContextForContributedActions
,
getSpecificSourceName
}
from
'
vs/workbench/contrib/debug/browser/callStackView
'
;
import
{
getStackFrameThreadAndSessionToFocus
}
from
'
vs/workbench/contrib/debug/browser/debugService
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
...
...
@@ -250,8 +250,8 @@ suite('Debug - CallStack', () => {
model
.
addSession
(
session
);
const
{
firstStackFrame
,
secondStackFrame
}
=
createTwoStackFrames
(
session
);
assert
.
equal
(
firstStackFrame
.
getSpecificSourceName
(
),
'
.../b/c/d/internalModule.js
'
);
assert
.
equal
(
secondStackFrame
.
getSpecificSourceName
(
),
'
.../x/c/d/internalModule.js
'
);
assert
.
equal
(
getSpecificSourceName
(
firstStackFrame
),
'
.../b/c/d/internalModule.js
'
);
assert
.
equal
(
getSpecificSourceName
(
secondStackFrame
),
'
.../x/c/d/internalModule.js
'
);
});
test
(
'
stack frame toString()
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录