Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b4615a8f
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,发现更多精彩内容 >>
提交
b4615a8f
编写于
5月 22, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make `acceptSuggestionOnEnter` a tri state, #24420
上级
be70f203
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
13 deletion
+18
-13
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+2
-1
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+5
-5
src/vs/editor/contrib/suggest/browser/suggest.ts
src/vs/editor/contrib/suggest/browser/suggest.ts
+1
-2
src/vs/editor/contrib/suggest/browser/suggestController.ts
src/vs/editor/contrib/suggest/browser/suggestController.ts
+7
-2
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+3
-3
未找到文件。
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
b4615a8f
...
...
@@ -370,7 +370,8 @@ const editorConfiguration: IConfigurationNode = {
'
description
'
:
nls
.
localize
(
'
suggestOnTriggerCharacters
'
,
"
Controls if suggestions should automatically show up when typing trigger characters
"
)
},
'
editor.acceptSuggestionOnEnter
'
:
{
'
type
'
:
'
boolean
'
,
'
type
'
:
'
string
'
,
'
enum
'
:
[
'
on
'
,
'
smart
'
,
'
off
'
],
'
default
'
:
EDITOR_DEFAULTS
.
contribInfo
.
acceptSuggestionOnEnter
,
'
description
'
:
nls
.
localize
(
'
acceptSuggestionOnEnter
'
,
"
Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions.
"
)
},
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
b4615a8f
...
...
@@ -364,9 +364,9 @@ export interface IEditorOptions {
suggestOnTriggerCharacters
?:
boolean
;
/**
* Accept suggestions on ENTER.
* Defaults to
true
.
* Defaults to
'on'
.
*/
acceptSuggestionOnEnter
?:
boolean
;
acceptSuggestionOnEnter
?:
'
on
'
|
'
smart
'
|
'
off
'
;
/**
* Accept suggestions on provider defined characters.
* Defaults to true.
...
...
@@ -726,7 +726,7 @@ export interface EditorContribOptions {
readonly
formatOnType
:
boolean
;
readonly
formatOnPaste
:
boolean
;
readonly
suggestOnTriggerCharacters
:
boolean
;
readonly
acceptSuggestionOnEnter
:
boolean
;
readonly
acceptSuggestionOnEnter
:
'
on
'
|
'
smart
'
|
'
off
'
;
readonly
acceptSuggestionOnCommitCharacter
:
boolean
;
readonly
snippetSuggestions
:
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
;
readonly
wordBasedSuggestions
:
boolean
;
...
...
@@ -1532,7 +1532,7 @@ export class EditorOptionsValidator {
formatOnType
:
_boolean
(
opts
.
formatOnType
,
defaults
.
formatOnType
),
formatOnPaste
:
_boolean
(
opts
.
formatOnPaste
,
defaults
.
formatOnPaste
),
suggestOnTriggerCharacters
:
_boolean
(
opts
.
suggestOnTriggerCharacters
,
defaults
.
suggestOnTriggerCharacters
),
acceptSuggestionOnEnter
:
_
boolean
(
opts
.
acceptSuggestionOnEnter
,
defaults
.
acceptSuggestionOnEnter
),
acceptSuggestionOnEnter
:
_
stringSet
<
'
on
'
|
'
smart
'
|
'
off
'
>
(
opts
.
acceptSuggestionOnEnter
,
defaults
.
acceptSuggestionOnEnter
,
[
'
on
'
,
'
smart
'
,
'
off
'
]
),
acceptSuggestionOnCommitCharacter
:
_boolean
(
opts
.
acceptSuggestionOnCommitCharacter
,
defaults
.
acceptSuggestionOnCommitCharacter
),
snippetSuggestions
:
_stringSet
<
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
>
(
opts
.
snippetSuggestions
,
defaults
.
snippetSuggestions
,
[
'
top
'
,
'
bottom
'
,
'
inline
'
,
'
none
'
]),
wordBasedSuggestions
:
_boolean
(
opts
.
wordBasedSuggestions
,
defaults
.
wordBasedSuggestions
),
...
...
@@ -1939,7 +1939,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
formatOnType
:
false
,
formatOnPaste
:
false
,
suggestOnTriggerCharacters
:
true
,
acceptSuggestionOnEnter
:
true
,
acceptSuggestionOnEnter
:
'
smart
'
,
acceptSuggestionOnCommitCharacter
:
true
,
snippetSuggestions
:
'
inline
'
,
wordBasedSuggestions
:
true
,
...
...
src/vs/editor/contrib/suggest/browser/suggest.ts
浏览文件 @
b4615a8f
...
...
@@ -15,14 +15,13 @@ import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import
{
ISuggestResult
,
ISuggestSupport
,
ISuggestion
,
SuggestRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
Position
,
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
EDITOR_DEFAULTS
}
from
"
vs/editor/common/config/editorOptions
"
;
export
const
Context
=
{
Visible
:
new
RawContextKey
<
boolean
>
(
'
suggestWidgetVisible
'
,
false
),
MultipleSuggestions
:
new
RawContextKey
<
boolean
>
(
'
suggestWidgetMultipleSuggestions
'
,
false
),
MakesTextEdit
:
new
RawContextKey
(
'
suggestionMakesTextEdit
'
,
true
),
AcceptOnKey
:
new
RawContextKey
<
boolean
>
(
'
suggestionSupportsAcceptOnKey
'
,
true
),
AcceptSuggestionsOnEnter
:
new
RawContextKey
<
boolean
>
(
'
acceptSuggestionOnEnter
'
,
EDITOR_DEFAULTS
.
contribInfo
.
acceptSuggestionOnEnter
)
AcceptSuggestionsOnEnter
:
new
RawContextKey
<
boolean
>
(
'
acceptSuggestionOnEnter
'
,
true
)
};
export
interface
ISuggestionItem
{
...
...
src/vs/editor/contrib/suggest/browser/suggestController.ts
浏览文件 @
b4615a8f
...
...
@@ -102,7 +102,11 @@ export class SuggestController implements IEditorContribution {
// Manage the acceptSuggestionsOnEnter context key
let
acceptSuggestionsOnEnter
=
SuggestContext
.
AcceptSuggestionsOnEnter
.
bindTo
(
_contextKeyService
);
let
updateFromConfig
=
()
=>
{
acceptSuggestionsOnEnter
.
set
(
this
.
_editor
.
getConfiguration
().
contribInfo
.
acceptSuggestionOnEnter
);
const
{
acceptSuggestionOnEnter
}
=
this
.
_editor
.
getConfiguration
().
contribInfo
;
acceptSuggestionsOnEnter
.
set
(
acceptSuggestionOnEnter
===
'
on
'
||
acceptSuggestionOnEnter
===
'
smart
'
||
(
<
any
/*migrate from old world*/
>
acceptSuggestionOnEnter
)
===
true
);
};
this
.
_toDispose
.
push
(
this
.
_editor
.
onDidChangeConfiguration
((
e
)
=>
updateFromConfig
()));
updateFromConfig
();
...
...
@@ -129,7 +133,8 @@ export class SuggestController implements IEditorContribution {
const
endColumn
=
position
.
column
;
let
value
=
true
;
if
(
this
.
_model
.
state
===
State
.
Auto
this
.
_editor
.
getConfiguration
().
contribInfo
.
acceptSuggestionOnEnter
===
'
smart
'
&&
this
.
_model
.
state
===
State
.
Auto
&&
!
item
.
suggestion
.
command
&&
!
item
.
suggestion
.
additionalTextEdits
&&
item
.
suggestion
.
snippetType
!==
'
textmate
'
...
...
src/vs/monaco.d.ts
浏览文件 @
b4615a8f
...
...
@@ -2909,9 +2909,9 @@ declare module monaco.editor {
suggestOnTriggerCharacters
?:
boolean
;
/**
* Accept suggestions on ENTER.
* Defaults to
true
.
* Defaults to
'on'
.
*/
acceptSuggestionOnEnter
?:
boolean
;
acceptSuggestionOnEnter
?:
'
on
'
|
'
smart
'
|
'
off
'
;
/**
* Accept suggestions on provider defined characters.
* Defaults to true.
...
...
@@ -3211,7 +3211,7 @@ declare module monaco.editor {
readonly
formatOnType
:
boolean
;
readonly
formatOnPaste
:
boolean
;
readonly
suggestOnTriggerCharacters
:
boolean
;
readonly
acceptSuggestionOnEnter
:
boolean
;
readonly
acceptSuggestionOnEnter
:
'
on
'
|
'
smart
'
|
'
off
'
;
readonly
acceptSuggestionOnCommitCharacter
:
boolean
;
readonly
snippetSuggestions
:
'
top
'
|
'
bottom
'
|
'
inline
'
|
'
none
'
;
readonly
wordBasedSuggestions
:
boolean
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录