Commit 35f22d87 authored by abbycin's avatar abbycin

init

parents
*.vsix
out
package-lock.json
node_modules
{
"version": "0.0.1",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
]
},
{
"name": "TopJS Sample",
"type": "topjs",
"request": "launch",
"port": 30992,
"program": "${workspaceFolder}/${command:getProgramName}",
"runtimeExecutable": "topjs3"
}
]
}
// Place your settings in this file to overwrite default and user settings.FALSE
{
"javascript.validate.enable": false,
"typescript.tsdk": "node_modules/typescript/lib",
"files.trimTrailingWhitespace": true,
"editor.insertSpaces": true
}
\ No newline at end of file
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
const ncp = require('ncp');
ncp('./src', './out', (err) => {
if(err) {
return console.error(err);
}
});
\ No newline at end of file
favicon.png

2.99 KB

{
"name": "topjs-debugger",
"displayName": "TopJS Debugger",
"version": "0.0.1",
"publisher": "AbbyCin",
"description": "TopJS debugger extension for VS Code.",
"author": {
"name": "AbbyCin",
"email": "abbytsing@gmail.com"
},
"license": "MIT",
"keywords": [
"multi-root ready"
],
"engines": {
"vscode": "^1.30.0",
"node": "^8.9.3"
},
"icon": "favicon.png",
"categories": [
"Debuggers"
],
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-mock-debug.git"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-mock-debug/issues"
},
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install",
"build": "node ./build.js",
"package": "vsce package",
"publish": "vsce publish"
},
"dependencies": {
"await-notify": "^1.0.1",
"command-exists": "^1.2.8",
"vscode-debugadapter": "^1.33.0"
},
"devDependencies": {
"@types/node": "8.9.3",
"vscode": "1.1.21",
"vscode-debugadapter-testsupport": "1.33.0",
"vsce": "1.53.2",
"ncp": "2.0.0"
},
"main": "./src/extension",
"activationEvents": [
"onDebug",
"onCommand:extension.topjs-debugger.getProgramPath"
],
"contributes": {
"breakpoints": [
{
"language": "javascript"
}
],
"debuggers": [
{
"type": "topjs",
"label": "TopJS Debugger",
"program": "./src/debugAdapter.js",
"runtime": "node",
"configurationAttributes": {
"launch": {
"required": [
"program",
"runtimeExecutable",
"port"
],
"properties": {
"program": {
"type": "string",
"description": "Absolute path to a javascript file.",
"default": "${workspaceFolder}/${command:getProgramPath}"
},
"port": {
"type": "number",
"descrition": "Port for debugger backend.",
"default": 30992
},
"runtimeExecutable": {
"type": "string",
"default": "topjs3"
}
}
}
},
"initialConfigurations": [
{
"type": "topjs",
"request": "launch",
"name": "Launch Debugger",
"program": "${workspaceFolder}/${command:getProgramPath}"
}
],
"configurationSnippets": [
{
"label": "TopJS Debug: Launch",
"description": "A new configuration for 'debugging' a user selected javascript file.",
"body": {
"type": "topjs",
"request": "launch",
"name": "Launch Debugger2",
"program": "^\"\\${workspaceFolder}/\\${command:getProgramPath}\""
}
}
],
"variables": {
"getProgramPath": "extension.topjs-debugger.getProgramPath"
}
}
]
}
}
const topjsDebugger = require('./topjsDebug');
topjsDebugger.TopJSDebugSession.run(topjsDebugger.TopJSDebugSession);
\ No newline at end of file
const vscode = require('vscode');
const topjsDebug = require('./topjsDebug');
const net = require('net');
const path = require('path');
function activate(context) {
context.subscriptions.push(vscode.commands.registerCommand('extension.topjs-debugger.getProgramPath', config => {
var p = vscode.window.activeTextEditor.document.fileName;
return path.basename(p);
}));
const provider = new TopJSConfigurationProvider();
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('topjs', provider));
var x = true;
if(x) {
const factory = new TopJSDebugAdapterDescriptorFactory();
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('topjs', factory));
context.subscriptions.push(factory);
}
}
function deactivate() {}
exports.activate = activate;
exports.deactivate = deactivate;
class TopJSConfigurationProvider {
resolveDebugConfigguration(folder, config, token) {
if(!config.type && !config.request && !config.name) {
const editor = vscode.window.activeTextEditor;
if(editor && editor.document.languageId == 'javascript') {
config.type = 'topjs';
config.name = 'Launch Debug';
config.request = 'launch';
config.program = '${file}';
config.stopOnEntry = true;
}
}
if(!config.program) {
return vscode.window.showInformationMessage("Cannot find a program to debug").then(_ => {
return undefined;
});
}
return config;
}
}
class TopJSDebugAdapterDescriptorFactory {
createDebugAdapterDescriptor(session, executable) {
if(!this.server) {
this.server = net.createServer(socket => {
const session = new topjsDebug.TopJSDebugSession();
session.setRunAsServer(true);
session.start(socket, socket);
}).listen(0); // listen on random port
}
return new vscode.DebugAdapterServer(this.server.address().port);
}
dispose() {
if(this.server) {
this.server.close();
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment