Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fa2e9d17
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,发现更多精彩内容 >>
提交
fa2e9d17
编写于
3月 16, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make quickSuggest-setting differentiate between comment, string, and other, #9504
上级
b2092325
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
77 addition
and
14 deletion
+77
-14
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+25
-3
src/vs/editor/common/config/defaultConfig.ts
src/vs/editor/common/config/defaultConfig.ts
+1
-1
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+5
-5
src/vs/editor/contrib/suggest/common/suggestModel.ts
src/vs/editor/contrib/suggest/common/suggestModel.ts
+36
-3
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+10
-2
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
fa2e9d17
...
...
@@ -301,7 +301,7 @@ class InternalEditorOptionsHelper {
selectionClipboard
:
toBoolean
(
opts
.
selectionClipboard
),
hover
:
toBoolean
(
opts
.
hover
),
contextmenu
:
toBoolean
(
opts
.
contextmenu
),
quickSuggestions
:
toBoolean
(
opts
.
quickSuggestions
),
quickSuggestions
:
t
ypeof
opts
.
quickSuggestions
===
'
object
'
?
{
other
:
true
,
...
opts
.
quickSuggestions
}
:
t
oBoolean
(
opts
.
quickSuggestions
),
quickSuggestionsDelay
:
toInteger
(
opts
.
quickSuggestionsDelay
),
parameterHints
:
toBoolean
(
opts
.
parameterHints
),
iconsInSuggestions
:
toBoolean
(
opts
.
iconsInSuggestions
),
...
...
@@ -723,9 +723,31 @@ const editorConfiguration: IConfigurationNode = {
'
description
'
:
nls
.
localize
(
'
mouseWheelScrollSensitivity
'
,
"
A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events
"
)
},
'
editor.quickSuggestions
'
:
{
'
type
'
:
'
boolean
'
,
'
anyOf
'
:
[
'
boolean
'
,
{
type
:
'
object
'
,
properties
:
{
strings
:
{
type
:
'
boolean
'
,
default
:
false
,
description
:
nls
.
localize
(
'
quickSuggestions.strings
'
,
"
Enable quick suggestions inside strings.
"
)
},
comments
:
{
type
:
'
boolean
'
,
default
:
false
,
description
:
nls
.
localize
(
'
quickSuggestions.comments
'
,
"
Enable quick suggestions inside comments.
"
)
},
other
:
{
type
:
'
boolean
'
,
default
:
true
,
description
:
nls
.
localize
(
'
quickSuggestions.other
'
,
"
Enable quick suggestions outside of strings and comments.
"
)
},
}
}
],
'
default
'
:
DefaultConfig
.
editor
.
quickSuggestions
,
'
description
'
:
nls
.
localize
(
'
quickSuggestions
'
,
"
Controls if
quick suggestions should show up or not
while typing
"
)
'
description
'
:
nls
.
localize
(
'
quickSuggestions
'
,
"
Controls if
suggestions should automatically show up
while typing
"
)
},
'
editor.quickSuggestionsDelay
'
:
{
'
type
'
:
'
integer
'
,
...
...
src/vs/editor/common/config/defaultConfig.ts
浏览文件 @
fa2e9d17
...
...
@@ -86,7 +86,7 @@ class ConfigClass implements IConfiguration {
hover
:
true
,
contextmenu
:
true
,
mouseWheelScrollSensitivity
:
1
,
quickSuggestions
:
true
,
quickSuggestions
:
{
other
:
true
,
comments
:
false
,
strings
:
false
}
,
quickSuggestionsDelay
:
10
,
parameterHints
:
true
,
iconsInSuggestions
:
true
,
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
fa2e9d17
...
...
@@ -421,7 +421,7 @@ export interface IEditorOptions {
* Enable quick suggestions (shadow suggestions)
* Defaults to true.
*/
quickSuggestions
?:
boolean
;
quickSuggestions
?:
boolean
|
{
other
:
boolean
,
comments
:
boolean
,
strings
:
boolean
}
;
/**
* Quick suggestions show delay (in ms)
* Defaults to 500 (ms)
...
...
@@ -1005,7 +1005,7 @@ export class EditorContribOptions {
readonly
selectionClipboard
:
boolean
;
readonly
hover
:
boolean
;
readonly
contextmenu
:
boolean
;
readonly
quickSuggestions
:
boolean
;
readonly
quickSuggestions
:
boolean
|
{
other
:
boolean
,
comments
:
boolean
,
strings
:
boolean
}
;
readonly
quickSuggestionsDelay
:
number
;
readonly
parameterHints
:
boolean
;
readonly
iconsInSuggestions
:
boolean
;
...
...
@@ -1032,7 +1032,7 @@ export class EditorContribOptions {
selectionClipboard
:
boolean
;
hover
:
boolean
;
contextmenu
:
boolean
;
quickSuggestions
:
boolean
;
quickSuggestions
:
boolean
|
{
other
:
boolean
,
comments
:
boolean
,
strings
:
boolean
}
;
quickSuggestionsDelay
:
number
;
parameterHints
:
boolean
;
iconsInSuggestions
:
boolean
;
...
...
@@ -1055,7 +1055,7 @@ export class EditorContribOptions {
this
.
selectionClipboard
=
Boolean
(
source
.
selectionClipboard
);
this
.
hover
=
Boolean
(
source
.
hover
);
this
.
contextmenu
=
Boolean
(
source
.
contextmenu
);
this
.
quickSuggestions
=
Boolean
(
source
.
quickSuggestions
)
;
this
.
quickSuggestions
=
source
.
quickSuggestions
;
this
.
quickSuggestionsDelay
=
source
.
quickSuggestionsDelay
||
0
;
this
.
parameterHints
=
Boolean
(
source
.
parameterHints
);
this
.
iconsInSuggestions
=
Boolean
(
source
.
iconsInSuggestions
);
...
...
@@ -1084,7 +1084,7 @@ export class EditorContribOptions {
this
.
selectionClipboard
===
other
.
selectionClipboard
&&
this
.
hover
===
other
.
hover
&&
this
.
contextmenu
===
other
.
contextmenu
&&
this
.
quickSuggestions
===
other
.
quickSuggestions
&&
objects
.
equals
(
this
.
quickSuggestions
,
other
.
quickSuggestions
)
&&
this
.
quickSuggestionsDelay
===
other
.
quickSuggestionsDelay
&&
this
.
parameterHints
===
other
.
parameterHints
&&
this
.
iconsInSuggestions
===
other
.
iconsInSuggestions
...
...
src/vs/editor/contrib/suggest/common/suggestModel.ts
浏览文件 @
fa2e9d17
...
...
@@ -11,7 +11,7 @@ import Event, { Emitter } from 'vs/base/common/event';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ICommonCodeEditor
,
ICursorSelectionChangedEvent
,
CursorChangeReason
,
IModel
,
IPosition
,
IWordAtPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ISuggestSupport
,
SuggestRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
ISuggestSupport
,
SuggestRegistry
,
StandardTokenType
}
from
'
vs/editor/common/modes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
provideSuggestionItems
,
getSuggestionComparator
,
ISuggestionItem
}
from
'
./suggest
'
;
import
{
CompletionModel
}
from
'
./completionModel
'
;
...
...
@@ -260,14 +260,42 @@ export class SuggestModel implements IDisposable {
// trigger 24x7 IntelliSense when idle, enabled, when cursor
// moved RIGHT, and when at a good position
if
(
this
.
editor
.
getConfiguration
().
contribInfo
.
quickSuggestions
&&
prevPosition
.
isBefore
(
this
.
currentPosition
))
{
if
(
this
.
editor
.
getConfiguration
().
contribInfo
.
quickSuggestions
!==
false
&&
prevPosition
.
isBefore
(
this
.
currentPosition
)
)
{
this
.
cancel
();
if
(
LineContext
.
shouldAutoTrigger
(
this
.
editor
))
{
this
.
triggerAutoSuggestPromise
=
TPromise
.
timeout
(
this
.
quickSuggestDelay
);
this
.
triggerAutoSuggestPromise
.
then
(()
=>
{
const
model
=
this
.
editor
.
getModel
();
const
pos
=
this
.
editor
.
getPosition
();
if
(
!
model
)
{
return
;
}
// validate enabled now
const
{
quickSuggestions
}
=
this
.
editor
.
getConfiguration
().
contribInfo
;
if
(
quickSuggestions
===
false
)
{
return
;
}
else
if
(
quickSuggestions
===
true
)
{
// all good
}
else
{
model
.
forceTokenization
(
pos
.
lineNumber
);
const
{
tokenType
}
=
model
.
getLineTokens
(
pos
.
lineNumber
)
.
findTokenAtOffset
(
pos
.
column
-
1
);
const
inValidScope
=
quickSuggestions
.
other
&&
tokenType
===
StandardTokenType
.
Other
||
quickSuggestions
.
comments
&&
tokenType
===
StandardTokenType
.
Comment
||
quickSuggestions
.
strings
&&
tokenType
===
StandardTokenType
.
String
;
if
(
!
inValidScope
)
{
return
;
}
}
this
.
triggerAutoSuggestPromise
=
null
;
this
.
trigger
(
true
);
});
...
...
@@ -390,6 +418,11 @@ export class SuggestModel implements IDisposable {
// freeze when IntelliSense was manually requested
this
.
completionModel
.
lineContext
=
oldLineContext
;
isFrozen
=
this
.
completionModel
.
items
.
length
>
0
;
}
else
{
// nothing left
this
.
cancel
();
return
;
}
}
...
...
src/vs/monaco.d.ts
浏览文件 @
fa2e9d17
...
...
@@ -1336,7 +1336,11 @@ declare module monaco.editor {
* Enable quick suggestions (shadow suggestions)
* Defaults to true.
*/
quickSuggestions
?:
boolean
;
quickSuggestions
?:
boolean
|
{
other
:
boolean
;
comments
:
boolean
;
strings
:
boolean
;
};
/**
* Quick suggestions show delay (in ms)
* Defaults to 500 (ms)
...
...
@@ -1608,7 +1612,11 @@ declare module monaco.editor {
readonly
selectionClipboard
:
boolean
;
readonly
hover
:
boolean
;
readonly
contextmenu
:
boolean
;
readonly
quickSuggestions
:
boolean
;
readonly
quickSuggestions
:
boolean
|
{
other
:
boolean
;
comments
:
boolean
;
strings
:
boolean
;
};
readonly
quickSuggestionsDelay
:
number
;
readonly
parameterHints
:
boolean
;
readonly
iconsInSuggestions
:
boolean
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录