[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 { export interface ManagedConfigKey {
key: string; 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', key: 'typescript.enablePromptUseWorkspaceTsdk',
value: true, value: true,
}, },
{
key: 'typescript.tsserver.maxTsServerMemory',
value: 4096,
},
]; ];

View file

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