-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed .vscodeignore * You can launch applications with vcode's debugger, not actuall debugging do. * Fixed small configuration typos
- Loading branch information
Showing
7 changed files
with
170 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
export function registerCommands(context: vscode.ExtensionContext) { | ||
context.subscriptions.push( | ||
vscode.commands.registerCommand('extension.lobster.runEditorContents', (resource: vscode.Uri) => { | ||
let targetResource = resource; | ||
if (!targetResource && vscode.window.activeTextEditor) { | ||
targetResource = vscode.window.activeTextEditor.document.uri; | ||
} | ||
if (targetResource) { | ||
vscode.debug.startDebugging(undefined, { | ||
type: 'lobster', | ||
name: 'Run File', | ||
request: 'launch', | ||
program: targetResource.fsPath | ||
}, | ||
{ noDebug: true } | ||
); | ||
} | ||
}), | ||
vscode.commands.registerCommand('extension.lobster.debugEditorContents', (resource: vscode.Uri) => { | ||
let targetResource = resource; | ||
if (!targetResource && vscode.window.activeTextEditor) { | ||
targetResource = vscode.window.activeTextEditor.document.uri; | ||
} | ||
if (targetResource) { | ||
vscode.debug.startDebugging(undefined, { | ||
type: 'lobster', | ||
name: 'Run File', | ||
request: 'launch', | ||
program: targetResource.fsPath, | ||
stopOnEntry: true | ||
}); | ||
} | ||
}), | ||
vscode.commands.registerCommand('extension.lobster.getProgramName', config => { | ||
return vscode.window.showInputBox({ | ||
placeHolder: "Please enter the name of a markdown file in the workspace folder", | ||
value: "someFile.lobster" | ||
}); | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,49 @@ | ||
import { | ||
DebugSession | ||
DebugSession, TerminatedEvent | ||
} from '@vscode/debugadapter'; | ||
import { DebugProtocol } from '@vscode/debugprotocol'; | ||
import { spawn, ChildProcess } from 'child_process'; | ||
import { workspace } from 'vscode'; | ||
|
||
interface ILaunchRequestArguments extends DebugProtocol.LaunchRequestArguments { | ||
/** An absolute path to the "program" to debug. */ | ||
program: string; | ||
|
||
params?: string[]; | ||
/** Automatically stop target after launch. If not specified, target does not stop. */ | ||
stopOnEntry?: boolean; | ||
/** run without debugging */ | ||
noDebug?: boolean; | ||
} | ||
|
||
//TODO this should be moved outside vscode extension. | ||
|
||
export class LobsterDebugSession extends DebugSession { | ||
process: ChildProcess; | ||
|
||
protected launchRequest( | ||
response: DebugProtocol.LaunchResponse, | ||
args: DebugProtocol.LaunchRequestArguments, | ||
request?: DebugProtocol.Request | ||
args: ILaunchRequestArguments, | ||
): void { | ||
console.log("Whoa"); | ||
//TODO add actual debugging | ||
const executable = workspace.getConfiguration('lobster').get('executable') as string; | ||
const imports = workspace.getConfiguration('lobster').get('imports') as string[]; | ||
|
||
this.process = spawn(executable, [ | ||
...imports.map(i => "--import " + i), | ||
args.program, | ||
...(args.params || []) | ||
]); | ||
|
||
this.process.on('spawn', () => { | ||
this.sendResponse(response); | ||
}); | ||
|
||
this.process.on('error', (err) => { | ||
this.sendErrorResponse(response, 1, "Error executing lobster: {message}", { message: err.message }); | ||
}); | ||
|
||
this.process.on('exit', (code, signal) => { | ||
this.sendEvent(new TerminatedEvent()); | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.