From 02cd26436a2fac2bbe2c8623bc7512f7fbe08c21 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Sat, 12 Jun 2021 11:50:26 +0200 Subject: [PATCH] (feat) support TS infer function return type --- .../src/plugins/typescript/features/CodeActionsProvider.ts | 3 ++- packages/language-server/src/server.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/language-server/src/plugins/typescript/features/CodeActionsProvider.ts b/packages/language-server/src/plugins/typescript/features/CodeActionsProvider.ts index 1261bfd82..0d837a0c2 100644 --- a/packages/language-server/src/plugins/typescript/features/CodeActionsProvider.ts +++ b/packages/language-server/src/plugins/typescript/features/CodeActionsProvider.ts @@ -321,7 +321,8 @@ export class CodeActionsProviderImpl implements CodeActionsProvider { .filter( (refactor) => refactor.command?.command.includes('function_scope') || - refactor.command?.command.includes('constant_scope') + refactor.command?.command.includes('constant_scope') || + refactor.command?.command === 'Infer function return type' ) // The language server also proposes extraction into const/function in module scope, // which is outside of the render function, which is svelte2tsx-specific and unmapped, diff --git a/packages/language-server/src/server.ts b/packages/language-server/src/server.ts index 6933dc9c8..87c750285 100644 --- a/packages/language-server/src/server.ts +++ b/packages/language-server/src/server.ts @@ -206,7 +206,8 @@ export function startServer(options?: LSOptions) { 'constant_scope_1', 'constant_scope_2', 'constant_scope_3', - 'extract_to_svelte_component' + 'extract_to_svelte_component', + 'Infer function return type' ] } : undefined,