Skip to content

Commit 004c810

Browse files
committed
add type annotations
1 parent 7b1bbf2 commit 004c810

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

extension/src/goDebugCommands.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ const sessions = new Map<string, vscode.DebugSession>();
1111
vscode.debug.onDidStartDebugSession((s) => sessions.set(s.id, s));
1212
vscode.debug.onDidTerminateDebugSession((s) => sessions.delete(s.id));
1313

14+
/**
15+
* Registers commands to improve the debugging experience for Go.
16+
*
17+
* Currently, it adds a command to open a variable in a new text document.
18+
*/
1419
export function registerGoDebugCommands(ctx: vscode.ExtensionContext) {
1520
class VariableContentProvider implements vscode.TextDocumentContentProvider {
1621
static uriForRef(ref: VariableRef) {
@@ -85,18 +90,27 @@ export function registerGoDebugCommands(ctx: vscode.ExtensionContext) {
8590
})
8691
);
8792

93+
/**
94+
* A reference to a variable, used to pass data between commands.
95+
*/
8896
interface VariableRef {
8997
sessionId: string;
9098
container: Container;
9199
variable: Variable;
92100
}
93101

102+
/**
103+
* A container for variables, used to pass data between commands.
104+
*/
94105
interface Container {
95106
name: string;
96107
variablesReference: number;
97108
expensive: boolean;
98109
}
99110

111+
/**
112+
* A variable, used to pass data between commands.
113+
*/
100114
interface Variable {
101115
name: string;
102116
value: string;
@@ -111,6 +125,9 @@ export function registerGoDebugCommands(ctx: vscode.ExtensionContext) {
111125
t: '\t'
112126
};
113127

128+
/**
129+
* Parses a variable value, unescaping special characters.
130+
*/
114131
function parseVariable(variable: Variable) {
115132
let raw = variable.value.trim();
116133
try {

0 commit comments

Comments
 (0)