Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
49ef020f
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,发现更多精彩内容 >>
提交
49ef020f
编写于
2月 21, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug start view: debugStartLanguage context key
fixes #85548
上级
68a10136
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
17 deletion
+21
-17
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
...kbench/contrib/debug/browser/debugConfigurationManager.ts
+2
-10
src/vs/workbench/contrib/debug/browser/startView.ts
src/vs/workbench/contrib/debug/browser/startView.ts
+18
-6
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+1
-1
未找到文件。
src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts
浏览文件 @
49ef020f
...
...
@@ -11,7 +11,6 @@ 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
'
;
...
...
@@ -434,15 +433,8 @@ 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
[];
isDebuggerInterestedInLanguage
(
language
:
string
):
boolean
{
return
this
.
debuggers
.
filter
(
a
=>
language
&&
a
.
languages
&&
a
.
languages
.
indexOf
(
language
)
>=
0
).
length
>
0
;
}
async
guessDebugger
(
type
?:
string
):
Promise
<
Debugger
|
undefined
>
{
...
...
src/vs/workbench/contrib/debug/browser/startView.ts
浏览文件 @
49ef020f
...
...
@@ -21,14 +21,17 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import
{
WorkbenchStateContext
}
from
'
vs/workbench/browser/contextkeys
'
;
import
{
OpenFolderAction
,
OpenFileAction
,
OpenFileFolderAction
}
from
'
vs/workbench/browser/actions/workspaceActions
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
const
CONTEXT_DEBUGGER_INTERESTED
=
new
RawContextKey
<
boolean
>
(
'
debuggerInterested
'
,
false
);
const
CONTEXT_DEBUG_START_LANGUAGE
=
new
RawContextKey
<
string
>
(
'
debugStartLanguage
'
,
undefined
);
const
CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR
=
new
RawContextKey
<
boolean
>
(
'
debuggerInterestedInActiveEditor
'
,
false
);
export
class
StartView
extends
ViewPane
{
static
ID
=
'
workbench.debug.startView
'
;
static
LABEL
=
localize
(
'
start
'
,
"
Start
"
);
private
debugStartLanguageContext
:
IContextKey
<
string
>
;
private
debuggerInterestedContext
:
IContextKey
<
boolean
>
;
constructor
(
...
...
@@ -46,11 +49,20 @@ export class StartView extends ViewPane {
)
{
super
({
...(
options
as
IViewPaneOptions
),
ariaHeaderLabel
:
localize
(
'
debugStart
'
,
"
Debug Start Section
"
)
},
keybindingService
,
contextMenuService
,
configurationService
,
contextKeyService
,
viewDescriptorService
,
instantiationService
,
openerService
,
themeService
);
this
.
debuggerInterestedContext
=
CONTEXT_DEBUGGER_INTERESTED
.
bindTo
(
contextKeyService
);
this
.
debugStartLanguageContext
=
CONTEXT_DEBUG_START_LANGUAGE
.
bindTo
(
contextKeyService
);
this
.
debuggerInterestedContext
=
CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR
.
bindTo
(
contextKeyService
);
const
setContextKey
=
()
=>
{
const
activeEditor
=
this
.
editorService
.
activeTextEditorWidget
;
const
debuggerLabels
=
this
.
debugService
.
getConfigurationManager
().
getDebuggerLabelsForEditor
(
activeEditor
);
this
.
debuggerInterestedContext
.
set
(
debuggerLabels
.
length
>
0
);
const
editor
=
this
.
editorService
.
activeTextEditorWidget
;
if
(
isCodeEditor
(
editor
))
{
const
model
=
editor
.
getModel
();
const
language
=
model
?
model
.
getLanguageIdentifier
().
language
:
undefined
;
if
(
language
&&
this
.
debugService
.
getConfigurationManager
().
isDebuggerInterestedInLanguage
(
language
))
{
this
.
debugStartLanguageContext
.
set
(
language
);
this
.
debuggerInterestedContext
.
set
(
true
);
return
;
}
}
this
.
debuggerInterestedContext
.
set
(
false
);
};
this
.
_register
(
editorService
.
onDidActiveEditorChange
(
setContextKey
));
this
.
_register
(
this
.
debugService
.
getConfigurationManager
().
onDidRegisterDebugger
(
setContextKey
));
...
...
@@ -64,7 +76,7 @@ export class StartView extends ViewPane {
const
viewsRegistry
=
Registry
.
as
<
IViewsRegistry
>
(
Extensions
.
ViewsRegistry
);
viewsRegistry
.
registerViewWelcomeContent
(
StartView
.
ID
,
{
content
:
localize
(
'
openAFileWhichCanBeDebugged
'
,
"
[Open a file](command:{0}) which can be debugged or run.
"
,
isMacintosh
?
OpenFileFolderAction
.
ID
:
OpenFileAction
.
ID
),
when
:
CONTEXT_DEBUGGER_INTERESTED
.
toNegated
()
when
:
CONTEXT_DEBUGGER_INTERESTED
_IN_ACTIVE_EDITOR
});
viewsRegistry
.
registerViewWelcomeContent
(
StartView
.
ID
,
{
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
49ef020f
...
...
@@ -647,7 +647,7 @@ export interface IConfigurationManager {
activateDebuggers
(
activationEvent
:
string
,
debugType
?:
string
):
Promise
<
void
>
;
getDebuggerLabelsForEditor
(
editor
:
editorCommon
.
IEditor
|
undefined
):
string
[]
;
isDebuggerInterestedInLanguage
(
language
:
string
):
boolean
;
hasDebugConfigurationProvider
(
debugType
:
string
):
boolean
;
registerDebugConfigurationProvider
(
debugConfigurationProvider
:
IDebugConfigurationProvider
):
IDisposable
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录