Skip to content

Commit

Permalink
Implement debug command
Browse files Browse the repository at this point in the history
  • Loading branch information
DervexDev committed Apr 7, 2024
1 parent f06361e commit b4186ea
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
"semi": "off",
"no-unused-vars": "warn"
},
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
}
7 changes: 3 additions & 4 deletions src/argon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as vscode from 'vscode'
import * as childProcess from 'child_process'
import * as logger from './logger'
import * as util from './util'
Expand Down Expand Up @@ -77,9 +76,9 @@ export function exec(code: string) {
run(`exec "${code}"`)
}

// export function debug(mode: string) {
// run(`debug "${mode}"`)
// }
export function debug(mode: string) {
run(`debug ${mode}`)
}

export function studio() {
run('studio')
Expand Down
5 changes: 2 additions & 3 deletions src/commands/openMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { State } from '../state'

export function openMenu(state: State) {
return vscode.commands.registerCommand('argon.openMenu', () => {
const items = menu.items()
const quickPick = vscode.window
.showQuickPick(items, {
vscode.window
.showQuickPick(menu.items(), {
title: 'Argon',
})
.then(async (item) => {
Expand Down
46 changes: 45 additions & 1 deletion src/menu/debug.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as vscode from 'vscode'
import * as argon from '../argon'
import { Item } from '.'

export const item: Item = {
Expand All @@ -7,4 +8,47 @@ export const item: Item = {
action: 'debug',
}

export function handler() {}
function getMode(): Promise<string> {
return new Promise((resolve, reject) => {
const items = [
{
label: '$(vm) Play',
description: 'F5',
action: 'play',
},
{
label: '$(server-environment) Run',
description: 'F8',
action: 'run',
},
{
label: '$(server) Start',
description: 'F7',
action: 'start',
},
{
label: '$(stop-circle) Stop',
description: 'Shift + F5',
action: 'stop',
},
]

vscode.window
.showQuickPick(items, {
title: 'Select playtest mode',
})
.then((mode) => {
if (!mode) {
return reject()
}

resolve(mode.action)
})
})
}

export async function handler() {
const mode = await getMode()

argon.debug(mode)
}
8 changes: 4 additions & 4 deletions src/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export function items(): (Item | Divider)[] {
init.item,
stop.item,
helpers(),
exec.item,
debug.item,
exec.item,
studio.item,
plugin.item,
misc(),
Expand Down Expand Up @@ -95,12 +95,12 @@ export async function onDidAccept(action: string, state: State) {
await stop.handler(state)
break

case 'debug':
await debug.handler()
break
case 'exec':
exec.handler()
break
case 'debug':
debug.handler()
break
case 'studio':
studio.handler()
break
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"outDir": "out",
"lib": ["ES2020"],
"sourceMap": true,
"strict": true
"strict": true,
"noUnusedParameters": true
/* Additional Checks */
// "rootDir": "src",
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
}
}

0 comments on commit b4186ea

Please sign in to comment.