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

fix #33033

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