Default maxTsServerMemory to 3GB

This commit is contained in:
Matt Bierner 2019-10-18 16:14:38 -07:00
parent 2a46387970
commit 693ffb4d57
2 changed files with 7 additions and 5 deletions

View file

@ -688,7 +688,7 @@
},
"typescript.tsserver.maxTsServerMemory": {
"type": "number",
"default": 0,
"default": 3072,
"description": "%configuration.tsserver.maxTsServerMemory%",
"scope": "window"
}

View file

@ -151,10 +151,12 @@ export class TypeScriptServiceConfiguration {
}
private static readMaxTsServerMemory(configuration: vscode.WorkspaceConfiguration): number {
const memoryInMB = configuration.get<number>('typescript.tsserver.maxTsServerMemory', 0);
if (!Number.isSafeInteger(memoryInMB) || memoryInMB < 128) {
return 0;
const defaultMaxMemory = 3072;
const minimumMaxMemory = 128;
const memoryInMB = configuration.get<number>('typescript.tsserver.maxTsServerMemory', defaultMaxMemory);
if (!Number.isSafeInteger(memoryInMB)) {
return defaultMaxMemory;
}
return memoryInMB;
return Math.max(memoryInMB, minimumMaxMemory);
}
}