Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
291c8e58
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,发现更多精彩内容 >>
提交
291c8e58
编写于
6月 22, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow editor.hover to be an object
上级
f3159128
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
96 addition
and
17 deletion
+96
-17
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+5
-0
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+49
-8
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+18
-4
src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts
...h/parts/debug/electron-browser/debugEditorContribution.ts
+24
-5
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
291c8e58
...
...
@@ -294,6 +294,11 @@ const editorConfiguration: IConfigurationNode = {
'
default
'
:
EDITOR_DEFAULTS
.
viewInfo
.
minimap
.
maxColumn
,
'
description
'
:
nls
.
localize
(
'
minimap.maxColumn
'
,
"
Limit the width of the minimap to render at most a certain number of columns
"
)
},
'
editor.hover.enabled
'
:
{
'
type
'
:
'
boolean
'
,
'
default
'
:
EDITOR_DEFAULTS
.
contribInfo
.
hover
.
enabled
,
'
description
'
:
nls
.
localize
(
'
hover.enabled
'
,
"
Controls if the hover is shown
"
)
},
'
editor.find.seedSearchStringFromSelection
'
:
{
'
type
'
:
'
boolean
'
,
'
default
'
:
EDITOR_DEFAULTS
.
contribInfo
.
find
.
seedSearchStringFromSelection
,
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
291c8e58
...
...
@@ -137,6 +137,17 @@ export interface IEditorLightbulbOptions {
enabled
?:
boolean
;
}
/**
* Configuration options for editor hover
*/
export
interface
IEditorHoverOptions
{
/**
* Enable the hover.
* Defaults to true.
*/
enabled
?:
boolean
;
}
/**
* Configuration map for codeActionsOnSave
*/
...
...
@@ -367,10 +378,9 @@ export interface IEditorOptions {
*/
stopRenderingLineAfter
?:
number
;
/**
* Enable hover.
* Defaults to true.
* Configure the editor's hover.
*/
hover
?:
boolean
;
hover
?:
boolean
|
IEditorHoverOptions
;
/**
* Enable detecting links and making them clickable.
* Defaults to true.
...
...
@@ -804,6 +814,10 @@ export interface InternalEditorFindOptions {
readonly
globalFindClipboard
:
boolean
;
}
export
interface
InternalEditorHoverOptions
{
readonly
enabled
:
boolean
;
}
export
interface
EditorWrappingInfo
{
readonly
inDiffEditor
:
boolean
;
readonly
isDominatedByLongLines
:
boolean
;
...
...
@@ -859,7 +873,7 @@ export interface InternalEditorViewOptions {
export
interface
EditorContribOptions
{
readonly
selectionClipboard
:
boolean
;
readonly
hover
:
boolean
;
readonly
hover
:
InternalEditorHoverOptions
;
readonly
links
:
boolean
;
readonly
contextmenu
:
boolean
;
readonly
quickSuggestions
:
boolean
|
{
other
:
boolean
,
comments
:
boolean
,
strings
:
boolean
};
...
...
@@ -1181,7 +1195,6 @@ export class InternalEditorOptions {
/**
* @internal
*/
private
static
_equalFindOptions
(
a
:
InternalEditorFindOptions
,
b
:
InternalEditorFindOptions
):
boolean
{
return
(
a
.
seedSearchStringFromSelection
===
b
.
seedSearchStringFromSelection
...
...
@@ -1190,6 +1203,15 @@ export class InternalEditorOptions {
);
}
/**
* @internal
*/
private
static
_equalsHoverOptions
(
a
:
InternalEditorHoverOptions
,
b
:
InternalEditorHoverOptions
):
boolean
{
return
(
a
.
enabled
===
b
.
enabled
);
}
/**
* @internal
*/
...
...
@@ -1213,7 +1235,7 @@ export class InternalEditorOptions {
private
static
_equalsContribOptions
(
a
:
EditorContribOptions
,
b
:
EditorContribOptions
):
boolean
{
return
(
a
.
selectionClipboard
===
b
.
selectionClipboard
&&
a
.
hover
===
b
.
hover
&&
this
.
_equalsHoverOptions
(
a
.
hover
,
b
.
hover
)
&&
a
.
links
===
b
.
links
&&
a
.
contextmenu
===
b
.
contextmenu
&&
InternalEditorOptions
.
_equalsQuickSuggestions
(
a
.
quickSuggestions
,
b
.
quickSuggestions
)
...
...
@@ -1659,6 +1681,23 @@ export class EditorOptionsValidator {
};
}
private
static
_santizeHoverOpts
(
_opts
:
boolean
|
IEditorHoverOptions
,
defaults
:
InternalEditorHoverOptions
):
InternalEditorHoverOptions
{
let
opts
:
IEditorHoverOptions
;
if
(
typeof
_opts
===
'
boolean
'
)
{
opts
=
{
enabled
:
_opts
};
}
else
if
(
typeof
_opts
===
'
object
'
)
{
opts
=
_opts
;
}
else
{
return
defaults
;
}
return
{
enabled
:
_boolean
(
opts
.
enabled
,
defaults
.
enabled
)
};
}
private
static
_sanitizeViewInfo
(
opts
:
IEditorOptions
,
defaults
:
InternalEditorViewOptions
):
InternalEditorViewOptions
{
let
rulers
:
number
[]
=
[];
...
...
@@ -1777,7 +1816,7 @@ export class EditorOptionsValidator {
const
find
=
this
.
_santizeFindOpts
(
opts
.
find
,
defaults
.
find
);
return
{
selectionClipboard
:
_boolean
(
opts
.
selectionClipboard
,
defaults
.
selectionClipboard
),
hover
:
_boolean
(
opts
.
hover
,
defaults
.
hover
),
hover
:
this
.
_santizeHoverOpts
(
opts
.
hover
,
defaults
.
hover
),
links
:
_boolean
(
opts
.
links
,
defaults
.
links
),
contextmenu
:
_boolean
(
opts
.
contextmenu
,
defaults
.
contextmenu
),
quickSuggestions
:
quickSuggestions
,
...
...
@@ -2352,7 +2391,9 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
contribInfo
:
{
selectionClipboard
:
true
,
hover
:
true
,
hover
:
{
enabled
:
true
},
links
:
true
,
contextmenu
:
true
,
quickSuggestions
:
{
other
:
true
,
comments
:
false
,
strings
:
false
},
...
...
src/vs/monaco.d.ts
浏览文件 @
291c8e58
...
...
@@ -2487,6 +2487,17 @@ declare namespace monaco.editor {
enabled
?:
boolean
;
}
/**
* Configuration options for editor hover
*/
export
interface
IEditorHoverOptions
{
/**
* Enable the hover.
* Defaults to true.
*/
enabled
?:
boolean
;
}
/**
* Configuration map for codeActionsOnSave
*/
...
...
@@ -2705,10 +2716,9 @@ declare namespace monaco.editor {
*/
stopRenderingLineAfter
?:
number
;
/**
* Enable hover.
* Defaults to true.
* Configure the editor's hover.
*/
hover
?:
boolean
;
hover
?:
boolean
|
IEditorHoverOptions
;
/**
* Enable detecting links and making them clickable.
* Defaults to true.
...
...
@@ -3083,6 +3093,10 @@ declare namespace monaco.editor {
readonly
autoFindInSelection
:
boolean
;
}
export
interface
InternalEditorHoverOptions
{
readonly
enabled
:
boolean
;
}
export
interface
EditorWrappingInfo
{
readonly
inDiffEditor
:
boolean
;
readonly
isDominatedByLongLines
:
boolean
;
...
...
@@ -3138,7 +3152,7 @@ declare namespace monaco.editor {
export
interface
EditorContribOptions
{
readonly
selectionClipboard
:
boolean
;
readonly
hover
:
boolean
;
readonly
hover
:
InternalEditorHoverOptions
;
readonly
links
:
boolean
;
readonly
contextmenu
:
boolean
;
readonly
quickSuggestions
:
boolean
|
{
...
...
src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts
浏览文件 @
291c8e58
...
...
@@ -21,12 +21,12 @@ import { DEFAULT_WORD_REGEXP } from 'vs/editor/common/model/wordHelper';
import
{
ICodeEditor
,
IEditorMouseEvent
,
MouseTargetType
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IDecorationOptions
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelDecorationOptions
,
IModelDeltaDecoration
,
TrackedRangeStickiness
}
from
'
vs/editor/common/model
'
;
import
{
IModelDecorationOptions
,
IModelDeltaDecoration
,
TrackedRangeStickiness
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
,
IConfigurationOverrides
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
...
...
@@ -262,7 +262,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
this
.
toDispose
.
push
(
this
.
editor
.
onDidChangeModel
(()
=>
{
const
stackFrame
=
this
.
debugService
.
getViewModel
().
focusedStackFrame
;
const
model
=
this
.
editor
.
getModel
();
this
.
editor
.
updateOptions
({
hover
:
!
stackFrame
||
!
model
||
model
.
uri
.
toString
()
!==
stackFrame
.
source
.
uri
.
toString
()
}
);
this
.
_applyHoverConfiguration
(
model
,
stackFrame
);
this
.
closeBreakpointWidget
();
this
.
toggleExceptionWidget
();
this
.
hideHoverWidget
();
...
...
@@ -278,6 +278,26 @@ export class DebugEditorContribution implements IDebugEditorContribution {
}));
}
private
_applyHoverConfiguration
(
model
:
ITextModel
,
stackFrame
:
IStackFrame
):
void
{
if
(
stackFrame
&&
model
&&
model
.
uri
.
toString
()
===
stackFrame
.
source
.
uri
.
toString
())
{
this
.
editor
.
updateOptions
({
hover
:
!
stackFrame
||
!
model
||
model
.
uri
.
toString
()
!==
stackFrame
.
source
.
uri
.
toString
()
});
}
else
{
let
overrides
:
IConfigurationOverrides
;
if
(
model
)
{
overrides
=
{
resource
:
model
.
uri
,
overrideIdentifier
:
model
.
getLanguageIdentifier
().
language
};
}
const
defaultConfiguration
=
this
.
configurationService
.
getValue
(
'
editor.hover
'
,
overrides
);
this
.
editor
.
updateOptions
({
hover
:
defaultConfiguration
});
}
}
public
getId
():
string
{
return
EDITOR_CONTRIBUTION_ID
;
}
...
...
@@ -323,11 +343,10 @@ export class DebugEditorContribution implements IDebugEditorContribution {
private
onFocusStackFrame
(
sf
:
IStackFrame
):
void
{
const
model
=
this
.
editor
.
getModel
();
this
.
_applyHoverConfiguration
(
model
,
sf
);
if
(
model
&&
sf
&&
sf
.
source
.
uri
.
toString
()
===
model
.
uri
.
toString
())
{
this
.
editor
.
updateOptions
({
hover
:
false
});
this
.
toggleExceptionWidget
();
}
else
{
this
.
editor
.
updateOptions
({
hover
:
true
});
this
.
hideHoverWidget
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录