Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions _extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
"tags": [
"experimental"
]
},
"typescript.native-preview.goMemLimit": {
"type": "string",
"description": "Set GOMEMLIMIT for the language server (e.g., '2048MiB', '4GiB'). See https://pkg.go.dev/runtime#hdr-Environment_Variables for more information.",
"tags": [
"experimental"
]
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions _extension/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,25 @@ export class Client {
const pprofDir = config.get<string>("pprofDir");
const pprofArgs = pprofDir ? ["--pprofDir", pprofDir] : [];

// Get goMemLimit
const goMemLimit = config.get<string>("goMemLimit");
const env = goMemLimit ? { ...process.env, GOMEMLIMIT: goMemLimit } : process.env;
if (goMemLimit) {
this.outputChannel.appendLine(`Setting GOMEMLIMIT=${goMemLimit}`);
}

const serverOptions: ServerOptions = {
run: {
command: this.exe.path,
args: ["--lsp", ...pprofArgs],
transport: TransportKind.stdio,
options: { env },
},
debug: {
command: this.exe.path,
args: ["--lsp", ...pprofArgs],
transport: TransportKind.stdio,
options: { env },
},
};

Expand Down