Skip to content

Commit

Permalink
Reformat code after rebasing
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoliy Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Aug 14, 2018
1 parent d3140c6 commit d718177
Show file tree
Hide file tree
Showing 22 changed files with 764 additions and 303 deletions.
16 changes: 8 additions & 8 deletions packages/debug-nodejs/src/node/debug-nodejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const path = require('path');
const packageJson = require('../../package.json');
const debugAdapterDir = packageJson['debugAdapter']['dir'];

import { injectable } from "inversify";
import { DebugConfiguration } from "@theia/debug/lib/common/debug-common";
import { DebugAdapterContribution, DebugAdapterExecutable } from "@theia/debug/lib/node/debug-model";
import { injectable } from 'inversify';
import { DebugConfiguration } from '@theia/debug/lib/common/debug-common';
import { DebugAdapterContribution, DebugAdapterExecutable } from '@theia/debug/lib/node/debug-model';

@injectable()
export class NodeJsDebugAdapterContribution implements DebugAdapterContribution {
readonly debugType = "node";
readonly debugType = 'node';

provideDebugConfigurations = [{
type: this.debugType,
Expand All @@ -38,11 +38,11 @@ export class NodeJsDebugAdapterContribution implements DebugAdapterContribution
config.breakpoints = { filePatterns: ['[.]js$', '[.]ts$'] };

if (!config.request) {
throw new Error("Debug request type isn't provided.");
throw new Error('Debug request type is not provided.');
}

switch (config.request) {
case "attach": this.validateAttachConfig(config);
case 'attach': this.validateAttachConfig(config);
}

return config;
Expand All @@ -52,13 +52,13 @@ export class NodeJsDebugAdapterContribution implements DebugAdapterContribution
const program = path.join(__dirname, `../../${debugAdapterDir}/out/src/nodeDebug.js`);
return {
program,
runtime: "node"
runtime: 'node'
};
}

private validateAttachConfig(config: DebugConfiguration) {
if (!config.processId) {
throw new Error("PID isn't provided.");
throw new Error('PID is not provided.');
}
}
}
12 changes: 6 additions & 6 deletions packages/debug/src/browser/breakpoint/breakpoint-decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { injectable, inject } from "inversify";
import { injectable, inject } from 'inversify';
import {
Range,
EditorDecorator,
EditorDecorationOptions,
TextEditor,
Position,
EditorManager
} from "@theia/editor/lib/browser";
import { DebugProtocol } from "vscode-debugprotocol";
import { DebugSessionManager } from "../debug-session";
import { DebugUtils } from "../debug-utils";
import { BreakpointStorage } from "./breakpoint-marker";
} from '@theia/editor/lib/browser';
import { DebugProtocol } from 'vscode-debugprotocol';
import { DebugSessionManager } from '../debug-session';
import { DebugUtils } from '../debug-utils';
import { BreakpointStorage } from './breakpoint-marker';

const ActiveLineDecoration = <EditorDecorationOptions>{
isWholeLine: true,
Expand Down
24 changes: 12 additions & 12 deletions packages/debug/src/browser/breakpoint/breakpoint-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { DebugSession } from "../debug-model";
import { DebugSessionManager } from "../debug-session";
import { injectable, inject } from "inversify";
import { DebugProtocol } from "vscode-debugprotocol";
import { SourceOpener, DebugUtils } from "../debug-utils";
import { FrontendApplicationContribution } from "@theia/core/lib/browser";
import { ActiveLineDecorator, BreakpointDecorator } from "./breakpoint-decorators";
import { BreakpointStorage } from "./breakpoint-marker";
import { DebugSession } from '../debug-model';
import { DebugSessionManager } from '../debug-session';
import { injectable, inject } from 'inversify';
import { DebugProtocol } from 'vscode-debugprotocol';
import { SourceOpener, DebugUtils } from '../debug-utils';
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
import { ActiveLineDecorator, BreakpointDecorator } from './breakpoint-decorators';
import { BreakpointStorage } from './breakpoint-marker';
import {
EditorManager,
EditorWidget,
Position,
TextEditor,
MouseTargetType
} from "@theia/editor/lib/browser";
import { ExtDebugProtocol, DebugService } from "../../common/debug-common";
import { Emitter, Event } from "@theia/core";
import { BreakpointsApplier } from "./breakpoint-applier";
} from '@theia/editor/lib/browser';
import { ExtDebugProtocol, DebugService } from '../../common/debug-common';
import { Emitter, Event } from '@theia/core';
import { BreakpointsApplier } from './breakpoint-applier';

/**
* The breakpoint manager implementation.
Expand Down
10 changes: 5 additions & 5 deletions packages/debug/src/browser/breakpoint/breakpoint-marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { injectable } from "inversify";
import { ExtDebugProtocol } from "../../common/debug-common";
import { DebugUtils } from "../debug-utils";
import { MarkerManager } from "@theia/markers/lib/browser/marker-manager";
import { injectable } from 'inversify';
import { ExtDebugProtocol } from '../../common/debug-common';
import { DebugUtils } from '../debug-utils';
import { MarkerManager } from '@theia/markers/lib/browser/marker-manager';
import URI from '@theia/core/lib/common/uri';
import { Marker } from "@theia/markers/lib/common/marker";
import { Marker } from '@theia/markers/lib/common/marker';

export const BREAKPOINT_KIND = 'breakpoint';
const BREAKPOINT_OWNER = 'breakpoint';
Expand Down
22 changes: 11 additions & 11 deletions packages/debug/src/browser/debug-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { injectable, inject } from "inversify";
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from "@theia/core/lib/common";
import { MAIN_MENU_BAR, MenuPath } from "@theia/core/lib/common/menu";
import { DebugService } from "../common/debug-common";
import { DebugSessionManager } from "./debug-session";
import { DebugConfigurationManager } from "./debug-configuration";
import { DebugSelectionService } from "./view/debug-selection-service";
import { SingleTextInputDialog } from "@theia/core/lib/browser/dialogs";
import { DebugProtocol } from "vscode-debugprotocol";
import { BreakpointsDialog } from "./view/debug-breakpoints-widget";
import { injectable, inject } from 'inversify';
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core/lib/common';
import { MAIN_MENU_BAR, MenuPath } from '@theia/core/lib/common/menu';
import { DebugService } from '../common/debug-common';
import { DebugSessionManager } from './debug-session';
import { DebugConfigurationManager } from './debug-configuration';
import { DebugSelectionService } from './view/debug-selection-service';
import { SingleTextInputDialog } from '@theia/core/lib/browser/dialogs';
import { DebugProtocol } from 'vscode-debugprotocol';
import { BreakpointsDialog } from './view/debug-breakpoints-widget';

export const DEBUG_SESSION_CONTEXT_MENU: MenuPath = ['debug-session-context-menu'];
export const DEBUG_SESSION_THREAD_CONTEXT_MENU: MenuPath = ['debug-session-thread-context-menu'];
Expand All @@ -47,7 +47,7 @@ export namespace DebugVariableContextMenu {
}

export namespace DebugMenus {
export const DEBUG = [...MAIN_MENU_BAR, "4_debug"];
export const DEBUG = [...MAIN_MENU_BAR, '4_debug'];
export const DEBUG_STOP = [...DEBUG, '2_stop'];
export const DEBUG_START = [...DEBUG_STOP, '1_start'];

Expand Down
61 changes: 31 additions & 30 deletions packages/debug/src/browser/debug-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { injectable, inject } from "inversify";
import { FileSystem, FileStat } from "@theia/filesystem/lib/common";
import { injectable, inject } from 'inversify';
import { FileSystem, FileStat } from '@theia/filesystem/lib/common';
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
import { Deferred } from "@theia/core/lib/common/promise-util";
import URI from "@theia/core/lib/common/uri";
import { EditorManager, EditorWidget } from "@theia/editor/lib/browser";
import { QuickOpenService, QuickOpenItem, QuickOpenMode } from "@theia/core/lib/browser";
import { DebugService, DebugConfiguration } from "../common/debug-common";
import { Deferred } from '@theia/core/lib/common/promise-util';
import URI from '@theia/core/lib/common/uri';
import { EditorManager, EditorWidget } from '@theia/editor/lib/browser';
import { QuickOpenService, QuickOpenItem, QuickOpenMode } from '@theia/core/lib/browser';
import { DebugService, DebugConfiguration } from '../common/debug-common';

@injectable()
export class DebugConfigurationManager {
private static readonly CONFIG = ".theia/launch.json";
private static readonly CONFIG = '.theia/launch.json';

@inject(FileSystem)
protected readonly fileSystem: FileSystem;
Expand Down Expand Up @@ -66,10 +66,10 @@ export class DebugConfigurationManager {
return this.readConfigurations()
.then(configurations => {
if (configurations.length !== 0) {
const items = configurations.map(configuration => this.toQuickOpenItem(configuration.type + " : " + configuration.name, result, configuration));
const items = configurations.map(configuration => this.toQuickOpenItem(configuration.type + ' : ' + configuration.name, result, configuration));
return Promise.resolve(items);
}
return Promise.reject("There are no provided debug configurations.");
return Promise.reject('There are no provided debug configurations.');
})
.then(items => this.doOpen(items))
.then(() => result.promise);
Expand All @@ -86,7 +86,7 @@ export class DebugConfigurationManager {
try {
return JSON.parse(content);
} catch (error) {
return Promise.reject("Configuration file bad format.");
return Promise.reject('Configuration file bad format.');
}
});
}
Expand All @@ -105,24 +105,25 @@ export class DebugConfigurationManager {
* @returns [configuration file](#FileStat).
*/
resolveConfigurationFile(): Promise<FileStat> {
return this.workspaceService.root.then(root => {
if (root) {
const uri = root.uri + "/" + DebugConfigurationManager.CONFIG;
return this.fileSystem.exists(uri).then(exists => ({ exists, uri }));
}
return Promise.reject("Workspace is not opened yet.");
}).then(({ exists, uri }) => {
if (exists) {
return this.fileSystem.getFileStat(uri);
} else {
return this.fileSystem.createFile(uri, { encoding: "utf8" });
}
}).then(configFile => {
if (configFile) {
return Promise.resolve(configFile);
}
return Promise.reject(`Configuration file '${DebugConfigurationManager.CONFIG}' not found.`);
});
const root = this.workspaceService.tryGetRoots()[0];
if (!root) {
return Promise.reject('Workspace is not opened yet.');
}

const uri = root.uri + '/' + DebugConfigurationManager.CONFIG;
return this.fileSystem.exists(uri)
.then(exists => {
if (exists) {
return this.fileSystem.getFileStat(uri);
} else {
return this.fileSystem.createFile(uri, { encoding: 'utf8' });
}
}).then(configFile => {
if (configFile) {
return Promise.resolve(configFile);
}
return Promise.reject(`Configuration file '${DebugConfigurationManager.CONFIG}' not found.`);
});
}

