[vscode] Set typescript.tsserver.maxTsServerMemory (#113959)

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
Tyler Smalley 2021-10-06 08:11:12 -07:00 committed by GitHub
parent e16495792f
commit b59e3ff460
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -8,7 +8,7 @@
export interface ManagedConfigKey {
key: string;
value: string | Record<string, any> | boolean;
value: string | Record<string, any> | boolean | number;
}
/**
@ -46,4 +46,8 @@ export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [
key: 'typescript.enablePromptUseWorkspaceTsdk',
value: true,
},
{
key: 'typescript.tsserver.maxTsServerMemory',
value: 4096,
},
];

View file

@ -69,13 +69,13 @@ const createObjectPropOfManagedValues = (key: string, value: Record<string, any>
const addManagedProp = (
ast: t.ObjectExpression,
key: string,
value: string | Record<string, any> | boolean
value: string | Record<string, any> | boolean | number
) => {
ast.properties.push(
typeof value === 'string' || typeof value === 'boolean'
? createManagedProp(key, value)
: createObjectPropOfManagedValues(key, value)
);
if (['number', 'string', 'boolean'].includes(typeof value)) {
ast.properties.push(createManagedProp(key, value));
} else {
ast.properties.push(createObjectPropOfManagedValues(key, value as Record<string, any>));
}
};
/**
@ -89,7 +89,7 @@ const addManagedProp = (
const replaceManagedProp = (
ast: t.ObjectExpression,
existing: BasicObjectProp,
value: string | Record<string, any> | boolean
value: string | Record<string, any> | boolean | number
) => {
remove(ast.properties, existing);
addManagedProp(ast, existing.key.value, value);