Merge pull request #125498 from microsoft/hediet/fix-125034
Renames "Inline Completion" to "Inline Suggestion". Removes Ghost Text Expanded Setting (default true)
This commit is contained in:
commit
fe1eafc80c
9 changed files with 266 additions and 233 deletions
|
@ -382,6 +382,7 @@ export interface IEditorOptions {
|
|||
* Suggest options.
|
||||
*/
|
||||
suggest?: ISuggestOptions;
|
||||
inlineSuggest?: IInlineSuggestOptions;
|
||||
/**
|
||||
* Smart select options.
|
||||
*/
|
||||
|
@ -3140,6 +3141,51 @@ class EditorScrollbar extends BaseEditorOption<EditorOption.scrollbar, InternalE
|
|||
|
||||
//#endregion
|
||||
|
||||
//#region inlineSuggest
|
||||
|
||||
export interface IInlineSuggestOptions {
|
||||
/**
|
||||
* Enable or disable the rendering of automatic inline completions.
|
||||
*/
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type InternalInlineSuggestOptions = Readonly<Required<IInlineSuggestOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for inline suggestions
|
||||
*/
|
||||
class InlineEditorSuggest extends BaseEditorOption<EditorOption.inlineSuggest, InternalInlineSuggestOptions> {
|
||||
constructor() {
|
||||
const defaults: InternalInlineSuggestOptions = {
|
||||
enabled: false
|
||||
};
|
||||
|
||||
super(
|
||||
EditorOption.inlineSuggest, 'inlineSuggest', defaults,
|
||||
{
|
||||
'editor.inlineSuggest.enabled': {
|
||||
type: 'boolean',
|
||||
default: defaults.enabled,
|
||||
description: nls.localize('inlineSuggest.enabled', "Controls whether to automatically show inline suggestions in the editor.")
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public validate(_input: any): InternalInlineSuggestOptions {
|
||||
if (!_input || typeof _input !== 'object') {
|
||||
return this.defaultValue;
|
||||
}
|
||||
const input = _input as IInlineSuggestOptions;
|
||||
return {
|
||||
enabled: boolean(input.enabled, this.defaultValue.enabled),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region suggest
|
||||
|
||||
/**
|
||||
|
@ -3177,16 +3223,7 @@ export interface ISuggestOptions {
|
|||
/**
|
||||
* Enable or disable the rendering of the suggestion preview.
|
||||
*/
|
||||
showSuggestionPreview?: boolean;
|
||||
/**
|
||||
* Enable or disable the rendering of automatic inline completions.
|
||||
*/
|
||||
showInlineCompletions?: boolean;
|
||||
/**
|
||||
* Enable or disable the default expansion of the ghost text as used
|
||||
* by the suggestion preview or the inline completions.
|
||||
*/
|
||||
ghostTextExpanded?: boolean;
|
||||
preview?: boolean;
|
||||
/**
|
||||
* Show details inline with the label. Defaults to true.
|
||||
*/
|
||||
|
@ -3318,9 +3355,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
|
|||
shareSuggestSelections: false,
|
||||
showIcons: true,
|
||||
showStatusBar: false,
|
||||
showSuggestionPreview: false,
|
||||
ghostTextExpanded: true,
|
||||
showInlineCompletions: false,
|
||||
preview: false,
|
||||
showInlineDetails: true,
|
||||
showMethods: true,
|
||||
showFunctions: true,
|
||||
|
@ -3394,20 +3429,10 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
|
|||
default: defaults.showStatusBar,
|
||||
description: nls.localize('suggest.showStatusBar', "Controls the visibility of the status bar at the bottom of the suggest widget.")
|
||||
},
|
||||
'editor.suggest.showSuggestionPreview': {
|
||||
'editor.suggest.preview': {
|
||||
type: 'boolean',
|
||||
default: defaults.showSuggestionPreview,
|
||||
description: nls.localize('suggest.showSuggestionPreview', "Controls whether to preview the suggestion outcome in the editor.")
|
||||
},
|
||||
'editor.suggest.showInlineCompletions': {
|
||||
type: 'boolean',
|
||||
default: defaults.showInlineCompletions,
|
||||
description: nls.localize('suggest.showInlineCompletions', "Controls whether to show inline completions in the editor.")
|
||||
},
|
||||
'editor.suggest.ghostTextExpanded': {
|
||||
type: 'boolean',
|
||||
default: defaults.ghostTextExpanded,
|
||||
description: nls.localize('suggest.ghostTextExpanded', "Controls whether the ghost text that is used by the suggestion preview or the inline completions is expanted by default.")
|
||||
default: defaults.preview,
|
||||
description: nls.localize('suggest.preview', "Controls whether to preview the suggestion outcome in the editor.")
|
||||
},
|
||||
'editor.suggest.showInlineDetails': {
|
||||
type: 'boolean',
|
||||
|
@ -3584,9 +3609,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
|
|||
shareSuggestSelections: boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),
|
||||
showIcons: boolean(input.showIcons, this.defaultValue.showIcons),
|
||||
showStatusBar: boolean(input.showStatusBar, this.defaultValue.showStatusBar),
|
||||
showSuggestionPreview: boolean(input.showSuggestionPreview, this.defaultValue.showSuggestionPreview),
|
||||
ghostTextExpanded: boolean(input.ghostTextExpanded, this.defaultValue.ghostTextExpanded),
|
||||
showInlineCompletions: boolean(input.showInlineCompletions, this.defaultValue.showInlineCompletions),
|
||||
preview: boolean(input.preview, this.defaultValue.preview),
|
||||
showInlineDetails: boolean(input.showInlineDetails, this.defaultValue.showInlineDetails),
|
||||
showMethods: boolean(input.showMethods, this.defaultValue.showMethods),
|
||||
showFunctions: boolean(input.showFunctions, this.defaultValue.showFunctions),
|
||||
|
@ -3834,6 +3857,7 @@ export const enum EditorOption {
|
|||
highlightActiveIndentGuide,
|
||||
hover,
|
||||
inDiffEditor,
|
||||
inlineSuggest,
|
||||
letterSpacing,
|
||||
lightbulb,
|
||||
lineDecorationsWidth,
|
||||
|
@ -4452,6 +4476,7 @@ export const EditorOptions = {
|
|||
10000, -1, Constants.MAX_SAFE_SMALL_INTEGER,
|
||||
)),
|
||||
suggest: register(new EditorSuggest()),
|
||||
inlineSuggest: register(new InlineEditorSuggest()),
|
||||
suggestFontSize: register(new EditorIntOption(
|
||||
EditorOption.suggestFontSize, 'suggestFontSize',
|
||||
0, 0, 1000,
|
||||
|
|
|
@ -219,83 +219,84 @@ export enum EditorOption {
|
|||
highlightActiveIndentGuide = 49,
|
||||
hover = 50,
|
||||
inDiffEditor = 51,
|
||||
letterSpacing = 52,
|
||||
lightbulb = 53,
|
||||
lineDecorationsWidth = 54,
|
||||
lineHeight = 55,
|
||||
lineNumbers = 56,
|
||||
lineNumbersMinChars = 57,
|
||||
linkedEditing = 58,
|
||||
links = 59,
|
||||
matchBrackets = 60,
|
||||
minimap = 61,
|
||||
mouseStyle = 62,
|
||||
mouseWheelScrollSensitivity = 63,
|
||||
mouseWheelZoom = 64,
|
||||
multiCursorMergeOverlapping = 65,
|
||||
multiCursorModifier = 66,
|
||||
multiCursorPaste = 67,
|
||||
occurrencesHighlight = 68,
|
||||
overviewRulerBorder = 69,
|
||||
overviewRulerLanes = 70,
|
||||
padding = 71,
|
||||
parameterHints = 72,
|
||||
peekWidgetDefaultFocus = 73,
|
||||
definitionLinkOpensInPeek = 74,
|
||||
quickSuggestions = 75,
|
||||
quickSuggestionsDelay = 76,
|
||||
readOnly = 77,
|
||||
renameOnType = 78,
|
||||
renderControlCharacters = 79,
|
||||
renderIndentGuides = 80,
|
||||
renderFinalNewline = 81,
|
||||
renderLineHighlight = 82,
|
||||
renderLineHighlightOnlyWhenFocus = 83,
|
||||
renderValidationDecorations = 84,
|
||||
renderWhitespace = 85,
|
||||
revealHorizontalRightPadding = 86,
|
||||
roundedSelection = 87,
|
||||
rulers = 88,
|
||||
scrollbar = 89,
|
||||
scrollBeyondLastColumn = 90,
|
||||
scrollBeyondLastLine = 91,
|
||||
scrollPredominantAxis = 92,
|
||||
selectionClipboard = 93,
|
||||
selectionHighlight = 94,
|
||||
selectOnLineNumbers = 95,
|
||||
showFoldingControls = 96,
|
||||
showUnused = 97,
|
||||
snippetSuggestions = 98,
|
||||
smartSelect = 99,
|
||||
smoothScrolling = 100,
|
||||
stickyTabStops = 101,
|
||||
stopRenderingLineAfter = 102,
|
||||
suggest = 103,
|
||||
suggestFontSize = 104,
|
||||
suggestLineHeight = 105,
|
||||
suggestOnTriggerCharacters = 106,
|
||||
suggestSelection = 107,
|
||||
tabCompletion = 108,
|
||||
tabIndex = 109,
|
||||
unusualLineTerminators = 110,
|
||||
useShadowDOM = 111,
|
||||
useTabStops = 112,
|
||||
wordSeparators = 113,
|
||||
wordWrap = 114,
|
||||
wordWrapBreakAfterCharacters = 115,
|
||||
wordWrapBreakBeforeCharacters = 116,
|
||||
wordWrapColumn = 117,
|
||||
wordWrapOverride1 = 118,
|
||||
wordWrapOverride2 = 119,
|
||||
wrappingIndent = 120,
|
||||
wrappingStrategy = 121,
|
||||
showDeprecated = 122,
|
||||
inlayHints = 123,
|
||||
editorClassName = 124,
|
||||
pixelRatio = 125,
|
||||
tabFocusMode = 126,
|
||||
layoutInfo = 127,
|
||||
wrappingInfo = 128
|
||||
inlineSuggest = 52,
|
||||
letterSpacing = 53,
|
||||
lightbulb = 54,
|
||||
lineDecorationsWidth = 55,
|
||||
lineHeight = 56,
|
||||
lineNumbers = 57,
|
||||
lineNumbersMinChars = 58,
|
||||
linkedEditing = 59,
|
||||
links = 60,
|
||||
matchBrackets = 61,
|
||||
minimap = 62,
|
||||
mouseStyle = 63,
|
||||
mouseWheelScrollSensitivity = 64,
|
||||
mouseWheelZoom = 65,
|
||||
multiCursorMergeOverlapping = 66,
|
||||
multiCursorModifier = 67,
|
||||
multiCursorPaste = 68,
|
||||
occurrencesHighlight = 69,
|
||||
overviewRulerBorder = 70,
|
||||
overviewRulerLanes = 71,
|
||||
padding = 72,
|
||||
parameterHints = 73,
|
||||
peekWidgetDefaultFocus = 74,
|
||||
definitionLinkOpensInPeek = 75,
|
||||
quickSuggestions = 76,
|
||||
quickSuggestionsDelay = 77,
|
||||
readOnly = 78,
|
||||
renameOnType = 79,
|
||||
renderControlCharacters = 80,
|
||||
renderIndentGuides = 81,
|
||||
renderFinalNewline = 82,
|
||||
renderLineHighlight = 83,
|
||||
renderLineHighlightOnlyWhenFocus = 84,
|
||||
renderValidationDecorations = 85,
|
||||
renderWhitespace = 86,
|
||||
revealHorizontalRightPadding = 87,
|
||||
roundedSelection = 88,
|
||||
rulers = 89,
|
||||
scrollbar = 90,
|
||||
scrollBeyondLastColumn = 91,
|
||||
scrollBeyondLastLine = 92,
|
||||
scrollPredominantAxis = 93,
|
||||
selectionClipboard = 94,
|
||||
selectionHighlight = 95,
|
||||
selectOnLineNumbers = 96,
|
||||
showFoldingControls = 97,
|
||||
showUnused = 98,
|
||||
snippetSuggestions = 99,
|
||||
smartSelect = 100,
|
||||
smoothScrolling = 101,
|
||||
stickyTabStops = 102,
|
||||
stopRenderingLineAfter = 103,
|
||||
suggest = 104,
|
||||
suggestFontSize = 105,
|
||||
suggestLineHeight = 106,
|
||||
suggestOnTriggerCharacters = 107,
|
||||
suggestSelection = 108,
|
||||
tabCompletion = 109,
|
||||
tabIndex = 110,
|
||||
unusualLineTerminators = 111,
|
||||
useShadowDOM = 112,
|
||||
useTabStops = 113,
|
||||
wordSeparators = 114,
|
||||
wordWrap = 115,
|
||||
wordWrapBreakAfterCharacters = 116,
|
||||
wordWrapBreakBeforeCharacters = 117,
|
||||
wordWrapColumn = 118,
|
||||
wordWrapOverride1 = 119,
|
||||
wordWrapOverride2 = 120,
|
||||
wrappingIndent = 121,
|
||||
wrappingStrategy = 122,
|
||||
showDeprecated = 123,
|
||||
inlayHints = 124,
|
||||
editorClassName = 125,
|
||||
pixelRatio = 126,
|
||||
tabFocusMode = 127,
|
||||
layoutInfo = 128,
|
||||
wrappingInfo = 129
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,8 +19,8 @@ import { ContextKeyExpr, IContextKeyService, RawContextKey } from 'vs/platform/c
|
|||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export class GhostTextController extends Disposable {
|
||||
public static readonly inlineCompletionsVisible = new RawContextKey<boolean>('inlineCompletionsVisible ', false, nls.localize('inlineCompletionsVisible', "Whether inline suggestions are visible"));
|
||||
public static readonly inlineCompletionSuggestsIndentation = new RawContextKey<boolean>('inlineCompletionSuggestsIndentation', false, nls.localize('inlineCompletionSuggestsIndentation', "Whether the inline suggestion suggests extending indentation"));
|
||||
public static readonly inlineSuggestionVisible = new RawContextKey<boolean>('inlineSuggestionVisible ', false, nls.localize('inlineSuggestionVisible', "Whether an inline suggestion is visible"));
|
||||
public static readonly inlineSuggestionHasIndentation = new RawContextKey<boolean>('inlineSuggestionHasIndentation', false, nls.localize('inlineSuggestionHasIndentation', "Whether the inline suggestion starts with whitespace"));
|
||||
|
||||
static ID = 'editor.contrib.ghostTextController';
|
||||
|
||||
|
@ -57,11 +57,12 @@ export class GhostTextController extends Disposable {
|
|||
// Don't call this method when not neccessary. It will recreate the activeController.
|
||||
private updateModelController(): void {
|
||||
const suggestOptions = this.editor.getOption(EditorOption.suggest);
|
||||
const inlineSuggestOptions = this.editor.getOption(EditorOption.inlineSuggest);
|
||||
|
||||
this.activeController.value = undefined;
|
||||
// ActiveGhostTextController is only created if one of those settings is set or if the inline completions are triggered explicitly.
|
||||
this.activeController.value =
|
||||
this.editor.hasModel() && (suggestOptions.showSuggestionPreview || suggestOptions.showInlineCompletions || this.triggeredExplicitly)
|
||||
this.editor.hasModel() && (suggestOptions.preview || inlineSuggestOptions.enabled || this.triggeredExplicitly)
|
||||
? this.instantiationService.createInstance(
|
||||
ActiveGhostTextController,
|
||||
this.editor,
|
||||
|
@ -109,10 +110,10 @@ export class GhostTextController extends Disposable {
|
|||
// Currently the global state is updated directly, which may lead to conflicts if multiple ghost texts are active.
|
||||
class GhostTextContextKeys {
|
||||
private lastInlineCompletionVisibleValue = false;
|
||||
private readonly inlineCompletionVisible = GhostTextController.inlineCompletionsVisible.bindTo(this.contextKeyService);
|
||||
private readonly inlineCompletionVisible = GhostTextController.inlineSuggestionVisible.bindTo(this.contextKeyService);
|
||||
|
||||
private lastInlineCompletionSuggestsIndentationValue = false;
|
||||
private readonly inlineCompletionSuggestsIndentation = GhostTextController.inlineCompletionSuggestsIndentation.bindTo(this.contextKeyService);
|
||||
private readonly inlineCompletionSuggestsIndentation = GhostTextController.inlineSuggestionHasIndentation.bindTo(this.contextKeyService);
|
||||
|
||||
constructor(private readonly contextKeyService: IContextKeyService) {
|
||||
}
|
||||
|
@ -238,10 +239,10 @@ export class ActiveGhostTextController extends Disposable {
|
|||
const GhostTextCommand = EditorCommand.bindToContribution(GhostTextController.get);
|
||||
|
||||
export const commitInlineSuggestionAction = new GhostTextCommand({
|
||||
id: 'commitInlineCompletion',
|
||||
id: 'editor.action.inlineSuggest.commit',
|
||||
precondition: ContextKeyExpr.and(
|
||||
GhostTextController.inlineCompletionsVisible,
|
||||
GhostTextController.inlineCompletionSuggestsIndentation.toNegated(),
|
||||
GhostTextController.inlineSuggestionVisible,
|
||||
GhostTextController.inlineSuggestionHasIndentation.toNegated(),
|
||||
EditorContextKeys.tabMovesFocus.toNegated()
|
||||
),
|
||||
kbOpts: {
|
||||
|
@ -255,8 +256,8 @@ export const commitInlineSuggestionAction = new GhostTextCommand({
|
|||
registerEditorCommand(commitInlineSuggestionAction);
|
||||
|
||||
registerEditorCommand(new GhostTextCommand({
|
||||
id: 'hideInlineCompletion',
|
||||
precondition: GhostTextController.inlineCompletionsVisible,
|
||||
id: 'editor.action.inlineSuggest.hide',
|
||||
precondition: GhostTextController.inlineSuggestionVisible,
|
||||
kbOpts: {
|
||||
weight: 100,
|
||||
primary: KeyCode.Escape,
|
||||
|
@ -266,13 +267,13 @@ registerEditorCommand(new GhostTextCommand({
|
|||
}
|
||||
}));
|
||||
|
||||
export class ShowNextInlineCompletionAction extends EditorAction {
|
||||
public static ID = 'editor.action.showNextInlineCompletion';
|
||||
export class ShowNextInlineSuggestionAction extends EditorAction {
|
||||
public static ID = 'editor.action.inlineSuggest.showNext';
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowNextInlineCompletionAction.ID,
|
||||
label: nls.localize('showNextInlineCompletion', "Show Next Inline Completion"),
|
||||
alias: 'Show Next Inline Completion',
|
||||
id: ShowNextInlineSuggestionAction.ID,
|
||||
label: nls.localize('action.inlineSuggest.showNext', "Show Next Inline Suggestion"),
|
||||
alias: 'Show Next Inline Suggestion',
|
||||
precondition: EditorContextKeys.writable,
|
||||
kbOpts: {
|
||||
weight: 100,
|
||||
|
@ -290,13 +291,13 @@ export class ShowNextInlineCompletionAction extends EditorAction {
|
|||
}
|
||||
}
|
||||
|
||||
export class ShowPreviousInlineCompletionAction extends EditorAction {
|
||||
public static ID = 'editor.action.showPreviousInlineCompletion';
|
||||
export class ShowPreviousInlineSuggestionAction extends EditorAction {
|
||||
public static ID = 'editor.action.inlineSuggest.showPrevious';
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowPreviousInlineCompletionAction.ID,
|
||||
label: nls.localize('showPreviousInlineCompletion', "Show Previous Inline Completion"),
|
||||
alias: 'Show Previous Inline Completion',
|
||||
id: ShowPreviousInlineSuggestionAction.ID,
|
||||
label: nls.localize('action.inlineSuggest.showPrevious', "Show Previous Inline Suggestion"),
|
||||
alias: 'Show Previous Inline Suggestion',
|
||||
precondition: EditorContextKeys.writable,
|
||||
kbOpts: {
|
||||
weight: 100,
|
||||
|
@ -314,12 +315,12 @@ export class ShowPreviousInlineCompletionAction extends EditorAction {
|
|||
}
|
||||
}
|
||||
|
||||
export class TriggerInlineCompletionsAction extends EditorAction {
|
||||
export class TriggerInlineSuggestionAction extends EditorAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'editor.action.triggerInlineCompletions',
|
||||
label: nls.localize('triggerInlineCompletionsAction', "Trigger Inline Completions"),
|
||||
alias: 'Trigger Inline Completions',
|
||||
id: 'editor.action.inlineSuggest.trigger',
|
||||
label: nls.localize('action.inlineSuggest.trigger', "Trigger Inline Suggestion"),
|
||||
alias: 'Trigger Inline Suggestion',
|
||||
precondition: EditorContextKeys.writable
|
||||
});
|
||||
}
|
||||
|
@ -333,6 +334,6 @@ export class TriggerInlineCompletionsAction extends EditorAction {
|
|||
}
|
||||
|
||||
registerEditorContribution(GhostTextController.ID, GhostTextController);
|
||||
registerEditorAction(TriggerInlineCompletionsAction);
|
||||
registerEditorAction(ShowNextInlineCompletionAction);
|
||||
registerEditorAction(ShowPreviousInlineCompletionAction);
|
||||
registerEditorAction(TriggerInlineSuggestionAction);
|
||||
registerEditorAction(ShowNextInlineSuggestionAction);
|
||||
registerEditorAction(ShowPreviousInlineSuggestionAction);
|
||||
|
|
|
@ -52,7 +52,9 @@ export abstract class BaseGhostTextWidgetModel extends Disposable implements Gho
|
|||
|
||||
public get expanded() {
|
||||
if (this._expanded === undefined) {
|
||||
return this.editor.getOption(EditorOption.suggest).ghostTextExpanded;
|
||||
// TODO this should use a global hidden setting.
|
||||
// See https://github.com/microsoft/vscode/issues/125037.
|
||||
return true;
|
||||
}
|
||||
return this._expanded;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/brows
|
|||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { IModelDecoration } from 'vs/editor/common/model';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { commitInlineSuggestionAction, GhostTextController, ShowNextInlineCompletionAction, ShowPreviousInlineCompletionAction } from 'vs/editor/contrib/inlineCompletions/ghostTextController';
|
||||
import { commitInlineSuggestionAction, GhostTextController, ShowNextInlineSuggestionAction, ShowPreviousInlineSuggestionAction } from 'vs/editor/contrib/inlineCompletions/ghostTextController';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
@ -82,14 +82,14 @@ export class InlineCompletionsHoverParticipant implements IEditorHoverParticipan
|
|||
);
|
||||
|
||||
statusBar.addAction({
|
||||
label: nls.localize('showNextInlineCompletion', "Next"),
|
||||
commandId: ShowNextInlineCompletionAction.ID,
|
||||
run: () => this._commandService.executeCommand(ShowNextInlineCompletionAction.ID)
|
||||
label: nls.localize('showNextInlineSuggestion', "Next"),
|
||||
commandId: ShowNextInlineSuggestionAction.ID,
|
||||
run: () => this._commandService.executeCommand(ShowNextInlineSuggestionAction.ID)
|
||||
});
|
||||
statusBar.addAction({
|
||||
label: nls.localize('showPreviousInlineCompletion', "Previous"),
|
||||
commandId: ShowPreviousInlineCompletionAction.ID,
|
||||
run: () => this._commandService.executeCommand(ShowPreviousInlineCompletionAction.ID)
|
||||
label: nls.localize('showPreviousInlineSuggestion', "Previous"),
|
||||
commandId: ShowPreviousInlineSuggestionAction.ID,
|
||||
run: () => this._commandService.executeCommand(ShowPreviousInlineSuggestionAction.ID)
|
||||
});
|
||||
statusBar.addAction({
|
||||
label: nls.localize('acceptInlineSuggestion', "Accept"),
|
||||
|
|
|
@ -99,8 +99,8 @@ export class InlineCompletionsModel extends Disposable implements GhostTextWidge
|
|||
}
|
||||
|
||||
private startSessionIfTriggered(): void {
|
||||
const suggestOptions = this.editor.getOption(EditorOption.suggest);
|
||||
if (!suggestOptions.showInlineCompletions) {
|
||||
const suggestOptions = this.editor.getOption(EditorOption.inlineSuggest);
|
||||
if (!suggestOptions.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ class InlineCompletionsSession extends BaseGhostTextWidgetModel {
|
|||
const cache = this.cache.replace(undefined);
|
||||
|
||||
this.editor.executeEdits(
|
||||
'inlineCompletions.accept',
|
||||
'inlineSuggestion.accept',
|
||||
[
|
||||
EditOperation.replaceMove(completion.range, completion.text)
|
||||
]
|
||||
|
|
|
@ -75,7 +75,7 @@ export class SuggestWidgetAdapterModel extends BaseGhostTextWidgetModel {
|
|||
|
||||
private isSuggestionPreviewEnabled(): boolean {
|
||||
const suggestOptions = this.editor.getOption(EditorOption.suggest);
|
||||
return suggestOptions.showSuggestionPreview;
|
||||
return suggestOptions.preview;
|
||||
}
|
||||
|
||||
private updateFromSuggestion(): void {
|
||||
|
|
177
src/vs/monaco.d.ts
vendored
177
src/vs/monaco.d.ts
vendored
|
@ -2973,6 +2973,7 @@ declare namespace monaco.editor {
|
|||
* Suggest options.
|
||||
*/
|
||||
suggest?: ISuggestOptions;
|
||||
inlineSuggest?: IInlineSuggestOptions;
|
||||
/**
|
||||
* Smart select options.
|
||||
*/
|
||||
|
@ -3812,6 +3813,15 @@ declare namespace monaco.editor {
|
|||
readonly scrollByPage: boolean;
|
||||
}
|
||||
|
||||
export interface IInlineSuggestOptions {
|
||||
/**
|
||||
* Enable or disable the rendering of automatic inline completions.
|
||||
*/
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type InternalInlineSuggestOptions = Readonly<Required<IInlineSuggestOptions>>;
|
||||
|
||||
/**
|
||||
* Configuration options for editor suggest widget
|
||||
*/
|
||||
|
@ -3847,16 +3857,7 @@ declare namespace monaco.editor {
|
|||
/**
|
||||
* Enable or disable the rendering of the suggestion preview.
|
||||
*/
|
||||
showSuggestionPreview?: boolean;
|
||||
/**
|
||||
* Enable or disable the rendering of automatic inline completions.
|
||||
*/
|
||||
showInlineCompletions?: boolean;
|
||||
/**
|
||||
* Enable or disable the default expansion of the ghost text as used
|
||||
* by the suggestion preview or the inline completions.
|
||||
*/
|
||||
ghostTextExpanded?: boolean;
|
||||
preview?: boolean;
|
||||
/**
|
||||
* Show details inline with the label. Defaults to true.
|
||||
*/
|
||||
|
@ -4065,83 +4066,84 @@ declare namespace monaco.editor {
|
|||
highlightActiveIndentGuide = 49,
|
||||
hover = 50,
|
||||
inDiffEditor = 51,
|
||||
letterSpacing = 52,
|
||||
lightbulb = 53,
|
||||
lineDecorationsWidth = 54,
|
||||
lineHeight = 55,
|
||||
lineNumbers = 56,
|
||||
lineNumbersMinChars = 57,
|
||||
linkedEditing = 58,
|
||||
links = 59,
|
||||
matchBrackets = 60,
|
||||
minimap = 61,
|
||||
mouseStyle = 62,
|
||||
mouseWheelScrollSensitivity = 63,
|
||||
mouseWheelZoom = 64,
|
||||
multiCursorMergeOverlapping = 65,
|
||||
multiCursorModifier = 66,
|
||||
multiCursorPaste = 67,
|
||||
occurrencesHighlight = 68,
|
||||
overviewRulerBorder = 69,
|
||||
overviewRulerLanes = 70,
|
||||
padding = 71,
|
||||
parameterHints = 72,
|
||||
peekWidgetDefaultFocus = 73,
|
||||
definitionLinkOpensInPeek = 74,
|
||||
quickSuggestions = 75,
|
||||
quickSuggestionsDelay = 76,
|
||||
readOnly = 77,
|
||||
renameOnType = 78,
|
||||
renderControlCharacters = 79,
|
||||
renderIndentGuides = 80,
|
||||
renderFinalNewline = 81,
|
||||
renderLineHighlight = 82,
|
||||
renderLineHighlightOnlyWhenFocus = 83,
|
||||
renderValidationDecorations = 84,
|
||||
renderWhitespace = 85,
|
||||
revealHorizontalRightPadding = 86,
|
||||
roundedSelection = 87,
|
||||
rulers = 88,
|
||||
scrollbar = 89,
|
||||
scrollBeyondLastColumn = 90,
|
||||
scrollBeyondLastLine = 91,
|
||||
scrollPredominantAxis = 92,
|
||||
selectionClipboard = 93,
|
||||
selectionHighlight = 94,
|
||||
selectOnLineNumbers = 95,
|
||||
showFoldingControls = 96,
|
||||
showUnused = 97,
|
||||
snippetSuggestions = 98,
|
||||
smartSelect = 99,
|
||||
smoothScrolling = 100,
|
||||
stickyTabStops = 101,
|
||||
stopRenderingLineAfter = 102,
|
||||
suggest = 103,
|
||||
suggestFontSize = 104,
|
||||
suggestLineHeight = 105,
|
||||
suggestOnTriggerCharacters = 106,
|
||||
suggestSelection = 107,
|
||||
tabCompletion = 108,
|
||||
tabIndex = 109,
|
||||
unusualLineTerminators = 110,
|
||||
useShadowDOM = 111,
|
||||
useTabStops = 112,
|
||||
wordSeparators = 113,
|
||||
wordWrap = 114,
|
||||
wordWrapBreakAfterCharacters = 115,
|
||||
wordWrapBreakBeforeCharacters = 116,
|
||||
wordWrapColumn = 117,
|
||||
wordWrapOverride1 = 118,
|
||||
wordWrapOverride2 = 119,
|
||||
wrappingIndent = 120,
|
||||
wrappingStrategy = 121,
|
||||
showDeprecated = 122,
|
||||
inlayHints = 123,
|
||||
editorClassName = 124,
|
||||
pixelRatio = 125,
|
||||
tabFocusMode = 126,
|
||||
layoutInfo = 127,
|
||||
wrappingInfo = 128
|
||||
inlineSuggest = 52,
|
||||
letterSpacing = 53,
|
||||
lightbulb = 54,
|
||||
lineDecorationsWidth = 55,
|
||||
lineHeight = 56,
|
||||
lineNumbers = 57,
|
||||
lineNumbersMinChars = 58,
|
||||
linkedEditing = 59,
|
||||
links = 60,
|
||||
matchBrackets = 61,
|
||||
minimap = 62,
|
||||
mouseStyle = 63,
|
||||
mouseWheelScrollSensitivity = 64,
|
||||
mouseWheelZoom = 65,
|
||||
multiCursorMergeOverlapping = 66,
|
||||
multiCursorModifier = 67,
|
||||
multiCursorPaste = 68,
|
||||
occurrencesHighlight = 69,
|
||||
overviewRulerBorder = 70,
|
||||
overviewRulerLanes = 71,
|
||||
padding = 72,
|
||||
parameterHints = 73,
|
||||
peekWidgetDefaultFocus = 74,
|
||||
definitionLinkOpensInPeek = 75,
|
||||
quickSuggestions = 76,
|
||||
quickSuggestionsDelay = 77,
|
||||
readOnly = 78,
|
||||
renameOnType = 79,
|
||||
renderControlCharacters = 80,
|
||||
renderIndentGuides = 81,
|
||||
renderFinalNewline = 82,
|
||||
renderLineHighlight = 83,
|
||||
renderLineHighlightOnlyWhenFocus = 84,
|
||||
renderValidationDecorations = 85,
|
||||
renderWhitespace = 86,
|
||||
revealHorizontalRightPadding = 87,
|
||||
roundedSelection = 88,
|
||||
rulers = 89,
|
||||
scrollbar = 90,
|
||||
scrollBeyondLastColumn = 91,
|
||||
scrollBeyondLastLine = 92,
|
||||
scrollPredominantAxis = 93,
|
||||
selectionClipboard = 94,
|
||||
selectionHighlight = 95,
|
||||
selectOnLineNumbers = 96,
|
||||
showFoldingControls = 97,
|
||||
showUnused = 98,
|
||||
snippetSuggestions = 99,
|
||||
smartSelect = 100,
|
||||
smoothScrolling = 101,
|
||||
stickyTabStops = 102,
|
||||
stopRenderingLineAfter = 103,
|
||||
suggest = 104,
|
||||
suggestFontSize = 105,
|
||||
suggestLineHeight = 106,
|
||||
suggestOnTriggerCharacters = 107,
|
||||
suggestSelection = 108,
|
||||
tabCompletion = 109,
|
||||
tabIndex = 110,
|
||||
unusualLineTerminators = 111,
|
||||
useShadowDOM = 112,
|
||||
useTabStops = 113,
|
||||
wordSeparators = 114,
|
||||
wordWrap = 115,
|
||||
wordWrapBreakAfterCharacters = 116,
|
||||
wordWrapBreakBeforeCharacters = 117,
|
||||
wordWrapColumn = 118,
|
||||
wordWrapOverride1 = 119,
|
||||
wordWrapOverride2 = 120,
|
||||
wrappingIndent = 121,
|
||||
wrappingStrategy = 122,
|
||||
showDeprecated = 123,
|
||||
inlayHints = 124,
|
||||
editorClassName = 125,
|
||||
pixelRatio = 126,
|
||||
tabFocusMode = 127,
|
||||
layoutInfo = 128,
|
||||
wrappingInfo = 129
|
||||
}
|
||||
export const EditorOptions: {
|
||||
acceptSuggestionOnCommitCharacter: IEditorOption<EditorOption.acceptSuggestionOnCommitCharacter, boolean>;
|
||||
|
@ -4250,6 +4252,7 @@ declare namespace monaco.editor {
|
|||
smoothScrolling: IEditorOption<EditorOption.smoothScrolling, boolean>;
|
||||
stopRenderingLineAfter: IEditorOption<EditorOption.stopRenderingLineAfter, number>;
|
||||
suggest: IEditorOption<EditorOption.suggest, InternalSuggestOptions>;
|
||||
inlineSuggest: IEditorOption<EditorOption.inlineSuggest, any>;
|
||||
suggestFontSize: IEditorOption<EditorOption.suggestFontSize, number>;
|
||||
suggestLineHeight: IEditorOption<EditorOption.suggestLineHeight, number>;
|
||||
suggestOnTriggerCharacters: IEditorOption<EditorOption.suggestOnTriggerCharacters, boolean>;
|
||||
|
|
|
@ -236,7 +236,8 @@ const apiMenus: IAPIMenu[] = [
|
|||
key: 'editor/inlineCompletions/actions',
|
||||
id: MenuId.InlineCompletionsActions,
|
||||
description: localize('inlineCompletions.actions', "The actions shown when hovering on an inline completion"),
|
||||
supportsSubmenus: false
|
||||
supportsSubmenus: false,
|
||||
proposed: true
|
||||
},
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue