From c8f722ae933809bdbc2585954d90269142c06eb1 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sun, 3 Dec 2023 07:06:55 +0800 Subject: [PATCH] feat(plugin/ts): error querying version match --- core/src/plugins/typescript/statusbar/Versions.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/plugins/typescript/statusbar/Versions.tsx b/core/src/plugins/typescript/statusbar/Versions.tsx index 390254e1..b24bda14 100644 --- a/core/src/plugins/typescript/statusbar/Versions.tsx +++ b/core/src/plugins/typescript/statusbar/Versions.tsx @@ -142,8 +142,15 @@ export const Versions: React.ComponentType)) } if ('text' in result) { - // TODO resolve this case - console.log('text', result) + const matchVersion = suggestedVersions.filter(({ id }) => id.includes(result.text)) + matchVersion.length > 0 + ? onChange?.(matchVersion[0]?.value.toString()) + : messenger.then(m => m.display('error', <> +

Invalid TypeScript Version

+

Version {matchVersion[0]?.id} is not available.

+ {/* TODO support help jump */} +

Click it and find help.

+ )) } } catch (e) { console.error(e)