From 8592f9e263fe4d7fbb7991c031f535274c3098c5 Mon Sep 17 00:00:00 2001 From: David Matter Date: Sat, 24 Aug 2024 09:29:43 +0200 Subject: [PATCH] fix(typescript-plugin): unknown request type warning (#4715) --- packages/typescript-plugin/lib/server.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/typescript-plugin/lib/server.ts b/packages/typescript-plugin/lib/server.ts index ec3d9d1e94..30ae6d5629 100644 --- a/packages/typescript-plugin/lib/server.ts +++ b/packages/typescript-plugin/lib/server.ts @@ -47,27 +47,27 @@ export async function startNamedPipeServer( } const request: Request = JSON.parse(text); const fileName = request.args[0]; + const requestContext: RequestContext = { + typescript: ts, + languageService: info.languageService, + languageServiceHost: info.languageServiceHost, + language: language, + isTsPlugin: true, + getFileId: (fileName: string) => fileName, + }; if (request.type === 'containsFile') { sendResponse( info.project.containsFile(ts.server.toNormalizedPath(fileName)) ); } - if (request.type === 'projectInfo') { + else if (request.type === 'projectInfo') { sendResponse({ name: info.project.getProjectName(), kind: info.project.projectKind, currentDirectory: info.project.getCurrentDirectory(), } satisfies ProjectInfo); } - const requestContext: RequestContext = { - typescript: ts, - languageService: info.languageService, - languageServiceHost: info.languageServiceHost, - language: language, - isTsPlugin: true, - getFileId: (fileName: string) => fileName, - }; - if (request.type === 'collectExtractProps') { + else if (request.type === 'collectExtractProps') { const result = collectExtractProps.apply(requestContext, request.args as any); sendResponse(result); }