Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions language/mips.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"scopeName": "source.mips",
"fileTypes": [
"dmips",
"asm",
"mips"
],
"patterns": [
Expand Down
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@
"type": "boolean",
"default": true,
"description": "Check to see if dashmips is installed, will offer to install if not"
},
"dashmips.debugCommand": {
"type": "string",
"default": "python -m dashmips debug",
"description": "Default command to run dashmips in. If you have a later version of Python installed you may want to change it here. Eg. /usr/bin/python3"
},
"dashmips.existsCommand": {
"type": "string",
"default": "python -m dashmips -v",
"description": "Default command to check for dashmips with. If you have a later version of Python installed you may want to change it here. Eg. /usr/bin/python3"
}
}
}
Expand Down Expand Up @@ -239,7 +249,9 @@
"type": "dashmips",
"request": "launch",
"name": "Dashmips (Run)",
"program": "^\"\\${file}\""
"program": "^\"\\${file}\"",
"registerFormat": "dec",
"dashmipsCommand": "python -m dashmips debug"
}
},
{
Expand Down Expand Up @@ -276,6 +288,7 @@
"registerFormat": "dec",
"host": "localhost",
"port": 2390,
"dashmipsCommand": "python -m dashmips debug",
"stopOnEntry": false
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class DashmipsConfigurationProvider implements DebugConfigurationProvider
config: DebugConfiguration,
token?: CancellationToken
): ProviderResult<DebugConfiguration> {
const debugCommand = vscode.workspace.getConfiguration().get('dashmips.debugCommand') || 'python -m dashmips debug'
config.internalConsoleOptions = 'neverOpen'

if (!config.type && !config.request && !config.name) {
Expand All @@ -137,7 +138,8 @@ export class DashmipsConfigurationProvider implements DebugConfigurationProvider
config.name = 'Dashmips (Run With Logging)'
config.request = 'launch'
config.program = '^"\\${file}"'
config.dashmipsCommand = 'python -m dashmips debug'
config.registerFormat = 'dec'
config.dashmipsCommand = debugCommand
}
}

Expand All @@ -149,7 +151,8 @@ export class DashmipsConfigurationProvider implements DebugConfigurationProvider
args: [],
dashmipsArgs: [],
console: 'integratedTerminal',
dashmipsCommand: 'python -m dashmips debug',
registerFormat: 'dec',
dashmipsCommand: debugCommand,
name: 'Dashmips (Run With Logging)',
}

Expand Down Expand Up @@ -239,8 +242,9 @@ class DashmipsDebugAdapterNamedPipeServerDescriptorFactory implements vscode.Deb
}

export function checkDashmipsExists(): boolean {
const existsCommand = vscode.workspace.getConfiguration().get('dashmips.existsCommand') || 'python -m dashmips -v'
try {
execSync('python -m dashmips -v', { encoding: 'utf8' })
execSync(existsCommand, { encoding: 'utf8' })
return true
} catch {
return false
Expand Down