Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
a684fe7e
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,发现更多精彩内容 >>
提交
a684fe7e
编写于
12月 13, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
screencast mode
上级
ae49b191
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
77 addition
and
32 deletion
+77
-32
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+75
-30
src/vs/workbench/electron-browser/main.contribution.ts
src/vs/workbench/electron-browser/main.contribution.ts
+2
-2
未找到文件。
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
a684fe7e
...
...
@@ -29,7 +29,7 @@ import { FileKind } from 'vs/platform/files/common/files';
import
{
IssueType
}
from
'
vs/platform/issue/common/issue
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
,
toDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
toDisposable
,
dispose
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
getDomNodePagePosition
,
createStyleSheet
,
createCSSRule
,
append
,
$
}
from
'
vs/base/browser/dom
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Context
}
from
'
vs/platform/contextkey/browser/contextKeyService
'
;
...
...
@@ -41,6 +41,8 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IQuickInputService
,
IQuickPickItem
,
IQuickInputButton
,
IQuickPickSeparator
,
IKeyMods
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
getIconClasses
}
from
'
vs/editor/common/services/getIconClasses
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
// --- actions
...
...
@@ -1304,60 +1306,103 @@ export class InspectContextKeysAction extends Action {
}
}
export
class
Toggle
MouseClicks
Action
extends
Action
{
export
class
Toggle
ScreencastMode
Action
extends
Action
{
static
readonly
ID
=
'
workbench.action.toggle
MouseClicks
'
;
static
LABEL
=
nls
.
localize
(
'
toggle mouse clicks
'
,
"
Toggle
Mouse Clicks
"
);
static
readonly
ID
=
'
workbench.action.toggle
ScreencastMode
'
;
static
LABEL
=
nls
.
localize
(
'
toggle mouse clicks
'
,
"
Toggle
Screencast Mode
"
);
static
disposable
:
IDisposable
|
undefined
;
constructor
(
id
:
string
,
label
:
string
)
{
constructor
(
id
:
string
,
label
:
string
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
if
(
Toggle
MouseClicks
Action
.
disposable
)
{
Toggle
MouseClicks
Action
.
disposable
.
dispose
();
Toggle
MouseClicks
Action
.
disposable
=
undefined
;
if
(
Toggle
ScreencastMode
Action
.
disposable
)
{
Toggle
ScreencastMode
Action
.
disposable
.
dispose
();
Toggle
ScreencastMode
Action
.
disposable
=
undefined
;
return
;
}
const
m
arker
=
append
(
document
.
body
,
$
(
'
.marker
'
));
marker
.
style
.
position
=
'
absolute
'
;
marker
.
style
.
border
=
'
2px solid red
'
;
marker
.
style
.
borderRadius
=
'
20px
'
;
marker
.
style
.
width
=
'
20px
'
;
marker
.
style
.
height
=
'
20px
'
;
marker
.
style
.
top
=
'
0
'
;
marker
.
style
.
left
=
'
0
'
;
marker
.
style
.
zIndex
=
'
100000
'
;
marker
.
style
.
content
=
'
'
;
marker
.
style
.
pointerEvents
=
'
none
'
;
marker
.
style
.
display
=
'
none
'
;
const
m
ouseMarker
=
append
(
document
.
body
,
$
(
'
div
'
));
m
ouseM
arker
.
style
.
position
=
'
absolute
'
;
m
ouseM
arker
.
style
.
border
=
'
2px solid red
'
;
m
ouseM
arker
.
style
.
borderRadius
=
'
20px
'
;
m
ouseM
arker
.
style
.
width
=
'
20px
'
;
m
ouseM
arker
.
style
.
height
=
'
20px
'
;
m
ouseM
arker
.
style
.
top
=
'
0
'
;
m
ouseM
arker
.
style
.
left
=
'
0
'
;
m
ouseM
arker
.
style
.
zIndex
=
'
100000
'
;
m
ouseM
arker
.
style
.
content
=
'
'
;
m
ouseM
arker
.
style
.
pointerEvents
=
'
none
'
;
m
ouseM
arker
.
style
.
display
=
'
none
'
;
const
onMouseDown
=
domEvent
(
document
.
body
,
'
mousedown
'
,
true
);
const
onMouseUp
=
domEvent
(
document
.
body
,
'
mouseup
'
,
true
);
const
onMouseMove
=
domEvent
(
document
.
body
,
'
mousemove
'
,
true
);
const
l
istener
=
onMouseDown
(
e
=>
{
marker
.
style
.
top
=
`
${
e
.
clientY
-
10
}
px`
;
marker
.
style
.
left
=
`
${
e
.
clientX
-
10
}
px`
;
marker
.
style
.
display
=
'
block
'
;
const
mouseL
istener
=
onMouseDown
(
e
=>
{
m
ouseM
arker
.
style
.
top
=
`
${
e
.
clientY
-
10
}
px`
;
m
ouseM
arker
.
style
.
left
=
`
${
e
.
clientX
-
10
}
px`
;
m
ouseM
arker
.
style
.
display
=
'
block
'
;
const
mouseMoveListener
=
onMouseMove
(
e
=>
{
marker
.
style
.
top
=
`
${
e
.
clientY
-
10
}
px`
;
marker
.
style
.
left
=
`
${
e
.
clientX
-
10
}
px`
;
m
ouseM
arker
.
style
.
top
=
`
${
e
.
clientY
-
10
}
px`
;
m
ouseM
arker
.
style
.
left
=
`
${
e
.
clientX
-
10
}
px`
;
});
Event
.
once
(
onMouseUp
)(()
=>
{
marker
.
style
.
display
=
'
none
'
;
m
ouseM
arker
.
style
.
display
=
'
none
'
;
mouseMoveListener
.
dispose
();
});
});
ToggleMouseClicksAction
.
disposable
=
toDisposable
(()
=>
{
listener
.
dispose
();
document
.
body
.
removeChild
(
marker
);
const
keyboardMarker
=
append
(
document
.
body
,
$
(
'
div
'
));
keyboardMarker
.
style
.
position
=
'
absolute
'
;
keyboardMarker
.
style
.
backgroundColor
=
'
rgba(0, 0, 0 ,0.5)
'
;
keyboardMarker
.
style
.
width
=
'
100%
'
;
keyboardMarker
.
style
.
height
=
'
100px
'
;
keyboardMarker
.
style
.
bottom
=
'
20%
'
;
keyboardMarker
.
style
.
left
=
'
0
'
;
keyboardMarker
.
style
.
zIndex
=
'
100000
'
;
keyboardMarker
.
style
.
pointerEvents
=
'
none
'
;
keyboardMarker
.
style
.
color
=
'
white
'
;
keyboardMarker
.
style
.
lineHeight
=
'
100px
'
;
keyboardMarker
.
style
.
textAlign
=
'
center
'
;
keyboardMarker
.
style
.
fontSize
=
'
56px
'
;
keyboardMarker
.
style
.
display
=
'
none
'
;
const
onKeyDown
=
domEvent
(
document
.
body
,
'
keydown
'
,
true
);
let
keyboardTimeout
:
IDisposable
=
Disposable
.
None
;
const
keyboardListener
=
onKeyDown
(
e
=>
{
keyboardTimeout
.
dispose
();
const
event
=
new
StandardKeyboardEvent
(
e
);
const
keybinding
=
this
.
keybindingService
.
resolveKeyboardEvent
(
event
);
const
label
=
keybinding
.
getLabel
();
if
(
!
event
.
ctrlKey
&&
!
event
.
altKey
&&
!
event
.
metaKey
&&
!
event
.
shiftKey
&&
this
.
keybindingService
.
mightProducePrintableCharacter
(
event
)
&&
label
)
{
keyboardMarker
.
textContent
+=
'
'
+
label
;
}
else
{
keyboardMarker
.
textContent
=
label
;
}
keyboardMarker
.
style
.
display
=
'
block
'
;
const
promise
=
timeout
(
800
);
keyboardTimeout
=
toDisposable
(()
=>
promise
.
cancel
());
promise
.
then
(()
=>
{
keyboardMarker
.
textContent
=
''
;
keyboardMarker
.
style
.
display
=
'
none
'
;
});
});
ToggleScreencastModeAction
.
disposable
=
toDisposable
(()
=>
{
mouseListener
.
dispose
();
keyboardListener
.
dispose
();
document
.
body
.
removeChild
(
mouseMarker
);
});
}
}
src/vs/workbench/electron-browser/main.contribution.ts
浏览文件 @
a684fe7e
...
...
@@ -12,7 +12,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
import
{
IWorkbenchActionRegistry
,
Extensions
}
from
'
vs/workbench/common/actions
'
;
import
{
KeyMod
,
KeyChord
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
isWindows
,
isLinux
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
KeybindingsReferenceAction
,
OpenDocumentationUrlAction
,
OpenIntroductoryVideosUrlAction
,
OpenTipsAndTricksUrlAction
,
OpenIssueReporterAction
,
ReportPerformanceIssueUsingReporterAction
,
ZoomResetAction
,
ZoomOutAction
,
ZoomInAction
,
ToggleFullScreenAction
,
ToggleMenuBarAction
,
CloseWorkspaceAction
,
CloseCurrentWindowAction
,
SwitchWindow
,
NewWindowAction
,
NavigateUpAction
,
NavigateDownAction
,
NavigateLeftAction
,
NavigateRightAction
,
IncreaseViewSizeAction
,
DecreaseViewSizeAction
,
ToggleSharedProcessAction
,
QuickSwitchWindow
,
QuickOpenRecentAction
,
inRecentFilesPickerContextKey
,
ShowAboutDialogAction
,
InspectContextKeysAction
,
OpenProcessExplorer
,
OpenTwitterUrlAction
,
OpenRequestFeatureUrlAction
,
OpenPrivacyStatementUrlAction
,
OpenLicenseUrlAction
,
OpenRecentAction
,
Toggle
MouseClicks
Action
}
from
'
vs/workbench/electron-browser/actions
'
;
import
{
KeybindingsReferenceAction
,
OpenDocumentationUrlAction
,
OpenIntroductoryVideosUrlAction
,
OpenTipsAndTricksUrlAction
,
OpenIssueReporterAction
,
ReportPerformanceIssueUsingReporterAction
,
ZoomResetAction
,
ZoomOutAction
,
ZoomInAction
,
ToggleFullScreenAction
,
ToggleMenuBarAction
,
CloseWorkspaceAction
,
CloseCurrentWindowAction
,
SwitchWindow
,
NewWindowAction
,
NavigateUpAction
,
NavigateDownAction
,
NavigateLeftAction
,
NavigateRightAction
,
IncreaseViewSizeAction
,
DecreaseViewSizeAction
,
ToggleSharedProcessAction
,
QuickSwitchWindow
,
QuickOpenRecentAction
,
inRecentFilesPickerContextKey
,
ShowAboutDialogAction
,
InspectContextKeysAction
,
OpenProcessExplorer
,
OpenTwitterUrlAction
,
OpenRequestFeatureUrlAction
,
OpenPrivacyStatementUrlAction
,
OpenLicenseUrlAction
,
OpenRecentAction
,
Toggle
ScreencastMode
Action
}
from
'
vs/workbench/electron-browser/actions
'
;
import
{
registerCommands
,
QUIT_ID
}
from
'
vs/workbench/electron-browser/commands
'
;
import
{
AddRootFolderAction
,
GlobalRemoveRootFolderAction
,
OpenWorkspaceAction
,
SaveWorkspaceAsAction
,
OpenWorkspaceConfigFileAction
,
DuplicateWorkspaceInNewWindowAction
,
OpenFileFolderAction
,
OpenFileAction
,
OpenFolderAction
}
from
'
vs/workbench/browser/actions/workspaceActions
'
;
import
{
ContextKeyExpr
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -126,7 +126,7 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
const
developerCategory
=
nls
.
localize
(
'
developer
'
,
"
Developer
"
);
workbenchActionsRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ToggleSharedProcessAction
,
ToggleSharedProcessAction
.
ID
,
ToggleSharedProcessAction
.
LABEL
),
'
Developer: Toggle Shared Process
'
,
developerCategory
);
workbenchActionsRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
InspectContextKeysAction
,
InspectContextKeysAction
.
ID
,
InspectContextKeysAction
.
LABEL
),
'
Developer: Inspect Context Keys
'
,
developerCategory
);
workbenchActionsRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
Toggle
MouseClicksAction
,
ToggleMouseClicksAction
.
ID
,
ToggleMouseClicks
Action
.
LABEL
),
'
Developer: Toggle Mouse Clicks
'
,
developerCategory
);
workbenchActionsRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
Toggle
ScreencastModeAction
,
ToggleScreencastModeAction
.
ID
,
ToggleScreencastMode
Action
.
LABEL
),
'
Developer: Toggle Mouse Clicks
'
,
developerCategory
);
workbenchActionsRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
OpenProcessExplorer
,
OpenProcessExplorer
.
ID
,
OpenProcessExplorer
.
LABEL
),
'
Developer: Open Process Explorer
'
,
developerCategory
);
const
recentFilesPickerContext
=
ContextKeyExpr
.
and
(
inQuickOpenContext
,
ContextKeyExpr
.
has
(
inRecentFilesPickerContextKey
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录