Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
24261c00
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,发现更多精彩内容 >>
提交
24261c00
编写于
1月 22, 2019
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cleaning up path DAP handling
上级
ebafef91
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
53 deletion
+46
-53
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
.../workbench/api/electron-browser/mainThreadDebugService.ts
+3
-5
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+3
-3
src/vs/workbench/parts/debug/common/debugUtils.ts
src/vs/workbench/parts/debug/common/debugUtils.ts
+40
-45
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
浏览文件 @
24261c00
...
...
@@ -14,7 +14,7 @@ import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostC
import
severity
from
'
vs/base/common/severity
'
;
import
{
AbstractDebugAdapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
convertToVSCPaths
,
convertToDAPaths
,
stringToUri
,
uriToString
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
convertToVSCPaths
,
convertToDAPaths
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadDebugService
)
export
class
MainThreadDebugService
implements
MainThreadDebugServiceShape
,
IDebugAdapterFactory
{
...
...
@@ -259,8 +259,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
}
public
$acceptDAMessage
(
handle
:
number
,
message
:
DebugProtocol
.
ProtocolMessage
)
{
this
.
_debugAdapters
.
get
(
handle
).
acceptMessage
(
convertToVSCPaths
(
message
,
source
=>
uriToString
(
source
)));
this
.
_debugAdapters
.
get
(
handle
).
acceptMessage
(
convertToVSCPaths
(
message
,
false
));
}
public
$acceptDAError
(
handle
:
number
,
name
:
string
,
message
:
string
,
stack
:
string
)
{
...
...
@@ -345,8 +344,7 @@ class ExtensionHostDebugAdapter extends AbstractDebugAdapter {
}
public
sendMessage
(
message
:
DebugProtocol
.
ProtocolMessage
):
void
{
this
.
_proxy
.
$sendDAMessage
(
this
.
_handle
,
convertToDAPaths
(
message
,
source
=>
stringToUri
(
source
)));
this
.
_proxy
.
$sendDAMessage
(
this
.
_handle
,
convertToDAPaths
(
message
,
true
));
}
public
stopSession
():
Promise
<
void
>
{
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
24261c00
...
...
@@ -24,7 +24,7 @@ import { getTerminalLauncher, hasChildProcesses, prepareCommand } from 'vs/workb
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
AbstractVariableResolverService
}
from
'
vs/workbench/services/configurationResolver/node/variableResolver
'
;
import
{
ExtHostConfiguration
,
ExtHostConfigProvider
}
from
'
./extHostConfiguration
'
;
import
{
convertToVSCPaths
,
convertToDAPaths
,
stringToUri
,
uriToString
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
convertToVSCPaths
,
convertToDAPaths
}
from
'
vs/workbench/parts/debug/common/debugUtils
'
;
import
{
ExtHostTerminalService
}
from
'
vs/workbench/api/node/extHostTerminalService
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
...
...
@@ -422,7 +422,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
}
// DA -> VS Code
message
=
convertToVSCPaths
(
message
,
source
=>
stringToUri
(
source
)
);
message
=
convertToVSCPaths
(
message
,
true
);
mythis
.
_debugServiceProxy
.
$acceptDAMessage
(
debugAdapterHandle
,
message
);
});
...
...
@@ -454,7 +454,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
public
$sendDAMessage
(
debugAdapterHandle
:
number
,
message
:
DebugProtocol
.
ProtocolMessage
):
Promise
<
void
>
{
// VS Code -> DA
message
=
convertToDAPaths
(
message
,
source
=>
uriToString
(
source
)
);
message
=
convertToDAPaths
(
message
,
false
);
const
tracker
=
this
.
_debugAdaptersTrackers
.
get
(
debugAdapterHandle
);
// TODO@AW: same handle?
if
(
tracker
)
{
...
...
src/vs/workbench/parts/debug/common/debugUtils.ts
浏览文件 @
24261c00
...
...
@@ -79,78 +79,84 @@ export function isUri(s: string) {
return
s
&&
s
.
match
(
_schemePattern
);
}
export
function
stringToUri
(
source
:
DebugProtocol
.
Source
):
void
{
if
(
typeof
source
.
path
===
'
string
'
)
{
if
(
isUri
(
source
.
path
))
{
(
<
any
>
source
).
path
=
uri
.
parse
(
source
.
path
);
function
stringToUri
(
path
:
string
):
string
{
if
(
typeof
path
===
'
string
'
)
{
if
(
isUri
(
path
))
{
return
<
string
><
unknown
>
uri
.
parse
(
path
);
}
else
{
// assume path
if
(
isAbsolute_posix
(
source
.
path
)
||
isAbsolute_win32
(
source
.
path
))
{
(
<
any
>
source
).
path
=
uri
.
file
(
source
.
path
);
if
(
isAbsolute_posix
(
path
)
||
isAbsolute_win32
(
path
))
{
return
<
string
><
unknown
>
uri
.
file
(
path
);
}
else
{
// leave relative path as is
}
}
}
return
path
;
}
export
function
uriToString
(
source
:
DebugProtocol
.
Source
):
void
{
if
(
typeof
source
.
path
===
'
object
'
)
{
const
u
=
uri
.
revive
(
source
.
path
);
function
uriToString
(
path
:
string
):
string
{
if
(
typeof
path
===
'
object
'
)
{
const
u
=
uri
.
revive
(
path
);
if
(
u
.
scheme
===
'
file
'
)
{
source
.
path
=
u
.
fsPath
;
return
u
.
fsPath
;
}
else
{
source
.
path
=
u
.
toString
();
return
u
.
toString
();
}
}
return
path
;
}
// path hooks helpers
export
function
convertToDAPaths
(
message
:
DebugProtocol
.
ProtocolMessage
,
fixSourcePaths
:
(
source
:
DebugProtocol
.
Source
)
=>
void
):
DebugProtocol
.
ProtocolMessage
{
interface
PathContainer
{
path
?:
string
;
}
export
function
convertToDAPaths
(
message
:
DebugProtocol
.
ProtocolMessage
,
toUri
:
boolean
):
DebugProtocol
.
ProtocolMessage
{
const
fixPath
=
toUri
?
stringToUri
:
uriToString
;
// since we modify Source.paths in the message in place, we need to make a copy of it (see #61129)
const
msg
=
deepClone
(
message
);
convertPaths
(
msg
,
(
toDA
:
boolean
,
source
:
DebugProtocol
.
Source
|
undefined
)
=>
{
convertPaths
(
msg
,
(
toDA
:
boolean
,
source
:
PathContainer
|
undefined
)
=>
{
if
(
toDA
&&
source
)
{
fixSourcePaths
(
source
);
source
.
path
=
fixPath
(
source
.
path
);
}
});
return
msg
;
}
export
function
convertToVSCPaths
(
message
:
DebugProtocol
.
ProtocolMessage
,
fixSourcePaths
:
(
source
:
DebugProtocol
.
Source
)
=>
void
):
DebugProtocol
.
ProtocolMessage
{
export
function
convertToVSCPaths
(
message
:
DebugProtocol
.
ProtocolMessage
,
toUri
:
boolean
):
DebugProtocol
.
ProtocolMessage
{
const
fixPath
=
toUri
?
stringToUri
:
uriToString
;
// since we modify Source.paths in the message in place, we need to make a copy of it (see #61129)
const
msg
=
deepClone
(
message
);
convertPaths
(
msg
,
(
toDA
:
boolean
,
source
:
DebugProtocol
.
Source
|
undefined
)
=>
{
convertPaths
(
msg
,
(
toDA
:
boolean
,
source
:
PathContainer
|
undefined
)
=>
{
if
(
!
toDA
&&
source
)
{
fixSourcePaths
(
source
);
source
.
path
=
fixPath
(
source
.
path
);
}
});
return
msg
;
}
function
convertPaths
(
msg
:
DebugProtocol
.
ProtocolMessage
,
fixSourcePaths
:
(
toDA
:
boolean
,
source
:
DebugProtocol
.
Source
|
undefined
)
=>
void
):
void
{
const
tmpSource
:
DebugProtocol
.
Source
=
{
path
:
''
};
function
convertPaths
(
msg
:
DebugProtocol
.
ProtocolMessage
,
fixSourcePath
:
(
toDA
:
boolean
,
source
:
PathContainer
|
undefined
)
=>
void
):
void
{
switch
(
msg
.
type
)
{
case
'
event
'
:
const
event
=
<
DebugProtocol
.
Event
>
msg
;
switch
(
event
.
event
)
{
case
'
output
'
:
fixSourcePath
s
(
false
,
(
<
DebugProtocol
.
OutputEvent
>
event
).
body
.
source
);
fixSourcePath
(
false
,
(
<
DebugProtocol
.
OutputEvent
>
event
).
body
.
source
);
break
;
case
'
loadedSource
'
:
fixSourcePath
s
(
false
,
(
<
DebugProtocol
.
LoadedSourceEvent
>
event
).
body
.
source
);
fixSourcePath
(
false
,
(
<
DebugProtocol
.
LoadedSourceEvent
>
event
).
body
.
source
);
break
;
case
'
breakpoint
'
:
fixSourcePath
s
(
false
,
(
<
DebugProtocol
.
BreakpointEvent
>
event
).
body
.
breakpoint
.
source
);
fixSourcePath
(
false
,
(
<
DebugProtocol
.
BreakpointEvent
>
event
).
body
.
breakpoint
.
source
);
break
;
default
:
break
;
...
...
@@ -160,22 +166,16 @@ function convertPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (toDA:
const
request
=
<
DebugProtocol
.
Request
>
msg
;
switch
(
request
.
command
)
{
case
'
setBreakpoints
'
:
fixSourcePath
s
(
true
,
(
<
DebugProtocol
.
SetBreakpointsArguments
>
request
.
arguments
).
source
);
fixSourcePath
(
true
,
(
<
DebugProtocol
.
SetBreakpointsArguments
>
request
.
arguments
).
source
);
break
;
case
'
source
'
:
fixSourcePath
s
(
true
,
(
<
DebugProtocol
.
SourceArguments
>
request
.
arguments
).
source
);
fixSourcePath
(
true
,
(
<
DebugProtocol
.
SourceArguments
>
request
.
arguments
).
source
);
break
;
case
'
gotoTargets
'
:
fixSourcePath
s
(
true
,
(
<
DebugProtocol
.
GotoTargetsArguments
>
request
.
arguments
).
source
);
fixSourcePath
(
true
,
(
<
DebugProtocol
.
GotoTargetsArguments
>
request
.
arguments
).
source
);
break
;
case
'
launchVSCode
'
:
request
.
arguments
.
args
.
forEach
(
a
=>
{
if
(
a
.
path
)
{
tmpSource
.
path
=
a
.
path
;
fixSourcePaths
(
false
,
tmpSource
);
a
.
path
=
tmpSource
.
path
;
}
});
request
.
arguments
.
args
.
forEach
(
arg
=>
fixSourcePath
(
false
,
arg
));
break
;
default
:
break
;
...
...
@@ -186,24 +186,19 @@ function convertPaths(msg: DebugProtocol.ProtocolMessage, fixSourcePaths: (toDA:
if
(
response
.
success
)
{
switch
(
response
.
command
)
{
case
'
stackTrace
'
:
const
r1
=
<
DebugProtocol
.
StackTraceResponse
>
response
;
r1
.
body
.
stackFrames
.
forEach
(
frame
=>
fixSourcePaths
(
false
,
frame
.
source
));
(
<
DebugProtocol
.
StackTraceResponse
>
response
).
body
.
stackFrames
.
forEach
(
frame
=>
fixSourcePath
(
false
,
frame
.
source
));
break
;
case
'
loadedSources
'
:
const
r2
=
<
DebugProtocol
.
LoadedSourcesResponse
>
response
;
r2
.
body
.
sources
.
forEach
(
source
=>
fixSourcePaths
(
false
,
source
));
(
<
DebugProtocol
.
LoadedSourcesResponse
>
response
).
body
.
sources
.
forEach
(
source
=>
fixSourcePath
(
false
,
source
));
break
;
case
'
scopes
'
:
const
r3
=
<
DebugProtocol
.
ScopesResponse
>
response
;
r3
.
body
.
scopes
.
forEach
(
scope
=>
fixSourcePaths
(
false
,
scope
.
source
));
(
<
DebugProtocol
.
ScopesResponse
>
response
).
body
.
scopes
.
forEach
(
scope
=>
fixSourcePath
(
false
,
scope
.
source
));
break
;
case
'
setFunctionBreakpoints
'
:
const
r4
=
<
DebugProtocol
.
SetFunctionBreakpointsResponse
>
response
;
r4
.
body
.
breakpoints
.
forEach
(
bp
=>
fixSourcePaths
(
false
,
bp
.
source
));
(
<
DebugProtocol
.
SetFunctionBreakpointsResponse
>
response
).
body
.
breakpoints
.
forEach
(
bp
=>
fixSourcePath
(
false
,
bp
.
source
));
break
;
case
'
setBreakpoints
'
:
const
r5
=
<
DebugProtocol
.
SetBreakpointsResponse
>
response
;
r5
.
body
.
breakpoints
.
forEach
(
bp
=>
fixSourcePaths
(
false
,
bp
.
source
));
(
<
DebugProtocol
.
SetBreakpointsResponse
>
response
).
body
.
breakpoints
.
forEach
(
bp
=>
fixSourcePath
(
false
,
bp
.
source
));
break
;
default
:
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录