[vscode] Set typescript.enablePromptUseWorkspaceTsdk (#113476)

To prompt users to use the workspace configured version of Typescript.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
Tyler Smalley 2021-09-30 15:13:45 -07:00 committed by GitHub
parent de8bb8f7d8
commit 14e65bf05d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -8,7 +8,7 @@
export interface ManagedConfigKey {
key: string;
value: string | Record<string, any>;
value: string | Record<string, any> | boolean;
}
/**
@ -42,4 +42,8 @@ export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [
// we use a relative path here so that it works with remote vscode connections
value: './node_modules/typescript/lib',
},
{
key: 'typescript.enablePromptUseWorkspaceTsdk',
value: true,
},
];

View file

@ -69,10 +69,10 @@ const createObjectPropOfManagedValues = (key: string, value: Record<string, any>
const addManagedProp = (
ast: t.ObjectExpression,
key: string,
value: string | Record<string, any>
value: string | Record<string, any> | boolean
) => {
ast.properties.push(
typeof value === 'string'
typeof value === 'string' || typeof value === 'boolean'
? createManagedProp(key, value)
: createObjectPropOfManagedValues(key, value)
);
@ -89,7 +89,7 @@ const addManagedProp = (
const replaceManagedProp = (
ast: t.ObjectExpression,
existing: BasicObjectProp,
value: string | Record<string, any>
value: string | Record<string, any> | boolean
) => {
remove(ast.properties, existing);
addManagedProp(ast, existing.key.value, value);