Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
81142e2c
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,发现更多精彩内容 >>
提交
81142e2c
编写于
1月 29, 2018
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support for debugAdapterExecutable; fixes #33801
上级
c0a5a09a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
96 addition
and
9 deletion
+96
-9
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+33
-0
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
.../workbench/api/electron-browser/mainThreadDebugService.ts
+6
-1
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-0
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+3
-2
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+15
-1
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+10
-0
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+3
-0
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
...parts/debug/electron-browser/debugConfigurationManager.ts
+10
-2
src/vs/workbench/parts/debug/node/debugAdapter.ts
src/vs/workbench/parts/debug/node/debugAdapter.ts
+14
-2
src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts
src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts
+1
-1
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
81142e2c
...
...
@@ -359,6 +359,39 @@ declare module 'vscode' {
constructor
(
functionName
:
string
,
enabled
?:
boolean
,
condition
?:
string
,
hitCondition
?:
string
);
}
/**
* Represents a debug adapter executable and optional arguments passed to it.
*/
export
class
DebugAdapterExecutable
{
/**
* The command path of the debug adapter executable.
* A command must be a either an absolute path or a name of an executable looked up via the PATH environment variable.
* The special value 'node' will be mapped to VS Code's built-in node runtime.
*/
readonly
command
:
string
;
/**
* Optional arguments passed to the debug adapter.
*/
readonly
args
:
string
[];
/**
* Create a new debug adapter specification.
*/
constructor
(
command
:
string
,
args
?:
string
[]);
}
export
interface
DebugConfigurationProvider
{
/**
* This optional method is called just before a debug adapter is started to determine its excutable path and arguments.
* Registering more than one debugAdapterExecutable for a type results in an error.
* @param folder The workspace folder from which the configuration originates from or undefined for a folderless setup.
* @param token A cancellation token.
* @return a [debug adapter's executable and optional arguments](#DebugAdapterExecutable) or undefined.
*/
debugAdapterExecutable
?(
folder
:
WorkspaceFolder
|
undefined
,
token
?:
CancellationToken
):
ProviderResult
<
DebugAdapterExecutable
>
;
}
/**
* The severity level of a log message
*/
...
...
src/vs/workbench/api/electron-browser/mainThreadDebugService.ts
浏览文件 @
81142e2c
...
...
@@ -148,7 +148,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
});
}
public
$registerDebugConfigurationProvider
(
debugType
:
string
,
hasProvide
:
boolean
,
hasResolve
:
boolean
,
handle
:
number
):
TPromise
<
void
>
{
public
$registerDebugConfigurationProvider
(
debugType
:
string
,
hasProvide
:
boolean
,
hasResolve
:
boolean
,
ha
sDebugAdapterExecutable
:
boolean
,
ha
ndle
:
number
):
TPromise
<
void
>
{
const
provider
=
<
IDebugConfigurationProvider
>
{
type
:
debugType
...
...
@@ -163,6 +163,11 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
return
this
.
_proxy
.
$resolveDebugConfiguration
(
handle
,
folder
,
debugConfiguration
);
};
}
if
(
hasDebugAdapterExecutable
)
{
provider
.
debugAdapterExecutable
=
(
folder
)
=>
{
return
this
.
_proxy
.
$debugAdapterExecutable
(
handle
,
folder
);
};
}
this
.
debugService
.
getConfigurationManager
().
registerDebugConfigurationProvider
(
handle
,
provider
);
return
TPromise
.
wrap
<
void
>
(
undefined
);
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
81142e2c
...
...
@@ -576,6 +576,7 @@ export function createApiFactory(
CompletionItemKind
:
extHostTypes
.
CompletionItemKind
,
CompletionList
:
extHostTypes
.
CompletionList
,
CompletionTriggerKind
:
extHostTypes
.
CompletionTriggerKind
,
DebugAdapterExecutable
:
extHostTypes
.
DebugAdapterExecutable
,
Diagnostic
:
extHostTypes
.
Diagnostic
,
DiagnosticSeverity
:
extHostTypes
.
DiagnosticSeverity
,
Disposable
:
extHostTypes
.
Disposable
,
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
81142e2c
...
...
@@ -24,7 +24,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
IConfigurationData
,
ConfigurationTarget
,
IConfigurationModel
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfig
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IConfig
,
IAdapterExecutable
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IPickOpenEntry
,
IPickOptions
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
SaveReason
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
...
...
@@ -437,7 +437,7 @@ export interface MainThreadSCMShape extends IDisposable {
export
type
DebugSessionUUID
=
string
;
export
interface
MainThreadDebugServiceShape
extends
IDisposable
{
$registerDebugConfigurationProvider
(
type
:
string
,
hasProvideMethod
:
boolean
,
hasResolveMethod
:
boolean
,
handle
:
number
):
TPromise
<
any
>
;
$registerDebugConfigurationProvider
(
type
:
string
,
hasProvideMethod
:
boolean
,
hasResolveMethod
:
boolean
,
ha
sDebugAdapterExecutable
:
boolean
,
ha
ndle
:
number
):
TPromise
<
any
>
;
$unregisterDebugConfigurationProvider
(
handle
:
number
):
TPromise
<
any
>
;
$startDebugging
(
folder
:
UriComponents
|
undefined
,
nameOrConfig
:
string
|
vscode
.
DebugConfiguration
):
TPromise
<
boolean
>
;
$customDebugAdapterRequest
(
id
:
DebugSessionUUID
,
command
:
string
,
args
:
any
):
TPromise
<
any
>
;
...
...
@@ -742,6 +742,7 @@ export interface ISourceMultiBreakpointDto {
export
interface
ExtHostDebugServiceShape
{
$resolveDebugConfiguration
(
handle
:
number
,
folder
:
UriComponents
|
undefined
,
debugConfiguration
:
IConfig
):
TPromise
<
IConfig
>
;
$provideDebugConfigurations
(
handle
:
number
,
folder
:
UriComponents
|
undefined
):
TPromise
<
IConfig
[]
>
;
$debugAdapterExecutable
(
handle
:
number
,
folder
:
UriComponents
|
undefined
):
TPromise
<
IAdapterExecutable
>
;
$acceptDebugSessionStarted
(
id
:
DebugSessionUUID
,
type
:
string
,
name
:
string
):
void
;
$acceptDebugSessionTerminated
(
id
:
DebugSessionUUID
,
type
:
string
,
name
:
string
):
void
;
$acceptDebugSessionActiveChanged
(
id
:
DebugSessionUUID
|
undefined
,
type
?:
string
,
name
?:
string
):
void
;
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
81142e2c
...
...
@@ -263,7 +263,10 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
let
handle
=
this
.
nextHandle
();
this
.
_handlers
.
set
(
handle
,
provider
);
this
.
_debugServiceProxy
.
$registerDebugConfigurationProvider
(
type
,
!!
provider
.
provideDebugConfigurations
,
!!
provider
.
resolveDebugConfiguration
,
handle
);
this
.
_debugServiceProxy
.
$registerDebugConfigurationProvider
(
type
,
!!
provider
.
provideDebugConfigurations
,
!!
provider
.
resolveDebugConfiguration
,
!!
provider
.
debugAdapterExecutable
,
handle
);
return
new
Disposable
(()
=>
{
this
.
_handlers
.
delete
(
handle
);
...
...
@@ -293,6 +296,17 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return
asWinJsPromise
(
token
=>
handler
.
resolveDebugConfiguration
(
this
.
getFolder
(
folderUri
),
debugConfiguration
,
token
));
}
public
$debugAdapterExecutable
(
handle
:
number
,
folderUri
:
UriComponents
|
undefined
):
TPromise
<
vscode
.
DebugAdapterExecutable
>
{
let
handler
=
this
.
_handlers
.
get
(
handle
);
if
(
!
handler
)
{
return
TPromise
.
wrapError
<
vscode
.
DebugAdapterExecutable
>
(
new
Error
(
'
no handler found
'
));
}
if
(
!
handler
.
debugAdapterExecutable
)
{
return
TPromise
.
wrapError
<
vscode
.
DebugAdapterExecutable
>
(
new
Error
(
'
handler has no method debugAdapterExecutable
'
));
}
return
asWinJsPromise
(
token
=>
handler
.
debugAdapterExecutable
(
this
.
getFolder
(
folderUri
),
token
));
}
public
startDebugging
(
folder
:
vscode
.
WorkspaceFolder
|
undefined
,
nameOrConfig
:
string
|
vscode
.
DebugConfiguration
):
TPromise
<
boolean
>
{
return
this
.
_debugServiceProxy
.
$startDebugging
(
folder
?
folder
.
uri
:
undefined
,
nameOrConfig
);
}
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
81142e2c
...
...
@@ -1610,6 +1610,16 @@ export class FunctionBreakpoint extends Breakpoint {
}
}
export
class
DebugAdapterExecutable
implements
vscode
.
DebugAdapterExecutable
{
readonly
command
:
string
;
readonly
args
:
string
[];
constructor
(
command
:
string
,
args
?:
string
[])
{
this
.
command
=
command
;
this
.
args
=
args
;
}
}
export
enum
LogLevel
{
Trace
=
1
,
Debug
=
2
,
...
...
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
81142e2c
...
...
@@ -402,6 +402,7 @@ export interface IDebugConfigurationProvider {
handle
:
number
;
resolveDebugConfiguration
?(
folderUri
:
uri
|
undefined
,
debugConfiguration
:
IConfig
):
TPromise
<
IConfig
>
;
provideDebugConfigurations
?(
folderUri
:
uri
|
undefined
):
TPromise
<
IConfig
[]
>
;
debugAdapterExecutable
(
folderUri
:
uri
|
undefined
):
TPromise
<
IAdapterExecutable
>
;
}
export
interface
IConfigurationManager
{
...
...
@@ -428,7 +429,9 @@ export interface IConfigurationManager {
registerDebugConfigurationProvider
(
handle
:
number
,
debugConfigurationProvider
:
IDebugConfigurationProvider
):
void
;
unregisterDebugConfigurationProvider
(
handle
:
number
):
void
;
resolveConfigurationByProviders
(
folderUri
:
uri
|
undefined
,
type
:
string
|
undefined
,
debugConfiguration
:
any
):
TPromise
<
any
>
;
debugAdapterExecutable
(
folderUri
:
uri
|
undefined
,
type
:
string
):
TPromise
<
IAdapterExecutable
>
|
undefined
;
}
export
interface
ILaunch
{
...
...
src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts
浏览文件 @
81142e2c
...
...
@@ -27,7 +27,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IWorkspaceContextService
,
IWorkspaceFolder
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IDebugConfigurationProvider
,
IRawAdapter
,
ICompound
,
IDebugConfiguration
,
IConfig
,
IEnvConfig
,
IGlobalConfig
,
IConfigurationManager
,
ILaunch
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IDebugConfigurationProvider
,
IRawAdapter
,
ICompound
,
IDebugConfiguration
,
IConfig
,
IEnvConfig
,
IGlobalConfig
,
IConfigurationManager
,
ILaunch
,
IAdapterExecutable
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
Adapter
}
from
'
vs/workbench/parts/debug/node/debugAdapter
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
...
...
@@ -291,6 +291,14 @@ export class ConfigurationManager implements IConfigurationManager {
.
then
(
results
=>
results
.
reduce
((
first
,
second
)
=>
first
.
concat
(
second
),
[]));
}
public
debugAdapterExecutable
(
folderUri
:
uri
|
undefined
,
type
:
string
):
TPromise
<
IAdapterExecutable
>
|
undefined
{
const
providers
=
this
.
providers
.
filter
(
p
=>
p
.
type
===
type
&&
p
.
debugAdapterExecutable
);
if
(
providers
.
length
===
1
)
{
return
providers
[
0
].
debugAdapterExecutable
(
folderUri
);
}
return
undefined
;
}
private
registerListeners
(
lifecycleService
:
ILifecycleService
):
void
{
debuggersExtPoint
.
setHandler
((
extensions
)
=>
{
extensions
.
forEach
(
extension
=>
{
...
...
@@ -308,7 +316,7 @@ export class ConfigurationManager implements IConfigurationManager {
if
(
duplicate
)
{
duplicate
.
merge
(
rawAdapter
,
extension
.
description
);
}
else
{
this
.
adapters
.
push
(
new
Adapter
(
rawAdapter
,
extension
.
description
,
this
.
configurationService
,
this
.
commandService
));
this
.
adapters
.
push
(
new
Adapter
(
this
,
rawAdapter
,
extension
.
description
,
this
.
configurationService
,
this
.
commandService
));
}
});
});
...
...
src/vs/workbench/parts/debug/node/debugAdapter.ts
浏览文件 @
81142e2c
...
...
@@ -13,14 +13,14 @@ import * as paths from 'vs/base/common/paths';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
IJSONSchema
,
IJSONSchemaSnippet
}
from
'
vs/base/common/jsonSchema
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfig
,
IRawAdapter
,
IAdapterExecutable
,
INTERNAL_CONSOLE_OPTIONS_SCHEMA
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IConfig
,
IRawAdapter
,
IAdapterExecutable
,
INTERNAL_CONSOLE_OPTIONS_SCHEMA
,
IConfigurationManager
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
export
class
Adapter
{
constructor
(
private
rawAdapter
:
IRawAdapter
,
public
extensionDescription
:
IExtensionDescription
,
constructor
(
private
configurationManager
:
IConfigurationManager
,
private
rawAdapter
:
IRawAdapter
,
public
extensionDescription
:
IExtensionDescription
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
ICommandService
private
commandService
:
ICommandService
)
{
...
...
@@ -33,12 +33,24 @@ export class Adapter {
public
getAdapterExecutable
(
root
:
IWorkspaceFolder
,
verifyAgainstFS
=
true
):
TPromise
<
IAdapterExecutable
>
{
// start with extension API
if
(
this
.
configurationManager
)
{
const
adapterExecutablePromise
=
this
.
configurationManager
.
debugAdapterExecutable
(
root
.
uri
,
this
.
rawAdapter
.
type
);
if
(
adapterExecutablePromise
)
{
return
adapterExecutablePromise
.
then
(
adapterExecutable
=>
{
return
this
.
verifyAdapterDetails
(
adapterExecutable
,
verifyAgainstFS
);
});
}
}
// try deprecated command based extension API
if
(
this
.
rawAdapter
.
adapterExecutableCommand
&&
root
)
{
return
this
.
commandService
.
executeCommand
<
IAdapterExecutable
>
(
this
.
rawAdapter
.
adapterExecutableCommand
,
root
.
uri
.
toString
()).
then
(
ad
=>
{
return
this
.
verifyAdapterDetails
(
ad
,
verifyAgainstFS
);
});
}
// old style: executable contribution specified in package.json
const
adapterExecutable
=
<
IAdapterExecutable
>
{
command
:
this
.
getProgram
(),
args
:
this
.
getAttributeBasedOnPlatform
(
'
args
'
)
...
...
src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts
浏览文件 @
81142e2c
...
...
@@ -43,7 +43,7 @@ suite('Debug - Adapter', () => {
};
setup
(()
=>
{
adapter
=
new
Adapter
(
rawAdapter
,
{
extensionFolderPath
,
id
:
'
adapter
'
,
name
:
'
myAdapter
'
,
version
:
'
1.0.0
'
,
publisher
:
'
vscode
'
,
isBuiltin
:
false
,
engines
:
null
},
adapter
=
new
Adapter
(
null
,
rawAdapter
,
{
extensionFolderPath
,
id
:
'
adapter
'
,
name
:
'
myAdapter
'
,
version
:
'
1.0.0
'
,
publisher
:
'
vscode
'
,
isBuiltin
:
false
,
engines
:
null
},
new
TestConfigurationService
(),
null
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录