Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes apply debug console font size setting to input field #91261

Merged
merged 4 commits into from
Apr 7, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/vs/workbench/contrib/debug/browser/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ReplGroup } from 'vs/workbench/contrib/debug/common/replModel';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions';

const $ = dom.$;

Expand All @@ -75,7 +76,6 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
_serviceBrand: undefined;

private static readonly REFRESH_DELAY = 100; // delay in ms to refresh the repl for new elements to show
private static readonly REPL_INPUT_LINE_HEIGHT = 19;
private static readonly URI = uri.parse(`${DEBUG_SCHEME}:replinput`);

private history: HistoryNavigator<string>;
Expand Down Expand Up @@ -305,6 +305,16 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
`;

this.tree.rerender();

this.replInput.updateOptions({
fontSize,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not take the fontFamily, lineHeight computed above? Why use debugConsole.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those values are for the inline css

  • lineHeight computed above has type string (? `${debugConsole.lineHeight}px` : '1.4em') and the one needed for updateOptions must be number
  • fontFamily computed above resolves to 'var(--monaco-monospace-font)' when the default font is requested

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thank you

lineHeight: debugConsole.lineHeight,
fontFamily: debugConsole.fontFamily === 'default' ? EDITOR_FONT_DEFAULTS.fontFamily : debugConsole.fontFamily
});

if (this.dimension) {
this.layoutBody(this.dimension.height, this.dimension.width);
}
}
}

Expand Down Expand Up @@ -396,7 +406,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {

protected layoutBody(height: number, width: number): void {
this.dimension = new dom.Dimension(width, height);
const replInputHeight = Repl.REPL_INPUT_LINE_HEIGHT * this.replInputLineCount;
const replInputHeight = this.replInput.getContentHeight();
if (this.tree) {
const lastElementVisible = this.tree.scrollTop + this.tree.renderHeight >= this.tree.scrollHeight;
const treeHeight = height - replInputHeight;
Expand Down