Skip to content
Permalink
Browse files
Create launch.json config wizard:
- Create new command called launch.config
  - When command is ran the user will go through a selection process to set all variables for the launch.json
- Add an icon for running the new command to the toolbar (gear icon)
- Once all items are selected by the user the .vscode/launch.json will be created
- Created default profile that lives inside of the Settings of VSCode.
  - Updated code to use default config options if launch.json does not exist
- Create launch-wizard file that is used for creating a WebView for getting the settings desired for a launch.json item
- Create launch-wizard.js which is what grabs the settings from the WebView and sends them to the backend to be written to the file.

Closes #38
  • Loading branch information
Shanedell authored and jw3 committed Dec 6, 2021
1 parent 07d63c7 commit fb39b93adf405417ddaeaef86ef328341e7d0229
Show file tree
Hide file tree
Showing 6 changed files with 907 additions and 55 deletions.
@@ -72,7 +72,8 @@
"onCommand:extension.dfdl-debug.getProgramName",
"onCommand:extension.dfdl-debug.getDataName",
"onCommand:extension.dfdl-debug.runEditorContents",
"onCommand:extension.dfdl-debug.debugEditorContents"
"onCommand:extension.dfdl-debug.debugEditorContents",
"onCommand:launch.config"
],
"workspaceTrust": {
"request": "never"
@@ -86,20 +87,24 @@
],
"menus": {
"editor/title": [
{
"command": "launch.config",
"group": "navigation@1"
},
{
"command": "hexview.display",
"when": "resourceLangId == xml",
"group": "navigation@3"
"group": "navigation@4"
},
{
"command": "infoset.display",
"when": "resourceLangId == xml",
"group": "navigation@1"
"group": "navigation@2"
},
{
"command": "infoset.diff",
"when": "resourceLangId == xml",
"group": "navigation@2"
"group": "navigation@3"
}
],
"editor/title/run": [
@@ -176,6 +181,13 @@
"title": "Save the current infoset",
"category": "Daffodil Debug",
"enablement": "inDebugMode"
},
{
"command": "launch.config",
"title": "Configure launch.json",
"category": "Daffodil Debug",
"enablement": "!inDebugMode",
"icon": "$(debug-configure)"
}
],
"breakpoints": [
@@ -227,6 +239,11 @@
"description": "Enable logging of the Debug Adapter Protocol.",
"default": true
},
"debugServer": {
"type": "integer",
"description": "Port debug server running on",
"default": 4711
},
"useExistingServer": {
"type": "boolean",
"description": "Enable connection to running DAP Server",
@@ -295,6 +312,77 @@
"AskForDataName": "extension.dfdl-debug.getDataName"
}
}
],
"configuration": [
{
"title": "Daffodil Debugger Global",
"properties": {
"type": {
"type": "string",
"default": "dfdl"
},
"program": {
"type": "string",
"description": "Absolute path to the DFDL schema file.",
"default": "${command:AskForProgramName}"
},
"data": {
"type": "string",
"description": "Absolute path to the input data file.",
"default": "${command:AskForDataName}"
},
"infosetOutputType": {
"type": "string",
"description": "Destination for final Infoset (file | 'console' | 'none')",
"enum": [
"file",
"console",
"none"
],
"default": "none"
},
"infosetOutputFilePath": {
"type": "string",
"description": "Path to output for Infoset file (req: infosetOutput=file)",
"default": "${workspaceFolder}/infoset.xml"
},
"stopOnEntry": {
"type": "boolean",
"description": "Automatically stop after launch.",
"default": true
},
"trace": {
"type": "boolean",
"description": "Enable logging of the Debug Adapter Protocol.",
"default": true
},
"useExistingServer": {
"type": "boolean",
"description": "Enable connection to running DAP Server",
"default": false
},
"debugServer": {
"type": "integer",
"description": "Port debug server running on",
"default": 4711
},
"openHexView": {
"type": "boolean",
"description": "Open hexview on debug start",
"default": false
},
"openInfosetView": {
"type": "boolean",
"description": "Open hexview on debug start",
"default": false
},
"openInfosetDiffView": {
"type": "boolean",
"description": "Open hexview on debug start",
"default": false
}
}
}
]
}
}
@@ -19,6 +19,8 @@ import { getDebugger, getDataFileFromFolder } from '../daffodilDebugger'
import { FileAccessor } from './daffodilRuntime'
import * as fs from 'fs'
import * as infoset from '../infoset'
import { getConfig } from '../utils'
import * as launchWizard from '../launchWizard/launchWizard'

// Function for setting up the commands for Run and Debug file
function createDebugRunFileConfigs(resource: vscode.Uri, runOrDebug: String) {
@@ -32,21 +34,19 @@ function createDebugRunFileConfigs(resource: vscode.Uri, runOrDebug: String) {
let infosetFile = `${
path.basename(targetResource.fsPath).split('.')[0]
}-infoset.xml`
vscode.window.showInformationMessage(infosetFile)

vscode.debug.startDebugging(
undefined,
{
type: 'dfdl',
name: 'Run File',
request: 'launch',
program: targetResource.fsPath,
data: '${command:AskForDataName}',
debugServer: 4711,
infosetOutput: {
type: 'file',
path: infosetFile,
},
},
getConfig(
'Run File',
'launch',
'dfdl',
targetResource.fsPath,
false,
false,
{ type: 'file', path: '${workspaceFolder}/' + infosetFile }
),
{ noDebug: noDebug }
)

@@ -160,18 +160,15 @@ export function activateDaffodilDebug(
): ProviderResult<DebugConfiguration[]> {
if (!vscode.workspace.workspaceFolders) {
return [
{
name: 'Daffodil Launch',
request: 'launch',
type: 'dfdl',
program: '${file}',
data: '${command:AskForDataName}',
debugServer: 4711,
infosetOutput: {
type: 'file',
path: '${file}-infoset.xml',
},
},
getConfig(
'Daffodil Launch',
'launch',
'dfdl',
'${file}',
false,
false,
{ type: 'file', path: '${file}-infoset.xml' }
),
]
}

@@ -183,18 +180,15 @@ export function activateDaffodilDebug(
}-infoset.xml`

return [
{
name: 'Daffodil Launch',
request: 'launch',
type: 'dfdl',
program: '${file}',
data: '${command:AskForDataName}',
debugServer: 4711,
infosetOutput: {
type: 'file',
path: infosetFile,
},
},
getConfig(
'Daffodil Launch',
'launch',
'dfdl',
'${file}',
false,
false,
{ type: 'file', path: '${workspaceFolder}/' + infosetFile }
),
]
},
},
@@ -269,6 +263,7 @@ export function activateDaffodilDebug(
)

infoset.activate(context)
launchWizard.activate(context)
}

class DaffodilConfigurationProvider
@@ -291,21 +286,7 @@ class DaffodilConfigurationProvider
): ProviderResult<DebugConfiguration> {
// if launch.json is missing or empty
if (!config.type && !config.request && !config.name) {
const editor = vscode.window.activeTextEditor
if (editor && editor.document.languageId === 'xml') {
config.type = 'dfdl'
config.name = 'Launch'
config.request = 'launch'
config.program = '${file}'
config.data = '${command:AskForDataName}'
config.stopOnEntry = true
config.useExistingServer = false
config.infosetOutput = {
type: 'file',
path: '${file}-infoset.xml',
}
config.debugServer = 4711
}
config = getConfig('Launch', 'launch', 'dfdl')
}

if (!config.program) {

0 comments on commit fb39b93

Please sign in to comment.