private provideDebugTypes(): Promise<string> {
Expand All @@ -134,7 +135,7 @@ export class DebugConfigurationManager {
const items = debugTypes.map(debugType => this.toQuickOpenItem(debugType, result, debugType));
return Promise.resolve(items);
}
return Promise.reject("There are no registered debug adapters.");
return Promise.reject('There are no registered debug adapters.');
})
.then(items => this.doOpen(items))
.then(() => result.promise);
Expand Down
10 changes: 5 additions & 5 deletions packages/debug/src/browser/debug-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
********************************************************************************/

import { ContainerModule, interfaces, Container } from 'inversify';
import { DebugCommandHandlers, DEBUG_VARIABLE_CONTEXT_MENU } from "./debug-command";
import { DebugCommandHandlers, DEBUG_VARIABLE_CONTEXT_MENU } from './debug-command';
import { DebugConfigurationManager } from './debug-configuration';
import {
DebugViewContribution,
DebugWidget,
DEBUG_FACTORY_ID,
DebugTargetWidget,
} from './view/debug-view-contribution';
import { DebugPath, DebugService } from "../common/debug-common";
import { MenuContribution } from "@theia/core/lib/common/menu";
import { CommandContribution } from "@theia/core/lib/common/command";
import { DebugPath, DebugService } from '../common/debug-common';
import { MenuContribution } from '@theia/core/lib/common/menu';
import { CommandContribution } from '@theia/core/lib/common/command';
import {
WidgetFactory,
bindViewContribution,
Expand Down Expand Up @@ -96,7 +96,7 @@ function bindDebugView(bind: interfaces.Bind): void {
bind(DebugTargetWidget).toSelf();
bind(DebugSelectionService).toSelf().inSingletonScope();

bind<interfaces.Factory<DebugTargetWidget>>("Factory<DebugTargetWidget>").toFactory<DebugTargetWidget>(context =>
bind<interfaces.Factory<DebugTargetWidget>>('Factory<DebugTargetWidget>').toFactory<DebugTargetWidget>(context =>
(debugSession: DebugSession) => {
const container = createDebugTargetContainer(context, debugSession);
return container.get<DebugTargetWidget>(DebugTargetWidget);
Expand Down
12 changes: 6 additions & 6 deletions packages/debug/src/browser/debug-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { DebugConfiguration, DebugSessionState } from "../common/debug-common";
import { Disposable } from "@theia/core";
import { DebugProtocol } from "vscode-debugprotocol";
import { DebugConfiguration, DebugSessionState } from '../common/debug-common';
import { Disposable } from '@theia/core';
import { DebugProtocol } from 'vscode-debugprotocol';

/**
* DebugSession symbol for DI.
*/
export const DebugSession = Symbol("DebugSession");
export const DebugSession = Symbol('DebugSession');

/**
* The debug session.
Expand Down Expand Up @@ -56,7 +56,7 @@ export interface DebugSession extends Disposable, NodeJS.EventEmitter {
/**
* DebugSessionFactory symbol for DI.
*/
export const DebugSessionFactory = Symbol("DebugSessionFactory");
export const DebugSessionFactory = Symbol('DebugSessionFactory');

/**
* The [debug session](#DebugSession) factory.
Expand All @@ -68,7 +68,7 @@ export interface DebugSessionFactory {
/**
* DebugSessionContribution symbol for DI.
*/
export const DebugSessionContribution = Symbol("DebugSessionContribution");
export const DebugSessionContribution = Symbol('DebugSessionContribution');

/**
* The [debug session](#DebugSession) contribution.
Expand Down
Loading

0 comments on commit d718177

Please sign in to comment.