Skip to content

Commit

Permalink
Format code in extension.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ono-max authored and ko1 committed Oct 4, 2022
1 parent e7e1fec commit a6c3aa4
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ function workspace_folder(): string | undefined {
}

function custom_path(working_directory: string): string {
if (path.isAbsolute(working_directory)) {
return working_directory;
} else {
const wspath = workspace_folder();

if (wspath) {
return path.join(wspath, working_directory);
} else {
return working_directory;
}
}
if (path.isAbsolute(working_directory)) {
return working_directory;
} else {
const wspath = workspace_folder();

if (wspath) {
return path.join(wspath, working_directory);
} else {
return working_directory;
}
}
}

function pp(obj: any) {
Expand Down Expand Up @@ -216,7 +216,7 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
show_error(msg: string): void {
outputChannel.appendLine("Error: " + msg);
outputChannel.appendLine("Make sure to install rdbg command (`gem install debug`).\n" +
"If you are using bundler, write `gem 'debug'` in your Gemfile.");
"If you are using bundler, write `gem 'debug'` in your Gemfile.");
outputChannel.show();
}

Expand Down Expand Up @@ -263,7 +263,7 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
})
}

parse_port(port: string) : [string | undefined, number | undefined, string | undefined] {
parse_port(port: string): [string | undefined, number | undefined, string | undefined] {
var m;

if (port.match(/^\d+$/)) {
Expand Down Expand Up @@ -296,20 +296,20 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
outputChannel.appendLine(JSON.stringify(list));

switch (list.length) {
case 0:
vscode.window.showErrorMessage("Can not find attachable Ruby process.");
return new DebugAdapterInlineImplementation(new StopDebugAdapter);
case 1:
sock_path = list[0];
break;
default:
const sock = await vscode.window.showQuickPick(list);
if (sock) {
sock_path = sock;
}
else {
case 0:
vscode.window.showErrorMessage("Can not find attachable Ruby process.");
return new DebugAdapterInlineImplementation(new StopDebugAdapter);
}
case 1:
sock_path = list[0];
break;
default:
const sock = await vscode.window.showQuickPick(list);
if (sock) {
sock_path = sock;
}
else {
return new DebugAdapterInlineImplementation(new StopDebugAdapter);
}
}
}

Expand All @@ -329,7 +329,7 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
return new Promise((resolve) => {
const rdbg = config.rdbgPath || "rdbg";
const command = this.make_shell_command(rdbg + " --util=gen-sockpath");
const p = child_process.exec(command, {cwd: config.cwd ? custom_path(config.cwd) : workspace_folder()});
const p = child_process.exec(command, { cwd: config.cwd ? custom_path(config.cwd) : workspace_folder() });
let path: string;

p.on('error', e => {
Expand Down Expand Up @@ -358,7 +358,7 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
return new Promise((resolve) => {
const rdbg = config.rdbgPath || "rdbg";
const command = this.make_shell_command(rdbg + " --util=gen-portpath");
const p = child_process.exec(command, {cwd: config.cwd ? custom_path(config.cwd) : workspace_folder()});
const p = child_process.exec(command, { cwd: config.cwd ? custom_path(config.cwd) : workspace_folder() });
let path: string;

p.on('error', e => {
Expand All @@ -380,7 +380,7 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
return new Promise((resolve) => {
const rdbg = config.rdbgPath || "rdbg";
const command = this.make_shell_command(rdbg + " --version");
const p = child_process.exec(command, {cwd: config.cwd ? custom_path(config.cwd) : workspace_folder()});
const p = child_process.exec(command, { cwd: config.cwd ? custom_path(config.cwd) : workspace_folder() });
let version: string;

p.on('error', e => {
Expand Down Expand Up @@ -416,7 +416,7 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
}
}

env_prefix(env?: {[key: string]: string}): string {
env_prefix(env?: { [key: string]: string }): string {
if (env) {
let prefix = "";
for (const key in env) {
Expand All @@ -438,7 +438,7 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
}

async wait_file(path: string, wait_ms: number | undefined): Promise<boolean> {
let iterations : number = 30;
let iterations: number = 30;
if (wait_ms) {
iterations = wait_ms / 100;
}
Expand All @@ -464,10 +464,10 @@ class RdbgAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
// outputChannel.appendLine(JSON.stringify(session));

// setup debugPort
let sock_path : string | undefined;
let tcp_host : string | undefined;
let tcp_port : number | undefined;
let tcp_port_file : string | undefined;
let sock_path: string | undefined;
let tcp_host: string | undefined;
let tcp_port: number | undefined;
let tcp_port_file: string | undefined;

if (config.debugPort) {
[tcp_host, tcp_port, sock_path] = this.parse_port(config.debugPort);
Expand Down

0 comments on commit a6c3aa4

Please sign in to comment.