Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 1755239

Browse files
committed
Release 0.2.0
We already have most of the functionality for ruby scripts debugging * Line breakpoints (add, delete, disable, enable) * Step over, step in, step out, continue, pause * Multiple, parallel threads * Call stack * Scope, global variables * Debug console * Watch window * Variables evaluate/inspect * Stop on entry * Breaking on uncaught exceptions and errors
1 parent f7874e2 commit 1755239

File tree

4 files changed

+36
-16
lines changed

4 files changed

+36
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Ruby",
33
"displayName": "Ruby",
4-
"version": "0.1.9",
4+
"version": "0.2.0",
55
"publisher": "rebornix",
66
"description": "Provides Ruby language and debugging support for Visual Studio Code",
77
"author": {

readme.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Ruby Language and Debugging Support for Visual Studio Code
22

3-
[![Join the chat at https://gitter.im/rebornix/vscode-ruby](https://badges.gitter.im/rebornix/vscode-ruby.svg)](https://gitter.im/rebornix/vscode-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/rebornix/vscode-ruby.svg?branch=master)](https://travis-ci.org/rebornix/vscode-ruby) [![Build status](https://ci.appveyor.com/api/projects/status/s4sv1fwpjeqmgnhd?svg=true)](https://ci.appveyor.com/project/rebornix/vscode-ruby) [![GitHub release](https://img.shields.io/github/release/rebornix/vscode-ruby.svg)](https://github.com/rebornix/vscode-ruby)
3+
[![Join the chat at https://gitter.im/rebornix/vscode-ruby](https://badges.gitter.im/rebornix/vscode-ruby.svg)](https://gitter.im/rebornix/vscode-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/rebornix/vscode-ruby.svg?branch=master)](https://travis-ci.org/rebornix/vscode-ruby) [![Build status](https://ci.appveyor.com/api/projects/status/s4sv1fwpjeqmgnhd?svg=true)](https://ci.appveyor.com/project/rebornix/vscode-ruby)
44

55

6-
This extension provides rich Ruby language and debugging support for Visual Studio Code.
6+
This extension provides rich Ruby language and debugging support for Visual Studio Code. Fully tested against *inx/Windows and Ruby 1.9.3 to 2.2.0.
77
It's still in progress ( [GitHub](https://github.com/rebornix/vscode-ruby.git) ), please expect frequent updates with breaking changes before 1.0.
88

99
## Install
@@ -50,12 +50,12 @@ In this extension, we implement [ruby debug ide protocol](http://debug-commons.r
5050
* Debug console
5151
* Watch window
5252
* Variables evaluate/inspect
53+
* Stop on entry
54+
* Breaking on uncaught exceptions and errors
5355

5456
## TODO
5557
- Ruby scripts debugging
5658
* Conditional breakpoints
57-
* Break on entry
58-
* Breaking on uncaught exceptions and errors
5959
* Attach requests
6060
- Ruby remote debug
6161
- Unit/Integration tests debugging
@@ -71,6 +71,10 @@ In this extension, we implement [ruby debug ide protocol](http://debug-commons.r
7171
- IntelliSense and autocomplete
7272
- Linting
7373

74+
## Main contributors
75+
76+
- [@rebornix](https://github.com/rebornix)
77+
- [@HookyQR](https://github.com/HookyQR)
7478

7579
## License
7680

src/main.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ class RubyDebugSession extends DebugSession {
7575
}).on('breakpoint', result => {
7676
this.sendEvent(new StoppedEvent('breakpoint', result.threadId));
7777
}).on('suspended', result => {
78-
if ( args.stopOnEntry && !this._firstSuspendReceived )
78+
if ( args.stopOnEntry && !this._firstSuspendReceived ) {
7979
this.sendEvent(new StoppedEvent('entry', result.threadId));
80-
else
80+
}
81+
else {
8182
this.sendEvent(new StoppedEvent('step', result.threadId));
83+
}
84+
8285
this._firstSuspendReceived = true;
8386
}).on('exception', result => {
8487
this.sendEvent(new OutputEvent("\nException raised: [" + result.type + "]: " + result.message + "\n",'stderr'));
@@ -101,6 +104,7 @@ class RubyDebugSession extends DebugSession {
101104
this.rubyProcess.Run('start');
102105
this.sendResponse(response);
103106
}
107+
104108
protected setExceptionBreakPointsRequest(response: DebugProtocol.SetExceptionBreakpointsResponse, args: DebugProtocol.SetExceptionBreakpointsArguments): void {
105109
if (args.filters.indexOf('all') >=0){
106110
//Exception is the root of all (Ruby) exceptions - this is the best we can do
@@ -117,6 +121,7 @@ class RubyDebugSession extends DebugSession {
117121
}
118122
this.sendResponse(response);
119123
}
124+
120125
protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): void {
121126
var path = args.source.path;
122127

@@ -212,6 +217,7 @@ class RubyDebugSession extends DebugSession {
212217
}
213218
return variable;
214219
}
220+
215221
protected createVariableReference(variables): IRubyEvaluationResult[]{
216222
return variables.map(this.varyVariable).map(variable=>({
217223
name: variable.name,
@@ -222,6 +228,7 @@ class RubyDebugSession extends DebugSession {
222228
variablesReference: variable.hasChildren === 'true' ? this._variableHandles.create({objectId:variable.objectId}):0
223229
}));
224230
}
231+
225232
/** Scopes request; value of command field is 'scopes'.
226233
The request returns the variable scopes for a given stackframe ID.
227234
*/
@@ -251,7 +258,9 @@ class RubyDebugSession extends DebugSession {
251258
if ( varRef.objectId ){
252259
varPromise = this.rubyProcess.Enqueue('var i ' + varRef.objectId).then(results => this.createVariableReference(results));
253260
}
254-
else varPromise = Promise.resolve(varRef.variables);
261+
else {
262+
varPromise = Promise.resolve(varRef.variables);
263+
}
255264

256265
varPromise.then(variables =>{
257266
response.body = {

src/ruby.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class RubyProcess extends EventEmitter {
5858
runtimeExecutable = 'rdebug-ide.bat';
5959
}
6060
else {
61-
// platform: linux
61+
// platform: linux or darwin
6262
runtimeExecutable = 'rdebug-ide';
6363
}
6464

@@ -67,17 +67,18 @@ export class RubyProcess extends EventEmitter {
6767
if (args.showDebuggerOutput){
6868
runtimeArgs.push('-x');
6969
}
70+
7071
if (args.stopOnEntry){
7172
runtimeArgs.push('--stop');
7273
}
73-
//the program is also required
74-
var spawnArgs = runtimeArgs.concat(args.program, ...(args.args||[]));
75-
this.debugprocess = childProcess.spawn(runtimeExecutable, spawnArgs, {cwd: processCwd});
74+
75+
this.debugprocess = childProcess.spawn(runtimeExecutable, [...runtimeArgs, args.program, ...args.args], {cwd: processCwd});
7676

7777
// redirect output to debug console
7878
this.debugprocess.stdout.on('data', (data: Buffer) => {
7979
this.emit('executableOutput', data);
8080
});
81+
8182
this.debugprocess.stderr.on('data', (data: Buffer) => {
8283
if (/^Fast Debugger/.test(data.toString())) {
8384
this.debugSocketClient.connect(1234);
@@ -89,9 +90,11 @@ export class RubyProcess extends EventEmitter {
8990
this.emit('executableStdErr', data);
9091
}
9192
});
93+
9294
this.debugprocess.on('exit', () => {
9395
this.emit('debuggerProcessExit');
9496
});
97+
9598
this.debugprocess.on('error', (error: Error) => {
9699
this.emit('terminalError', "Process failed: " + error.message);
97100
});
@@ -105,6 +108,7 @@ export class RubyProcess extends EventEmitter {
105108
this.debugSocketClient = new net.Socket( {
106109
type: 'tcp4'
107110
});
111+
108112
this.debugSocketClient.on('connect', (buffer: Buffer) => {
109113
this.state = SocketClientState.connected;
110114
//first thing we have to send is the start - if stopOnEntry is
@@ -116,6 +120,7 @@ export class RubyProcess extends EventEmitter {
116120
this.emit('debuggerConnect');
117121
this.pendingCommands = [];
118122
});
123+
119124
this.debugSocketClient.on('end', (ex) => {
120125
this.state = SocketClientState.closed;
121126
// Emitted when the other end of the socket sends a FIN packet.
@@ -208,17 +213,18 @@ export class RubyProcess extends EventEmitter {
208213
if (this.state !== SocketClientState.connected) {
209214
var newCommand = {
210215
command: cmd,
211-
resolve: ()=>0,
212-
reject: ()=>0
216+
resolve: () => 0,
217+
reject: () => 0
213218
};
214219
this.pendingCommands.push(newCommand);
215220
}
216-
else this.debugSocketClient.write(cmd + '\n');
221+
else {
222+
this.debugSocketClient.write(cmd + '\n');
223+
}
217224
}
218225

219226
public Enqueue(cmd: string): Promise<any> {
220227
var pro = new Promise<any>((resolve, reject) => {
221-
222228
var newCommand = {
223229
command: cmd,
224230
resolve: resolve,
@@ -232,6 +238,7 @@ export class RubyProcess extends EventEmitter {
232238
this.debugSocketClient.write(newCommand.command + '\n');
233239
}
234240
});
241+
235242
return pro;
236243
}
237244

0 commit comments

Comments
 (0)