Skip to content

Commit 903971c

Browse files
squash!
1 parent b0daf04 commit 903971c

87 files changed

Lines changed: 15889 additions & 15822 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Source/constants.ts

Lines changed: 509 additions & 509 deletions
Large diffs are not rendered by default.

Source/cpxWorkspace.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import * as fs from "fs";
2-
import * as path from "path";
1+
import * as fs from "node:fs";
2+
import * as path from "node:path";
33
import * as vscode from "vscode";
44

55
export class CPXWorkspace {
6-
static get rootPath(): string | undefined {
7-
const workspaceFolders = vscode.workspace.workspaceFolders;
8-
if (!workspaceFolders || workspaceFolders.length === 0) {
9-
return undefined;
10-
}
6+
static get rootPath(): string | undefined {
7+
const workspaceFolders = vscode.workspace.workspaceFolders;
8+
if (!workspaceFolders || workspaceFolders.length === 0) {
9+
return undefined;
10+
}
1111

12-
for (const workspaceFolder of workspaceFolders) {
13-
const workspaceFolderPath = workspaceFolder.uri.fsPath;
14-
const cpxConfigPath = path.join(
15-
workspaceFolderPath,
16-
".vscode",
17-
"cpx.json"
18-
);
19-
if (fs.existsSync(cpxConfigPath)) {
20-
return workspaceFolderPath;
21-
}
22-
}
12+
for (const workspaceFolder of workspaceFolders) {
13+
const workspaceFolderPath = workspaceFolder.uri.fsPath;
14+
const cpxConfigPath = path.join(
15+
workspaceFolderPath,
16+
".vscode",
17+
"cpx.json",
18+
);
19+
if (fs.existsSync(cpxConfigPath)) {
20+
return workspaceFolderPath;
21+
}
22+
}
2323

24-
return workspaceFolders[0].uri.fsPath;
25-
}
24+
return workspaceFolders[0].uri.fsPath;
25+
}
2626
}

Source/debugger/debugAdapter.ts

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,52 @@
1-
import { DebugAdapterTracker, DebugConsole, DebugSession } from "vscode";
2-
import { DebuggerCommunicationService } from "../service/debuggerCommunicationService";
3-
import { MessagingService } from "../service/messagingService";
1+
import type { DebugAdapterTracker, DebugConsole, DebugSession } from "vscode";
2+
import type { DebuggerCommunicationService } from "../service/debuggerCommunicationService";
3+
import type { MessagingService } from "../service/messagingService";
44
import { DEBUG_COMMANDS } from "../view/constants";
55

