Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b8b1b243
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,发现更多精彩内容 >>
提交
b8b1b243
编写于
3月 10, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quick access - debug picker
上级
b0791e52
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
147 addition
and
16 deletion
+147
-16
src/vs/editor/contrib/quickAccess/gotoLine.ts
src/vs/editor/contrib/quickAccess/gotoLine.ts
+3
-3
src/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.ts
...lone/browser/quickAccess/standaloneGotoLineQuickAccess.ts
+2
-2
src/vs/platform/quickinput/browser/helpQuickAccess.ts
src/vs/platform/quickinput/browser/helpQuickAccess.ts
+2
-0
src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.ts
...rib/codeEditor/browser/quickaccess/gotoLineQuickAccess.ts
+2
-2
src/vs/workbench/contrib/debug/browser/debug.contribution.ts
src/vs/workbench/contrib/debug/browser/debug.contribution.ts
+10
-0
src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts
src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts
+120
-0
src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts
...bench/contrib/extensions/browser/extensionsQuickAccess.ts
+0
-1
src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.ts
...h/contrib/quickaccess/browser/quickAccess.contribution.ts
+5
-5
src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts
.../workbench/contrib/quickaccess/browser/viewQuickAccess.ts
+3
-3
未找到文件。
src/vs/editor/contrib/quickAccess/gotoLine.ts
浏览文件 @
b8b1b243
...
...
@@ -16,12 +16,12 @@ import { withNullAsUndefined } from 'vs/base/common/types';
import
{
AbstractEditorQuickAccessProvider
}
from
'
vs/editor/contrib/quickAccess/quickAccess
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
export
const
GOTO_LINE_PREFIX
=
'
:
'
;
interface
IGotoLineQuickPickItem
extends
IQuickPickItem
,
Partial
<
IPosition
>
{
}
export
abstract
class
AbstractGotoLineQuickAccessProvider
extends
AbstractEditorQuickAccessProvider
{
static
PREFIX
=
'
:
'
;
provide
(
picker
:
IQuickPick
<
IGotoLineQuickPickItem
>
,
token
:
CancellationToken
):
IDisposable
{
const
disposables
=
new
DisposableStore
();
...
...
@@ -88,7 +88,7 @@ export abstract class AbstractGotoLineQuickAccessProvider extends AbstractEditor
// React to picker changes
const
updatePickerAndEditor
=
()
=>
{
const
position
=
this
.
parsePosition
(
editor
,
picker
.
value
.
trim
().
substr
(
GOTO_LINE_
PREFIX
.
length
));
const
position
=
this
.
parsePosition
(
editor
,
picker
.
value
.
trim
().
substr
(
AbstractGotoLineQuickAccessProvider
.
PREFIX
.
length
));
const
label
=
this
.
getPickLabel
(
editor
,
position
.
lineNumber
,
position
.
column
);
// Picker
...
...
src/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.ts
浏览文件 @
b8b1b243
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
AbstractGotoLineQuickAccessProvider
,
GOTO_LINE_PREFIX
}
from
'
vs/editor/contrib/quickAccess/gotoLine
'
;
import
{
AbstractGotoLineQuickAccessProvider
}
from
'
vs/editor/contrib/quickAccess/gotoLine
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IQuickAccessRegistry
,
Extensions
}
from
'
vs/platform/quickinput/common/quickAccess
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
...
...
@@ -26,6 +26,6 @@ export class StandaloneGotoLineQuickAccessProvider extends AbstractGotoLineQuick
Registry
.
as
<
IQuickAccessRegistry
>
(
Extensions
.
Quickaccess
).
registerQuickAccessProvider
({
ctor
:
StandaloneGotoLineQuickAccessProvider
,
prefix
:
GOTO_LINE_
PREFIX
,
prefix
:
AbstractGotoLineQuickAccessProvider
.
PREFIX
,
helpEntries
:
[{
description
:
GoToLineNLS
.
gotoLineActionLabel
,
needsEditor
:
true
}]
});
src/vs/platform/quickinput/browser/helpQuickAccess.ts
浏览文件 @
b8b1b243
...
...
@@ -16,6 +16,8 @@ interface IHelpQuickAccessPickItem extends IQuickPickItem {
export
class
HelpQuickAccessProvider
implements
IQuickAccessProvider
{
static
PREFIX
=
'
?
'
;
private
readonly
registry
=
Registry
.
as
<
IQuickAccessRegistry
>
(
Extensions
.
Quickaccess
);
constructor
(@
IQuickInputService
private
readonly
quickInputService
:
IQuickInputService
)
{
}
...
...
src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.ts
浏览文件 @
b8b1b243
...
...
@@ -8,7 +8,7 @@ import { IKeyMods } from 'vs/platform/quickinput/common/quickInput';
import
{
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
AbstractGotoLineQuickAccessProvider
,
GOTO_LINE_PREFIX
}
from
'
vs/editor/contrib/quickAccess/gotoLine
'
;
import
{
AbstractGotoLineQuickAccessProvider
}
from
'
vs/editor/contrib/quickAccess/gotoLine
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IQuickAccessRegistry
,
Extensions
}
from
'
vs/platform/quickinput/common/quickAccess
'
;
...
...
@@ -40,7 +40,7 @@ export class GotoLineQuickAccessProvider extends AbstractGotoLineQuickAccessProv
Registry
.
as
<
IQuickAccessRegistry
>
(
Extensions
.
Quickaccess
).
registerQuickAccessProvider
({
ctor
:
GotoLineQuickAccessProvider
,
prefix
:
GOTO_LINE_
PREFIX
,
prefix
:
AbstractGotoLineQuickAccessProvider
.
PREFIX
,
placeholder
:
localize
(
'
gotoLineQuickAccessPlaceholder
'
,
"
Type the line number and optional column to go to (e.g. 42:5 for line 42 and column 5).
"
),
helpEntries
:
[{
description
:
localize
(
'
gotoLineQuickAccess
'
,
"
Go to Line
"
),
needsEditor
:
true
}]
});
src/vs/workbench/contrib/debug/browser/debug.contribution.ts
浏览文件 @
b8b1b243
...
...
@@ -52,6 +52,8 @@ import { CallStackEditorContribution } from 'vs/workbench/contrib/debug/browser/
import
{
BreakpointEditorContribution
}
from
'
vs/workbench/contrib/debug/browser/breakpointEditorContribution
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
ViewPaneContainer
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
import
{
IQuickAccessRegistry
,
Extensions
as
QuickAccessExtensions
}
from
'
vs/platform/quickinput/common/quickAccess
'
;
import
{
StartDebugQuickAccessProvider
}
from
'
vs/workbench/contrib/debug/browser/debugQuickAccess
'
;
class
OpenDebugViewletAction
extends
ShowViewletAction
{
public
static
readonly
ID
=
VIEWLET_ID
;
...
...
@@ -173,6 +175,14 @@ registerDebugCommandPaletteItem(TOGGLE_INLINE_BREAKPOINT_ID, nls.localize('inlin
)
);
// Register Quick Access
Registry
.
as
<
IQuickAccessRegistry
>
(
QuickAccessExtensions
.
Quickaccess
).
registerQuickAccessProvider
({
ctor
:
StartDebugQuickAccessProvider
,
prefix
:
StartDebugQuickAccessProvider
.
PREFIX
,
placeholder
:
nls
.
localize
(
'
startDebugPlaceholder
'
,
"
Type the name of a launch configuration to run.
"
),
helpEntries
:
[{
description
:
nls
.
localize
(
'
startDebugHelp
'
,
"
Start Debug Configurations
"
),
needsEditor
:
false
}]
});
// register service
registerSingleton
(
IDebugService
,
service
.
DebugService
);
...
...
src/vs/workbench/contrib/debug/browser/debugQuickAccess.ts
0 → 100644
浏览文件 @
b8b1b243
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IQuickPick
,
IQuickPickItem
,
IQuickPickSeparator
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
IQuickAccessProvider
}
from
'
vs/platform/quickinput/common/quickAccess
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
DisposableStore
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IDebugService
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
matchesFuzzy
}
from
'
vs/base/common/filters
'
;
import
{
StartAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
interface
IDebugQuickPickItem
extends
IQuickPickItem
{
run
:
()
=>
Promise
<
unknown
>
;
}
export
class
StartDebugQuickAccessProvider
implements
IQuickAccessProvider
{
static
PREFIX
=
'
debug
'
;
constructor
(
@
IDebugService
private
readonly
debugService
:
IDebugService
,
@
IWorkspaceContextService
private
readonly
contextService
:
IWorkspaceContextService
,
@
ICommandService
private
readonly
commandService
:
ICommandService
,
@
INotificationService
private
readonly
notificationService
:
INotificationService
)
{
}
provide
(
picker
:
IQuickPick
<
IDebugQuickPickItem
>
,
token
:
CancellationToken
):
IDisposable
{
const
disposables
=
new
DisposableStore
();
// Disable filtering & sorting, we control the results
picker
.
matchOnLabel
=
picker
.
matchOnDescription
=
picker
.
matchOnDetail
=
picker
.
sortByLabel
=
false
;
// Add all view items & filter on type
const
updatePickerItems
=
()
=>
picker
.
items
=
this
.
getDebugPickItems
(
picker
.
value
.
trim
().
substr
(
StartDebugQuickAccessProvider
.
PREFIX
.
length
));
disposables
.
add
(
picker
.
onDidChangeValue
(()
=>
updatePickerItems
()));
updatePickerItems
();
// Open extensions view on accept
disposables
.
add
(
picker
.
onDidAccept
(()
=>
{
const
[
item
]
=
picker
.
selectedItems
;
if
(
item
)
{
picker
.
hide
();
item
.
run
();
}
}));
return
disposables
;
}
private
getDebugPickItems
(
value
:
string
):
Array
<
IDebugQuickPickItem
|
IQuickPickSeparator
>
{
const
picks
:
Array
<
IDebugQuickPickItem
|
IQuickPickSeparator
>
=
[];
const
configManager
=
this
.
debugService
.
getConfigurationManager
();
// Entries: configs
let
lastGroup
:
string
|
undefined
;
for
(
let
config
of
configManager
.
getAllConfigurations
())
{
const
highlights
=
matchesFuzzy
(
value
,
config
.
name
,
true
);
if
(
highlights
)
{
// Separator
if
(
lastGroup
!==
config
.
presentation
?.
group
)
{
picks
.
push
({
type
:
'
separator
'
});
lastGroup
=
config
.
presentation
?.
group
;
}
// Launch entry
picks
.
push
({
label
:
config
.
name
,
ariaLabel
:
localize
(
'
entryAriaLabel
'
,
"
{0}, debug
"
,
config
.
name
),
description
:
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
?
config
.
launch
.
name
:
''
,
highlights
:
{
label
:
highlights
},
run
:
async
()
=>
{
if
(
StartAction
.
isEnabled
(
this
.
debugService
))
{
this
.
debugService
.
getConfigurationManager
().
selectConfiguration
(
config
.
launch
,
config
.
name
);
try
{
await
this
.
debugService
.
startDebugging
(
config
.
launch
);
}
catch
(
error
)
{
this
.
notificationService
.
error
(
error
);
}
}
}
});
}
}
// Entries: launches
const
visibleLaunches
=
configManager
.
getLaunches
().
filter
(
launch
=>
!
launch
.
hidden
);
// Separator
if
(
visibleLaunches
.
length
>
0
)
{
picks
.
push
({
type
:
'
separator
'
});
}
for
(
const
launch
of
visibleLaunches
)
{
const
label
=
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
?
localize
(
"
addConfigTo
"
,
"
Add Config ({0})...
"
,
launch
.
name
)
:
localize
(
'
addConfiguration
'
,
"
Add Configuration...
"
);
// Add Config entry
picks
.
push
({
label
,
ariaLabel
:
localize
(
'
entryAriaLabel
'
,
"
{0}, debug
"
,
label
),
description
:
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
?
launch
.
name
:
''
,
highlights
:
{
label
:
withNullAsUndefined
(
matchesFuzzy
(
value
,
label
,
true
))
},
run
:
async
()
=>
this
.
commandService
.
executeCommand
(
'
debug.addConfiguration
'
,
launch
.
uri
.
toString
())
});
}
return
picks
;
}
}
src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts
浏览文件 @
b8b1b243
...
...
@@ -181,4 +181,3 @@ async function openExtensionsViewlet(viewletService: IViewletService, search = '
view
?.
search
(
search
);
view
?.
focus
();
}
src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.ts
浏览文件 @
b8b1b243
...
...
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
import
{
IQuickAccessRegistry
,
Extensions
}
from
'
vs/platform/quickinput/common/quickAccess
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
HelpQuickAccessProvider
}
from
'
vs/platform/quickinput/browser/helpQuickAccess
'
;
import
{
ViewQuickAccessProvider
,
VIEW_QUICK_ACCESS_PREFIX
}
from
'
vs/workbench/contrib/quickaccess/browser/viewQuickAccess
'
;
import
{
ViewQuickAccessProvider
}
from
'
vs/workbench/contrib/quickaccess/browser/viewQuickAccess
'
;
import
{
QUICK_ACCESS_COMMAND_ID
}
from
'
vs/workbench/contrib/quickaccess/browser/quickAccessCommands
'
;
import
{
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
...
...
@@ -16,20 +16,20 @@ const registry = Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess);
registry
.
defaultProvider
=
{
ctor
:
HelpQuickAccessProvider
,
prefix
:
''
,
placeholder
:
localize
(
'
helpQuickAccessPlaceholder
'
,
"
Type '?' to get help on the actions you can take from here
.
"
),
placeholder
:
localize
(
'
defaultAccessPlaceholder
'
,
"
Type the name of a file to open
.
"
),
helpEntries
:
[{
description
:
localize
(
'
gotoFileQuickAccess
'
,
"
Go to File
"
),
needsEditor
:
false
}]
};
registry
.
registerQuickAccessProvider
({
ctor
:
HelpQuickAccessProvider
,
prefix
:
'
?
'
,
placeholder
:
localize
(
'
helpQuickAccessPlaceholder
'
,
"
Type '
?' to get help on the actions you can take from here.
"
),
prefix
:
HelpQuickAccessProvider
.
PREFIX
,
placeholder
:
localize
(
'
helpQuickAccessPlaceholder
'
,
"
Type '
{0}' to get help on the actions you can take from here.
"
,
HelpQuickAccessProvider
.
PREFIX
),
helpEntries
:
[{
description
:
localize
(
'
helpQuickAccess
'
,
"
Show all Quick Access Providers
"
),
needsEditor
:
false
}]
});
registry
.
registerQuickAccessProvider
({
ctor
:
ViewQuickAccessProvider
,
prefix
:
V
IEW_QUICK_ACCESS_
PREFIX
,
prefix
:
V
iewQuickAccessProvider
.
PREFIX
,
placeholder
:
localize
(
'
viewQuickAccessPlaceholder
'
,
"
Type the name of a view, output channel or terminal to open.
"
),
helpEntries
:
[{
description
:
localize
(
'
viewQuickAccess
'
,
"
Open View
"
),
needsEditor
:
false
}]
});
...
...
src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.ts
浏览文件 @
b8b1b243
...
...
@@ -20,8 +20,6 @@ import { matchesFuzzy } from 'vs/base/common/filters';
import
{
fuzzyContains
}
from
'
vs/base/common/strings
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
export
const
VIEW_QUICK_ACCESS_PREFIX
=
'
view
'
;
interface
IViewQuickPickItem
extends
IQuickPickItem
{
containerLabel
:
string
;
run
:
()
=>
Promise
<
unknown
>
;
...
...
@@ -29,6 +27,8 @@ interface IViewQuickPickItem extends IQuickPickItem {
export
class
ViewQuickAccessProvider
implements
IQuickAccessProvider
{
static
PREFIX
=
'
view
'
;
constructor
(
@
IViewletService
private
readonly
viewletService
:
IViewletService
,
@
IViewDescriptorService
private
readonly
viewDescriptorService
:
IViewDescriptorService
,
...
...
@@ -47,7 +47,7 @@ export class ViewQuickAccessProvider implements IQuickAccessProvider {
picker
.
matchOnLabel
=
picker
.
matchOnDescription
=
picker
.
matchOnDetail
=
picker
.
sortByLabel
=
false
;
// Add all view items & filter on type
const
updatePickerItems
=
()
=>
picker
.
items
=
this
.
getViewPickItems
(
picker
.
value
.
trim
().
substr
(
V
IEW_QUICK_ACCESS_
PREFIX
.
length
));
const
updatePickerItems
=
()
=>
picker
.
items
=
this
.
getViewPickItems
(
picker
.
value
.
trim
().
substr
(
V
iewQuickAccessProvider
.
PREFIX
.
length
));
disposables
.
add
(
picker
.
onDidChangeValue
(()
=>
updatePickerItems
()));
updatePickerItems
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录