Skip to content

Commit 7f45727

Browse files
committed
Different approach
1 parent 986c3dd commit 7f45727

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

_extension/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
"type": "string",
5252
"description": "Path to the @typescript/native-preview package or tsgo binary directory. If not specified, the extension will look for it in the default location.",
5353
"tags": ["experimental"]
54+
},
55+
"typescript.native-preview.goMemLimit": {
56+
"type": "string",
57+
"description": "Set GOMEMLIMIT for the language server (e.g., '2048MiB', '4GiB'). See https://pkg.go.dev/runtime#hdr-Environment_Variables for more information.",
58+
"tags": ["experimental"]
5459
}
5560
}
5661
}

_extension/src/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,25 @@ export class Client {
9595
const pprofDir = config.get<string>("pprofDir");
9696
const pprofArgs = pprofDir ? ["--pprofDir", pprofDir] : [];
9797

98+
// Get goMemLimit
99+
const goMemLimit = config.get<string>("goMemLimit");
100+
const env = goMemLimit ? { ...process.env, GOMEMLIMIT: goMemLimit } : process.env;
101+
if (goMemLimit) {
102+
this.outputChannel.appendLine(`Setting GOMEMLIMIT=${goMemLimit}`);
103+
}
104+
98105
const serverOptions: ServerOptions = {
99106
run: {
100107
command: this.exe.path,
101108
args: ["--lsp", ...pprofArgs],
102109
transport: TransportKind.stdio,
110+
options: { env },
103111
},
104112
debug: {
105113
command: this.exe.path,
106114
args: ["--lsp", ...pprofArgs],
107115
transport: TransportKind.stdio,
116+
options: { env },
108117
},
109118
};
110119

0 commit comments

Comments
 (0)