66
export class DebugAdapter implements DebugAdapterTracker {
7-
private readonly console: DebugConsole | undefined;
8-
private readonly messagingService: MessagingService;
9-
private debugCommunicationService: DebuggerCommunicationService;
10-
constructor(
11-
debugSession: DebugSession,
12-
messagingService: MessagingService,
13-
debugCommunicationService: DebuggerCommunicationService
14-
) {
15-
this.console = debugSession.configuration.console;
16-
this.messagingService = messagingService;
17-
this.debugCommunicationService = debugCommunicationService;
18-
}
19-
onWillStartSession() {
20-
// To Implement
21-
}
22-
onWillReceiveMessage(message: any): void {
23-
if (message.command) {
24-
// Only send pertinent debug messages
25-
switch (message.command) {
26-
case DEBUG_COMMANDS.CONTINUE:
27-
this.messagingService.sendStartMessage();
28-
break;
29-
case DEBUG_COMMANDS.STACK_TRACE:
30-
this.messagingService.sendPauseMessage();
31-
break;
32-
case DEBUG_COMMANDS.DISCONNECT:
33-
// Triggered on stop event for debugger
34-
if (!message.arguments.restart) {
35-
this.debugCommunicationService.handleStopEvent();
36-
}
37-
break;
38-
}
39-
}
40-
}
41-
// A debugger error should unlock the webview
42-
onError() {
43-
this.messagingService.sendStartMessage();
44-
}
45-
// Device is always running when exiting debugging mode
46-
onExit() {
47-
this.messagingService.sendStartMessage();
48-
}
7+
private readonly console: DebugConsole | undefined;
8+
private readonly messagingService: MessagingService;
9+
private debugCommunicationService: DebuggerCommunicationService;
10+
constructor(
11+
debugSession: DebugSession,
12+
messagingService: MessagingService,
13+
debugCommunicationService: DebuggerCommunicationService,
14+
) {
15+
this.console = debugSession.configuration.console;
16+
this.messagingService = messagingService;
17+
this.debugCommunicationService = debugCommunicationService;
18+
}
19+
onWillStartSession() {
20+
// To Implement
21+
}
22+
onWillReceiveMessage(message: any): void {
23+
if (message.command) {
24+
// Only send pertinent debug messages
25+
switch (message.command) {
26+
case DEBUG_COMMANDS.CONTINUE: {
27+
this.messagingService.sendStartMessage();
28+
break;
29+
}
30+
case DEBUG_COMMANDS.STACK_TRACE: {
31+
this.messagingService.sendPauseMessage();
32+
break;
33+
}
34+
case DEBUG_COMMANDS.DISCONNECT: {
35+
// Triggered on stop event for debugger
36+
if (!message.arguments.restart) {
37+
this.debugCommunicationService.handleStopEvent();
38+
}
39+
break;
40+
}
41+
}
42+
}
43+
}
44+
// A debugger error should unlock the webview
45+
onError() {
46+
this.messagingService.sendStartMessage();
47+
}
48+
// Device is always running when exiting debugging mode
49+
onExit() {
50+
this.messagingService.sendStartMessage();
51+
}
4952
}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import {
2-
DebugAdapterTracker,
3-
DebugAdapterTrackerFactory,
4-
DebugSession,
5-
ProviderResult,
1+
import type {
2+
DebugAdapterTracker,
3+
DebugAdapterTrackerFactory,
4+
DebugSession,
5+
ProviderResult,
66
} from "vscode";
7-
import { DebuggerCommunicationService } from "../service/debuggerCommunicationService";
8-
import { MessagingService } from "../service/messagingService";
7+
import type { DebuggerCommunicationService } from "../service/debuggerCommunicationService";
8+
import type { MessagingService } from "../service/messagingService";
99
import { DebugAdapter } from "./debugAdapter";
1010

1111
export class DebugAdapterFactory implements DebugAdapterTrackerFactory {
12-
private debugSession: DebugSession;
13-
private messagingService: MessagingService;
14-
private debugCommunicationService: DebuggerCommunicationService;
15-
constructor(
16-
debugSession: DebugSession,
17-
messagingService: MessagingService,
18-
debugCommunicationService: DebuggerCommunicationService
19-
) {
20-
this.debugSession = debugSession;
21-
this.messagingService = messagingService;
22-
this.debugCommunicationService = debugCommunicationService;
23-
}
24-
public createDebugAdapterTracker(
25-
session: DebugSession
26-
): ProviderResult<DebugAdapterTracker> {
27-
return new DebugAdapter(
28-
session,
29-
this.messagingService,
30-
this.debugCommunicationService
31-
);
32-
}
12+
private debugSession: DebugSession;
13+
private messagingService: MessagingService;
14+
private debugCommunicationService: DebuggerCommunicationService;
15+
constructor(
16+
debugSession: DebugSession,
17+
messagingService: MessagingService,
18+
debugCommunicationService: DebuggerCommunicationService,
19+
) {
20+
this.debugSession = debugSession;
21+
this.messagingService = messagingService;
22+
this.debugCommunicationService = debugCommunicationService;
23+
}
24+
public createDebugAdapterTracker(
25+
session: DebugSession,
26+
): ProviderResult<DebugAdapterTracker> {
27+
return new DebugAdapter(
28+
session,
29+
this.messagingService,
30+
this.debugCommunicationService,
31+
);
32+
}
3333
}

0 commit comments

Comments
 (0)