Skip to content

Commit

Permalink
Revert "disable overwriteOnAccept for now, #10266"
Browse files Browse the repository at this point in the history
This reverts commit 53d9528.
  • Loading branch information
jrieken committed Nov 1, 2019
1 parent a642dae commit 459d138
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/vs/editor/common/config/editorOptions.ts
Expand Up @@ -2474,11 +2474,11 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
super(
EditorOption.suggest, 'suggest', defaults,
{
// 'editor.suggest.overwriteOnAccept': {
// type: 'boolean',
// default: defaults.overwriteOnAccept,
// description: nls.localize('suggest.overwriteOnAccept', "Controls whether words are overwritten when accepting completions.")
// },
'editor.suggest.overwriteOnAccept': {
type: 'boolean',
default: defaults.overwriteOnAccept,
description: nls.localize('suggest.overwriteOnAccept', "Controls whether words are overwritten when accepting completions.")
},
'editor.suggest.filterGraceful': {
type: 'boolean',
default: defaults.filterGraceful,
Expand Down
27 changes: 13 additions & 14 deletions src/vs/editor/contrib/suggest/suggestController.ts
Expand Up @@ -263,10 +263,9 @@ export class SuggestController implements IEditorContribution {
insertText = SnippetParser.escape(insertText);
}

// const overwriteConfig = flags & InsertFlags.AlternativeOverwriteConfig
// ? !this._editor.getOption(EditorOption.suggest).overwriteOnAccept
// : this._editor.getOption(EditorOption.suggest).overwriteOnAccept;
const overwriteConfig = false;
const overwriteConfig = flags & InsertFlags.AlternativeOverwriteConfig
? !this._editor.getOption(EditorOption.suggest).overwriteOnAccept
: this._editor.getOption(EditorOption.suggest).overwriteOnAccept;

const overwriteBefore = position.column - item.editStart.column;
const overwriteAfter = (overwriteConfig ? item.editReplaceEnd.column : item.editInsertEnd.column) - position.column;
Expand Down Expand Up @@ -533,16 +532,16 @@ KeybindingsRegistry.registerKeybindingRule({
weight
});

// // shift+enter and shift+tab use the alternative-flag so that the suggest controller
// // is doing the opposite of the editor.suggest.overwriteOnAccept-configuration
// KeybindingsRegistry.registerKeybindingRule({
// id: 'acceptSelectedSuggestion',
// when: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus),
// primary: KeyMod.Shift | KeyCode.Tab,
// secondary: [KeyMod.Shift | KeyCode.Enter],
// args: { alternative: true },
// weight
// });
// shift+enter and shift+tab use the alternative-flag so that the suggest controller
// is doing the opposite of the editor.suggest.overwriteOnAccept-configuration
KeybindingsRegistry.registerKeybindingRule({
id: 'acceptSelectedSuggestion',
when: ContextKeyExpr.and(SuggestContext.Visible, EditorContextKeys.textInputFocus),
primary: KeyMod.Shift | KeyCode.Tab,
secondary: [KeyMod.Shift | KeyCode.Enter],
args: { alternative: true },
weight
});

// continue to support the old command
CommandsRegistry.registerCommandAlias('acceptSelectedSuggestionOnEnter', 'acceptSelectedSuggestion');
Expand Down

0 comments on commit 459d138

Please sign in to comment.