Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions _extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"type": "string",
"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.",
"tags": ["experimental"]
},
"typescript.native-preview.goMemLimit": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y'all have to manage backwards compatible names a lot more than I do, so maybe you have better ideas on how to make this more generically useful going forward...i.e. some way to set any of the various Go flags. I also totally understand if you do not want to invite this added complexity right now!

"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 @@ -95,16 +95,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