Skip to content

Commit 257ce36

Browse files
committed
define default for wasmDebugConfig object
- apparently vs code sometimes does not call resolveDebugConfiguration()
1 parent 1549000 commit 257ce36

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

test-tools/wamr-ide/VSCode-Extension/src/debugConfigurationProvider.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,29 @@ import * as vscode from 'vscode';
77
import * as os from 'os';
88

99
export class WasmDebugConfigurationProvider
10-
implements vscode.DebugConfigurationProvider
11-
{
12-
private wasmDebugConfig!: vscode.DebugConfiguration;
10+
implements vscode.DebugConfigurationProvider {
11+
private wasmDebugConfig = {
12+
type: 'wamr-debug',
13+
name: 'Attach',
14+
request: 'attach',
15+
stopOnEntry: true,
16+
initCommands: os.platform() === 'win32' || os.platform() === 'darwin' ?
17+
/* linux and windows has different debug configuration */
18+
'platform select remote-linux' :
19+
undefined,
20+
attachCommands: [
21+
/* default port 1234 */
22+
'process connect -p wasm connect://127.0.0.1:1234',
23+
]
24+
};
1325

14-
resolveDebugConfiguration(
26+
public resolveDebugConfiguration(
1527
_: vscode.WorkspaceFolder | undefined,
1628
debugConfiguration: vscode.DebugConfiguration,
1729
): vscode.ProviderResult<vscode.DebugConfiguration> {
18-
const defaultConfig: vscode.DebugConfiguration = {
19-
type: 'wamr-debug',
20-
name: 'Attach',
21-
request: 'attach',
22-
stopOnEntry: true,
23-
attachCommands: [
24-
/* default port 1234 */
25-
'process connect -p wasm connect://127.0.0.1:1234',
26-
]
27-
};
28-
29-
/* linux and windows has different debug configuration */
30-
if (os.platform() === 'win32' || os.platform() === 'darwin') {
31-
defaultConfig.initCommands = ['platform select remote-linux'];
32-
}
3330

3431
this.wasmDebugConfig = {
35-
...defaultConfig,
32+
...this.wasmDebugConfig,
3633
...debugConfiguration
3734
};
3835

0 commit comments

Comments
 (0)