Skip to content

Commit

Permalink
define default for wasmDebugConfig object
Browse files Browse the repository at this point in the history
- apparently vs code sometimes does not call resolveDebugConfiguration()
  • Loading branch information
MrSarius committed May 6, 2023
1 parent 89b1ce8 commit 697936b
Showing 1 changed file with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,29 @@ import * as vscode from 'vscode';
import * as os from 'os';

export class WasmDebugConfigurationProvider
implements vscode.DebugConfigurationProvider
{
private wasmDebugConfig!: vscode.DebugConfiguration;
implements vscode.DebugConfigurationProvider {
private wasmDebugConfig = {
type: 'wamr-debug',
name: 'Attach',
request: 'attach',
stopOnEntry: true,
initCommands: os.platform() === 'win32' || os.platform() === 'darwin' ?
/* linux and windows has different debug configuration */
'platform select remote-linux' :
undefined,
attachCommands: [
/* default port 1234 */
'process connect -p wasm connect://127.0.0.1:1234',
]
};

public resolveDebugConfiguration(
_: vscode.WorkspaceFolder | undefined,
debugConfiguration: vscode.DebugConfiguration,
): vscode.ProviderResult<vscode.DebugConfiguration> {
const defaultConfig: vscode.DebugConfiguration = {
type: 'wamr-debug',
name: 'Attach',
request: 'attach',
stopOnEntry: true,
attachCommands: [
/* default port 1234 */
'process connect -p wasm connect://127.0.0.1:1234',
]
};

/* linux and windows has different debug configuration */
if (os.platform() === 'win32' || os.platform() === 'darwin') {
defaultConfig.initCommands = ['platform select remote-linux'];
}

this.wasmDebugConfig = {
...defaultConfig,
...this.wasmDebugConfig,
...debugConfiguration
};

Expand Down

0 comments on commit 697936b

Please sign in to comment.