Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e6079bd1
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,发现更多精彩内容 >>
提交
e6079bd1
编写于
11月 04, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #105614.
上级
373ea1b9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
65 addition
and
6 deletion
+65
-6
src/vs/editor/contrib/colorPicker/colorContributions.ts
src/vs/editor/contrib/colorPicker/colorContributions.ts
+59
-0
src/vs/editor/contrib/colorPicker/colorDetector.ts
src/vs/editor/contrib/colorPicker/colorDetector.ts
+5
-5
src/vs/editor/editor.all.ts
src/vs/editor/editor.all.ts
+1
-1
未找到文件。
src/vs/editor/contrib/colorPicker/colorContributions.ts
0 → 100644
浏览文件 @
e6079bd1
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// import color detector contribution
import
'
vs/editor/contrib/colorPicker/colorDetector
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ICodeEditor
,
IEditorMouseEvent
,
MouseTargetType
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ModesHoverController
}
from
'
vs/editor/contrib/hover/hover
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
HoverStartMode
}
from
'
vs/editor/contrib/hover/hoverOperation
'
;
export
class
ColorContribution
extends
Disposable
implements
IEditorContribution
{
public
static
readonly
ID
:
string
=
'
editor.contrib.colorContribution
'
;
static
readonly
RECOMPUTE_TIME
=
1000
;
// ms
constructor
(
private
readonly
_editor
:
ICodeEditor
,
)
{
super
();
this
.
_register
(
_editor
.
onMouseDown
((
e
)
=>
this
.
onMouseDown
(
e
)));
}
dispose
():
void
{
super
.
dispose
();
}
private
onMouseDown
(
mouseEvent
:
IEditorMouseEvent
)
{
const
targetType
=
mouseEvent
.
target
.
type
;
if
(
targetType
!==
MouseTargetType
.
CONTENT_TEXT
)
{
return
;
}
console
.
log
(
mouseEvent
.
target
);
const
hoverOnColorDecorator
=
[...
mouseEvent
.
target
.
element
?.
classList
.
values
()
||
[]].
find
(
className
=>
className
.
startsWith
(
'
ced-colorBox
'
));
if
(
!
hoverOnColorDecorator
)
{
return
;
}
if
(
!
mouseEvent
.
target
.
range
)
{
return
;
}
const
hoverController
=
this
.
_editor
.
getContribution
<
ModesHoverController
>
(
ModesHoverController
.
ID
);
if
(
!
hoverController
.
contentWidget
.
isColorPickerVisible
())
{
const
range
=
new
Range
(
mouseEvent
.
target
.
range
.
startLineNumber
,
mouseEvent
.
target
.
range
.
startColumn
+
1
,
mouseEvent
.
target
.
range
.
endLineNumber
,
mouseEvent
.
target
.
range
.
endColumn
+
1
);
hoverController
.
showContentHover
(
range
,
HoverStartMode
.
Delayed
,
false
);
}
}
}
registerEditorContribution
(
ColorContribution
.
ID
,
ColorContribution
);
src/vs/editor/contrib/colorPicker/colorDetector.ts
浏览文件 @
e6079bd1
...
...
@@ -46,13 +46,13 @@ export class ColorDetector extends Disposable implements IEditorContribution {
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
)
{
super
();
this
.
_register
(
_editor
.
onDidChangeModel
((
e
)
=>
{
this
.
_register
(
_editor
.
onDidChangeModel
(()
=>
{
this
.
_isEnabled
=
this
.
isEnabled
();
this
.
onModelChanged
();
}));
this
.
_register
(
_editor
.
onDidChangeModelLanguage
((
e
)
=>
this
.
onModelChanged
()));
this
.
_register
(
ColorProviderRegistry
.
onDidChange
((
e
)
=>
this
.
onModelChanged
()));
this
.
_register
(
_editor
.
onDidChangeConfiguration
((
e
)
=>
{
this
.
_register
(
_editor
.
onDidChangeModelLanguage
(()
=>
this
.
onModelChanged
()));
this
.
_register
(
ColorProviderRegistry
.
onDidChange
(()
=>
this
.
onModelChanged
()));
this
.
_register
(
_editor
.
onDidChangeConfiguration
(()
=>
{
let
prevIsEnabled
=
this
.
_isEnabled
;
this
.
_isEnabled
=
this
.
isEnabled
();
if
(
prevIsEnabled
!==
this
.
_isEnabled
)
{
...
...
@@ -110,7 +110,7 @@ export class ColorDetector extends Disposable implements IEditorContribution {
return
;
}
this
.
_localToDispose
.
add
(
this
.
_editor
.
onDidChangeModelContent
((
e
)
=>
{
this
.
_localToDispose
.
add
(
this
.
_editor
.
onDidChangeModelContent
(()
=>
{
if
(
!
this
.
_timeoutTimer
)
{
this
.
_timeoutTimer
=
new
TimeoutTimer
();
this
.
_timeoutTimer
.
cancelAndSet
(()
=>
{
...
...
src/vs/editor/editor.all.ts
浏览文件 @
e6079bd1
...
...
@@ -14,7 +14,7 @@ import 'vs/editor/contrib/caretOperations/transpose';
import
'
vs/editor/contrib/clipboard/clipboard
'
;
import
'
vs/editor/contrib/codeAction/codeActionContributions
'
;
import
'
vs/editor/contrib/codelens/codelensController
'
;
import
'
vs/editor/contrib/colorPicker/color
Detector
'
;
import
'
vs/editor/contrib/colorPicker/color
Contributions
'
;
import
'
vs/editor/contrib/comment/comment
'
;
import
'
vs/editor/contrib/contextmenu/contextmenu
'
;
import
'
vs/editor/contrib/cursorUndo/cursorUndo
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录