Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
dbcaa1df
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,发现更多精彩内容 >>
提交
dbcaa1df
编写于
11月 27, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: fine tune start experience
#84677
上级
1ba624b7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
112 addition
and
14 deletion
+112
-14
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
...kbench/contrib/debug/browser/debugConfigurationManager.ts
+18
-0
src/vs/workbench/contrib/debug/browser/media/debugViewlet.css
...vs/workbench/contrib/debug/browser/media/debugViewlet.css
+4
-0
src/vs/workbench/contrib/debug/browser/startView.ts
src/vs/workbench/contrib/debug/browser/startView.ts
+84
-11
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+6
-3
未找到文件。
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
浏览文件 @
dbcaa1df
...
...
@@ -11,6 +11,7 @@ import * as objects from 'vs/base/common/objects';
import
{
URI
as
uri
}
from
'
vs/base/common/uri
'
;
import
*
as
resources
from
'
vs/base/common/resources
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
...
...
@@ -56,6 +57,7 @@ export class ConfigurationManager implements IConfigurationManager {
private
adapterDescriptorFactories
:
IDebugAdapterDescriptorFactory
[];
private
debugAdapterFactories
=
new
Map
<
string
,
IDebugAdapterFactory
>
();
private
debugConfigurationTypeContext
:
IContextKey
<
string
>
;
private
readonly
_onDidRegisterDebugger
=
new
Emitter
<
void
>
();
constructor
(
@
IWorkspaceContextService
private
readonly
contextService
:
IWorkspaceContextService
,
...
...
@@ -166,6 +168,10 @@ export class ConfigurationManager implements IConfigurationManager {
return
Promise
.
resolve
(
undefined
);
}
get
onDidRegisterDebugger
():
Event
<
void
>
{
return
this
.
_onDidRegisterDebugger
.
event
;
}
// debug configurations
registerDebugConfigurationProvider
(
debugConfigurationProvider
:
IDebugConfigurationProvider
):
IDisposable
{
...
...
@@ -266,6 +272,7 @@ export class ConfigurationManager implements IConfigurationManager {
});
this
.
setCompoundSchemaValues
();
this
.
_onDidRegisterDebugger
.
fire
();
});
breakpointsExtPoint
.
setHandler
((
extensions
,
delta
)
=>
{
...
...
@@ -388,6 +395,17 @@ export class ConfigurationManager implements IConfigurationManager {
return
this
.
debuggers
.
filter
(
dbg
=>
strings
.
equalsIgnoreCase
(
dbg
.
type
,
type
)).
pop
();
}
getDebuggerLabelsForEditor
(
editor
:
editorCommon
.
IEditor
|
undefined
):
string
[]
{
if
(
isCodeEditor
(
editor
))
{
const
model
=
editor
.
getModel
();
const
language
=
model
?
model
.
getLanguageIdentifier
().
language
:
undefined
;
return
this
.
debuggers
.
filter
(
a
=>
language
&&
a
.
languages
&&
a
.
languages
.
indexOf
(
language
)
>=
0
).
map
(
d
=>
d
.
label
);
}
return
[];
}
async
guessDebugger
(
type
?:
string
):
Promise
<
Debugger
|
undefined
>
{
if
(
type
)
{
const
adapter
=
this
.
getDebugger
(
type
);
...
...
src/vs/workbench/contrib/debug/browser/media/debugViewlet.css
浏览文件 @
dbcaa1df
...
...
@@ -22,6 +22,10 @@
margin-top
:
20px
;
}
.debug-viewlet
.debug-start-view
.top-section
{
margin-top
:
10px
;
}
.debug-viewlet
.debug-start-view
.configure
{
cursor
:
pointer
;
color
:
#007ACC
;
...
...
src/vs/workbench/contrib/debug/browser/startView.ts
浏览文件 @
dbcaa1df
...
...
@@ -16,6 +16,11 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import
{
localize
}
from
'
vs/nls
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
StartAction
,
RunAction
,
ConfigureAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
IDebugService
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IFileDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
const
$
=
dom
.
$
;
...
...
@@ -26,6 +31,9 @@ export class StartView extends ViewletPane {
private
debugButton
!
:
Button
;
private
runButton
!
:
Button
;
private
firstMessageContainer
!
:
HTMLElement
;
private
secondMessageContainer
!
:
HTMLElement
;
private
debuggerLabels
:
string
[]
|
undefined
=
undefined
;
constructor
(
options
:
IViewletViewOptions
,
...
...
@@ -34,14 +42,84 @@ export class StartView extends ViewletPane {
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
ICommandService
private
readonly
commandService
:
ICommandService
@
ICommandService
private
readonly
commandService
:
ICommandService
,
@
IDebugService
private
readonly
debugService
:
IDebugService
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
IWorkspaceContextService
private
readonly
workspaceContextService
:
IWorkspaceContextService
,
@
IFileDialogService
private
readonly
dialogService
:
IFileDialogService
)
{
super
({
...(
options
as
IViewletPaneOptions
),
ariaHeaderLabel
:
localize
(
'
debugStart
'
,
"
Debug Start Section
"
)
},
keybindingService
,
contextMenuService
,
configurationService
,
contextKeyService
);
this
.
_register
(
editorService
.
onDidActiveEditorChange
(()
=>
this
.
updateView
()));
this
.
_register
(
this
.
debugService
.
getConfigurationManager
().
onDidRegisterDebugger
(()
=>
this
.
updateView
()));
}
private
updateView
():
void
{
const
activeEditor
=
this
.
editorService
.
activeTextEditorWidget
;
const
debuggerLabels
=
this
.
debugService
.
getConfigurationManager
().
getDebuggerLabelsForEditor
(
activeEditor
);
if
(
!
equals
(
this
.
debuggerLabels
,
debuggerLabels
))
{
this
.
debuggerLabels
=
debuggerLabels
;
const
enabled
=
this
.
debuggerLabels
.
length
>
0
;
this
.
debugButton
.
enabled
=
enabled
;
this
.
runButton
.
enabled
=
enabled
;
this
.
debugButton
.
label
=
this
.
debuggerLabels
.
length
!==
1
?
localize
(
'
debug
'
,
"
Debug
"
)
:
localize
(
'
debugWith
'
,
"
Debug with {0}
"
,
this
.
debuggerLabels
[
0
]);
this
.
runButton
.
label
=
this
.
debuggerLabels
.
length
!==
1
?
localize
(
'
run
'
,
"
Run
"
)
:
localize
(
'
runWith
'
,
"
Run with {0}
"
,
this
.
debuggerLabels
[
0
]);
const
emptyWorkbench
=
this
.
workspaceContextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
;
this
.
firstMessageContainer
.
innerHTML
=
''
;
this
.
secondMessageContainer
.
innerHTML
=
''
;
const
secondMessageElement
=
$
(
'
span
'
);
this
.
secondMessageContainer
.
appendChild
(
secondMessageElement
);
const
setFirstMessage
=
()
=>
{
const
firstMessageElement
=
$
(
'
span
'
);
this
.
firstMessageContainer
.
appendChild
(
firstMessageElement
);
firstMessageElement
.
textContent
=
localize
(
'
simplyDebugAndRun
'
,
"
Open a file which can be debugged or run.
"
);
};
const
setSecondMessage
=
()
=>
{
secondMessageElement
.
textContent
=
localize
(
'
specifyHowToRun
'
,
"
To futher configure the Debug and Run experience
"
);
const
clickElement
=
$
(
'
span.configure
'
);
clickElement
.
textContent
=
localize
(
'
configure
'
,
"
create a launch.json file.
"
);
clickElement
.
onclick
=
()
=>
this
.
commandService
.
executeCommand
(
ConfigureAction
.
ID
);
this
.
secondMessageContainer
.
appendChild
(
clickElement
);
};
const
setSecondMessageWithFolder
=
()
=>
{
secondMessageElement
.
textContent
=
localize
(
'
noLaunchConfiguration
'
,
"
To futher configure the Debug and Run experience,
"
);
const
clickElement
=
$
(
'
span.configure
'
);
clickElement
.
textContent
=
localize
(
'
openFolder
'
,
"
open a folder
"
);
clickElement
.
onclick
=
()
=>
this
.
dialogService
.
pickFolderAndOpen
({
forceNewWindow
:
false
});
this
.
secondMessageContainer
.
appendChild
(
clickElement
);
const
moreText
=
$
(
'
span.moreText
'
);
moreText
.
textContent
=
localize
(
'
andconfigure
'
,
"
and create a launch.json file.
"
);
this
.
secondMessageContainer
.
appendChild
(
moreText
);
};
if
(
enabled
&&
!
emptyWorkbench
)
{
setSecondMessage
();
}
if
(
enabled
&&
emptyWorkbench
)
{
setSecondMessageWithFolder
();
}
if
(
!
enabled
&&
!
emptyWorkbench
)
{
setFirstMessage
();
setSecondMessage
();
}
if
(
!
enabled
&&
emptyWorkbench
)
{
setFirstMessage
();
setSecondMessageWithFolder
();
}
}
}
protected
renderBody
(
container
:
HTMLElement
):
void
{
this
.
firstMessageContainer
=
$
(
'
.top-section
'
);
container
.
appendChild
(
this
.
firstMessageContainer
);
this
.
debugButton
=
new
Button
(
container
);
this
.
debugButton
.
label
=
localize
(
'
debug
'
,
"
Debug
"
);
this
.
_register
(
this
.
debugButton
.
onDidClick
(()
=>
{
this
.
commandService
.
executeCommand
(
StartAction
.
ID
);
}));
...
...
@@ -56,15 +134,10 @@ export class StartView extends ViewletPane {
}));
attachButtonStyler
(
this
.
runButton
,
this
.
themeService
);
const
messageContainer
=
$
(
'
.section
'
);
container
.
appendChild
(
messageContainer
);
const
messageElement
=
$
(
'
span
'
);
messageContainer
.
appendChild
(
messageElement
);
messageElement
.
textContent
=
localize
(
'
noLaunchConfiguration
'
,
"
To specify how to run and debug your code,
"
);
const
clickElement
=
$
(
'
span.configure
'
);
clickElement
.
textContent
=
localize
(
'
configure
'
,
"
create a launch.json file.
"
);
clickElement
.
onclick
=
()
=>
this
.
commandService
.
executeCommand
(
ConfigureAction
.
ID
);
messageContainer
.
appendChild
(
clickElement
);
this
.
secondMessageContainer
=
$
(
'
.section
'
);
container
.
appendChild
(
this
.
secondMessageContainer
);
this
.
updateView
();
}
protected
layoutBody
(
_
:
number
,
__
:
number
):
void
{
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
dbcaa1df
...
...
@@ -9,7 +9,7 @@ import severity from 'vs/base/common/severity';
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IJSONSchemaSnippet
}
from
'
vs/base/common/jsonSchema
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextModel
as
EditorIModel
}
from
'
vs/editor/common/model
'
;
import
{
IEditor
,
ITextEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
Position
,
IPosition
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -630,8 +630,11 @@ export interface IConfigurationManager {
*/
onDidSelectConfiguration
:
Event
<
void
>
;
onDidRegisterDebugger
:
Event
<
void
>
;
activateDebuggers
(
activationEvent
:
string
,
debugType
?:
string
):
Promise
<
void
>
;
getDebuggerLabelsForEditor
(
editor
:
editorCommon
.
IEditor
|
undefined
):
string
[];
hasDebugConfigurationProvider
(
debugType
:
string
):
boolean
;
registerDebugConfigurationProvider
(
debugConfigurationProvider
:
IDebugConfigurationProvider
):
IDisposable
;
...
...
@@ -863,12 +866,12 @@ export const enum BreakpointWidgetContext {
LOG_MESSAGE
=
2
}
export
interface
IDebugEditorContribution
extends
IEditorContribution
{
export
interface
IDebugEditorContribution
extends
editorCommon
.
IEditorContribution
{
showHover
(
range
:
Range
,
focus
:
boolean
):
Promise
<
void
>
;
addLaunchConfiguration
():
Promise
<
any
>
;
}
export
interface
IBreakpointEditorContribution
extends
IEditorContribution
{
export
interface
IBreakpointEditorContribution
extends
editorCommon
.
IEditorContribution
{
showBreakpointWidget
(
lineNumber
:
number
,
column
:
number
|
undefined
,
context
?:
BreakpointWidgetContext
):
void
;
closeBreakpointWidget
():
void
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录