提交 e9f8c22a 编写于 作者: J Johannes Rieken

fix #33033

上级 fc7692fb
...@@ -414,7 +414,7 @@ export interface IEditorOptions { ...@@ -414,7 +414,7 @@ export interface IEditorOptions {
* Accept suggestions on ENTER. * Accept suggestions on ENTER.
* Defaults to 'on'. * Defaults to 'on'.
*/ */
acceptSuggestionOnEnter?: 'on' | 'smart' | 'off'; acceptSuggestionOnEnter?: boolean | 'on' | 'smart' | 'off';
/** /**
* Accept suggestions on provider defined characters. * Accept suggestions on provider defined characters.
* Defaults to true. * Defaults to true.
...@@ -1655,7 +1655,7 @@ export class EditorOptionsValidator { ...@@ -1655,7 +1655,7 @@ export class EditorOptionsValidator {
formatOnType: _boolean(opts.formatOnType, defaults.formatOnType), formatOnType: _boolean(opts.formatOnType, defaults.formatOnType),
formatOnPaste: _boolean(opts.formatOnPaste, defaults.formatOnPaste), formatOnPaste: _boolean(opts.formatOnPaste, defaults.formatOnPaste),
suggestOnTriggerCharacters: _boolean(opts.suggestOnTriggerCharacters, defaults.suggestOnTriggerCharacters), suggestOnTriggerCharacters: _boolean(opts.suggestOnTriggerCharacters, defaults.suggestOnTriggerCharacters),
acceptSuggestionOnEnter: _stringSet<'on' | 'smart' | 'off'>(opts.acceptSuggestionOnEnter, defaults.acceptSuggestionOnEnter, ['on', 'smart', 'off']), acceptSuggestionOnEnter: typeof opts.acceptSuggestionOnEnter === 'string' ? _stringSet<'on' | 'smart' | 'off'>(opts.acceptSuggestionOnEnter, defaults.acceptSuggestionOnEnter, ['on', 'smart', 'off']) : opts.acceptSuggestionOnEnter ? 'on' : 'off',
acceptSuggestionOnCommitCharacter: _boolean(opts.acceptSuggestionOnCommitCharacter, defaults.acceptSuggestionOnCommitCharacter), acceptSuggestionOnCommitCharacter: _boolean(opts.acceptSuggestionOnCommitCharacter, defaults.acceptSuggestionOnCommitCharacter),
snippetSuggestions: _stringSet<'top' | 'bottom' | 'inline' | 'none'>(opts.snippetSuggestions, defaults.snippetSuggestions, ['top', 'bottom', 'inline', 'none']), snippetSuggestions: _stringSet<'top' | 'bottom' | 'inline' | 'none'>(opts.snippetSuggestions, defaults.snippetSuggestions, ['top', 'bottom', 'inline', 'none']),
wordBasedSuggestions: _boolean(opts.wordBasedSuggestions, defaults.wordBasedSuggestions), wordBasedSuggestions: _boolean(opts.wordBasedSuggestions, defaults.wordBasedSuggestions),
......
...@@ -104,10 +104,7 @@ export class SuggestController implements IEditorContribution { ...@@ -104,10 +104,7 @@ export class SuggestController implements IEditorContribution {
let acceptSuggestionsOnEnter = SuggestContext.AcceptSuggestionsOnEnter.bindTo(_contextKeyService); let acceptSuggestionsOnEnter = SuggestContext.AcceptSuggestionsOnEnter.bindTo(_contextKeyService);
let updateFromConfig = () => { let updateFromConfig = () => {
const { acceptSuggestionOnEnter } = this._editor.getConfiguration().contribInfo; const { acceptSuggestionOnEnter } = this._editor.getConfiguration().contribInfo;
acceptSuggestionsOnEnter.set( acceptSuggestionsOnEnter.set(acceptSuggestionOnEnter === 'on' || acceptSuggestionOnEnter === 'smart');
acceptSuggestionOnEnter === 'on' || acceptSuggestionOnEnter === 'smart'
|| (<any /*migrate from old world*/>acceptSuggestionOnEnter) === true
);
}; };
this._toDispose.push(this._editor.onDidChangeConfiguration((e) => updateFromConfig())); this._toDispose.push(this._editor.onDidChangeConfiguration((e) => updateFromConfig()));
updateFromConfig(); updateFromConfig();
......
...@@ -2975,7 +2975,7 @@ declare module monaco.editor { ...@@ -2975,7 +2975,7 @@ declare module monaco.editor {
* Accept suggestions on ENTER. * Accept suggestions on ENTER.
* Defaults to 'on'. * Defaults to 'on'.
*/ */
acceptSuggestionOnEnter?: 'on' | 'smart' | 'off'; acceptSuggestionOnEnter?: boolean | 'on' | 'smart' | 'off';
/** /**
* Accept suggestions on provider defined characters. * Accept suggestions on provider defined characters.
* Defaults to true. * Defaults to true.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册