Skip to content

Commit

Permalink
Code clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Nikitenko <[email protected]>
  • Loading branch information
RomanNikitenko committed Mar 2, 2020
1 parent 68302ba commit 313d31c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions packages/console/src/browser/console-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { ProtocolToMonacoConverter, MonacoToProtocolConverter } from 'monaco-lan
import { ConsoleHistory } from './console-history';
import { ConsoleContentWidget } from './console-content-widget';
import { ConsoleSession } from './console-session';
import EditorOption = monaco.editor.EditorOption;

export const ConsoleOptions = Symbol('ConsoleWidgetOptions');
export interface ConsoleOptions {
Expand Down Expand Up @@ -127,7 +126,7 @@ export class ConsoleWidget extends BaseWidget implements StatefulWidget {
}

protected updateFont(): void {
const { fontFamily, fontSize, lineHeight } = this._input.getControl().getOption(EditorOption.fontInfo);
const { fontFamily, fontSize, lineHeight } = this._input.getControl().getOption(monaco.editor.EditorOption.fontInfo);
this.content.node.style.fontFamily = fontFamily;
this.content.node.style.fontSize = fontSize + 'px';
this.content.node.style.lineHeight = lineHeight + 'px';
Expand Down
5 changes: 2 additions & 3 deletions packages/debug/src/browser/editor/debug-exception-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposa
import { MonacoEditorZoneWidget } from '@theia/monaco/lib/browser/monaco-editor-zone-widget';
import { DebugEditor } from './debug-editor';
import { DebugExceptionInfo } from '../model/debug-thread';
import EditorOption = monaco.editor.EditorOption;

export interface ShowDebugExceptionParams {
info: DebugExceptionInfo
Expand Down Expand Up @@ -53,7 +52,7 @@ export class DebugExceptionWidget implements Disposable {
show({ info, lineNumber, column }: ShowDebugExceptionParams): void {
this.render(info);

const fontInfo = this.editor.getControl().getOption(EditorOption.fontInfo);
const fontInfo = this.editor.getControl().getOption(monaco.editor.EditorOption.fontInfo);
this.zone.containerNode.style.fontSize = `${fontInfo.fontSize}px`;
this.zone.containerNode.style.lineHeight = `${fontInfo.lineHeight}px`;

Expand All @@ -76,7 +75,7 @@ export class DebugExceptionWidget implements Disposable {
{info.description && <div className='description'>{info.description}</div>}
{stackTrace && <div className='stack-trace'>{stackTrace}</div>}
</React.Fragment>, this.zone.containerNode, () => {
const lineHeight = this.editor.getControl().getOption(EditorOption.lineHeight);
const lineHeight = this.editor.getControl().getOption(monaco.editor.EditorOption.lineHeight);
const heightInLines = Math.ceil(this.zone.containerNode.offsetHeight / lineHeight);
this.zone.layout(heightInLines);
});
Expand Down
5 changes: 2 additions & 3 deletions packages/monaco/src/browser/monaco-editor-zone-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*--------------------------------------------------------------------------------------------*/

import { Disposable, DisposableCollection, Event, Emitter } from '@theia/core';
import EditorOption = monaco.editor.EditorOption;

export interface MonacoEditorViewZone extends monaco.editor.IViewZone {
id: string;
Expand Down Expand Up @@ -67,7 +66,7 @@ export class MonacoEditorZoneWidget implements Disposable {

show(options: MonacoEditorZoneWidget.Options): void {
let { afterLineNumber, afterColumn, heightInLines } = this._options = { showFrame: true, ...options };
const lineHeight = this.editor.getOption(EditorOption.lineHeight);
const lineHeight = this.editor.getOption(monaco.editor.EditorOption.lineHeight);
const maxHeightInLines = (this.editor.getLayoutInfo().height / lineHeight) * .8;
if (heightInLines >= maxHeightInLines) {
heightInLines = maxHeightInLines;
Expand Down Expand Up @@ -141,7 +140,7 @@ export class MonacoEditorZoneWidget implements Disposable {
height: number,
frameWidth: number
} {
const lineHeight = this.editor.getOption(EditorOption.lineHeight);
const lineHeight = this.editor.getOption(monaco.editor.EditorOption.lineHeight);
const frameWidth = this._options && this._options.frameWidth;
const frameThickness = this._options && this._options.showFrame ? Math.round(lineHeight / 9) : 0;
return {
Expand Down
3 changes: 1 addition & 2 deletions packages/monaco/src/browser/monaco-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import IEditorOverrideServices = monaco.editor.IEditorOverrideServices;
import IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor;
import IIdentifiedSingleEditOperation = monaco.editor.IIdentifiedSingleEditOperation;
import IBoxSizing = ElementExt.IBoxSizing;
import EditorOption = monaco.editor.EditorOption;

@injectable()
export class MonacoEditorServices {
Expand Down Expand Up @@ -384,7 +383,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
return hostNode.offsetHeight - boxSizing.verticalSum;
}

const lineHeight = this.editor.getOption(EditorOption.lineHeight);
const lineHeight = this.editor.getOption(monaco.editor.EditorOption.lineHeight);
const lineCount = this.editor.getModel()!.getLineCount();
const contentHeight = lineHeight * lineCount;

Expand Down
5 changes: 2 additions & 3 deletions packages/plugin-ext/src/main/browser/text-editor-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { Range } from '../../common/plugin-api-rpc-model';
import { Emitter, Event } from '@theia/core';
import { TextEditorCursorStyle, cursorStyleToString } from '../../common/editor-options';
import { TextEditorLineNumbersStyle, EndOfLine } from '../../plugin/types-impl';
import EditorOption = monaco.editor.EditorOption;

export class TextEditorMain implements Disposable {

Expand Down Expand Up @@ -385,8 +384,8 @@ export class TextEditorPropertiesMain {
let lineNumbers: TextEditorLineNumbersStyle;
if (editor) {
const editorOptions = editor.getControl().getOptions();
const lineNumbersOpts = editorOptions.get(EditorOption.lineNumbers);
cursorStyle = editorOptions.get(EditorOption.cursorStyle);
const lineNumbersOpts = editorOptions.get(monaco.editor.EditorOption.lineNumbers);
cursorStyle = editorOptions.get(monaco.editor.EditorOption.cursorStyle);
switch (lineNumbersOpts.renderType) {
case monaco.editor.RenderLineNumbersType.Off:
lineNumbers = TextEditorLineNumbersStyle.Off;
Expand Down

0 comments on commit 313d31c

Please sign in to comment.