提交 39f6fded 编写于 作者: J Joao Moreno

fixedOverflowWidgets setting

related to #13241
上级 91eb8b4b
......@@ -154,7 +154,7 @@ export class ViewContentWidgets extends ViewPart {
this._widgets[widget.getId()] = widgetData;
let domNode = widget.getDomNode();
domNode.style.position = 'fixed';
domNode.style.position = this._context.configuration.editor.viewInfo.fixedOverflowWidgets ? 'fixed' : 'absolute';
StyleMutator.setMaxWidth(domNode, this._contentWidth);
StyleMutator.setVisibility(domNode, 'hidden');
domNode.setAttribute('widgetId', widget.getId());
......@@ -280,19 +280,21 @@ export class ViewContentWidgets extends ViewPart {
if (absoluteLeft + width + 20 > INNER_WIDTH) {
let delta = absoluteLeft - (INNER_WIDTH - width - 20);
absoluteLeft -= delta;
left -= delta;
}
if (absoluteLeft < 0) {
let delta = absoluteLeft;
absoluteLeft -= delta;
left -= delta;
}
return {
aboveTop: absoluteAboveTop,
fitsAbove: fitsAbove,
belowTop: absoluteBelowTop,
fitsBelow: fitsBelow,
left: absoluteLeft
};
if (this._context.configuration.editor.viewInfo.fixedOverflowWidgets) {
aboveTop = absoluteAboveTop;
belowTop = absoluteBelowTop;
left = absoluteLeft;
}
return { aboveTop, fitsAbove, belowTop, fitsBelow, left };
}
private _prepareRenderWidgetAtExactPosition(position: Position, ctx: IRenderingContext): IMyWidgetRenderData {
......
......@@ -849,6 +849,7 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
clonedOptions.scrollbar.vertical = 'visible';
clonedOptions.folding = false;
clonedOptions.codeLens = false;
clonedOptions.fixedOverflowWidgets = true;
return clonedOptions;
}
......
......@@ -296,6 +296,7 @@ class InternalEditorOptionsHelper {
renderIndentGuides: toBoolean(opts.renderIndentGuides),
renderLineHighlight: toBoolean(opts.renderLineHighlight),
scrollbar: scrollbar,
fixedOverflowWidgets: toBoolean(opts.fixedOverflowWidgets)
});
let contribInfo = new editorCommon.EditorContribOptions({
......
......@@ -56,6 +56,7 @@ class ConfigClass implements IConfiguration {
verticalHasArrows: false,
horizontalHasArrows: false
},
fixedOverflowWidgets: false,
overviewRulerLanes: 2,
cursorBlinking: 'blink',
mouseWheelZoom: false,
......
......@@ -256,6 +256,11 @@ export interface IEditorOptions {
* Control the behavior and rendering of the scrollbars.
*/
scrollbar?: IEditorScrollbarOptions;
/**
* Display overflow widgets as `fixed`.
* Defaults to `false`.
*/
fixedOverflowWidgets?: boolean;
/**
* The number of vertical lanes the overview ruler should render.
* Defaults to 2.
......@@ -665,6 +670,7 @@ export class InternalEditorViewOptions {
readonly renderIndentGuides: boolean;
readonly renderLineHighlight: boolean;
readonly scrollbar: InternalEditorScrollbarOptions;
readonly fixedOverflowWidgets: boolean;
/**
* @internal
......@@ -695,6 +701,7 @@ export class InternalEditorViewOptions {
renderIndentGuides: boolean;
renderLineHighlight: boolean;
scrollbar: InternalEditorScrollbarOptions;
fixedOverflowWidgets: boolean;
}) {
this.theme = String(source.theme);
this.canUseTranslate3d = Boolean(source.canUseTranslate3d);
......@@ -721,6 +728,7 @@ export class InternalEditorViewOptions {
this.renderIndentGuides = Boolean(source.renderIndentGuides);
this.renderLineHighlight = Boolean(source.renderLineHighlight);
this.scrollbar = source.scrollbar.clone();
this.fixedOverflowWidgets = Boolean(source.fixedOverflowWidgets);
}
private static _toSortedIntegerArray(source: any): number[] {
......@@ -781,6 +789,7 @@ export class InternalEditorViewOptions {
&& this.renderIndentGuides === other.renderIndentGuides
&& this.renderLineHighlight === other.renderLineHighlight
&& this.scrollbar.equals(other.scrollbar)
&& this.fixedOverflowWidgets === other.fixedOverflowWidgets
);
}
......@@ -814,6 +823,7 @@ export class InternalEditorViewOptions {
renderIndentGuides: this.renderIndentGuides !== newOpts.renderIndentGuides,
renderLineHighlight: this.renderLineHighlight !== newOpts.renderLineHighlight,
scrollbar: (!this.scrollbar.equals(newOpts.scrollbar)),
fixedOverflowWidgets: this.fixedOverflowWidgets !== newOpts.fixedOverflowWidgets
};
}
......@@ -851,6 +861,7 @@ export interface IViewConfigurationChangedEvent {
readonly renderIndentGuides: boolean;
readonly renderLineHighlight: boolean;
readonly scrollbar: boolean;
readonly fixedOverflowWidgets: boolean;
}
export class EditorContribOptions {
......
......@@ -556,7 +556,8 @@ export class ReferenceWidget extends PeekViewWidget {
var options: editorCommon.IEditorOptions = {
scrollBeyondLastLine: false,
scrollbar: DefaultConfig.editor.scrollbar,
overviewRulerLanes: 2
overviewRulerLanes: 2,
fixedOverflowWidgets: true
};
this._preview = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, div.getHTMLElement(), options, this.editor);
......
......@@ -1118,6 +1118,11 @@ declare module monaco.editor {
* Control the behavior and rendering of the scrollbars.
*/
scrollbar?: IEditorScrollbarOptions;
/**
* Display overflow widgets as `fixed`.
* Defaults to `false`.
*/
fixedOverflowWidgets?: boolean;
/**
* The number of vertical lanes the overview ruler should render.
* Defaults to 2.
......@@ -1420,6 +1425,7 @@ declare module monaco.editor {
readonly renderIndentGuides: boolean;
readonly renderLineHighlight: boolean;
readonly scrollbar: InternalEditorScrollbarOptions;
readonly fixedOverflowWidgets: boolean;
}
export interface IViewConfigurationChangedEvent {
......@@ -1448,6 +1454,7 @@ declare module monaco.editor {
readonly renderIndentGuides: boolean;
readonly renderLineHighlight: boolean;
readonly scrollbar: boolean;
readonly fixedOverflowWidgets: boolean;
}
export class EditorContribOptions {
......
......@@ -119,7 +119,8 @@ export abstract class BaseTextEditor extends BaseEditor {
return {
overviewRulerLanes: 3,
lineNumbersMinChars: 3,
theme: this.themeService.getColorTheme()
theme: this.themeService.getColorTheme(),
fixedOverflowWidgets: true
};
}
......
......@@ -269,7 +269,8 @@ export class Repl extends Panel implements IPrivateReplService {
lineDecorationsWidth: 0,
scrollBeyondLastLine: false,
theme: this.themeService.getColorTheme(),
renderLineHighlight: false
renderLineHighlight: false,
fixedOverflowWidgets: true
};
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册