Open chrisabrams opened 2 weeks ago
Hello! I started looking into this and I can definitely reproduce the issue (thanks for the nice and small repo illustrating the problem!)
The majority of the time is being spent in the typescript compiler, particularly typechecking the call to React.createElement
here.
I don't have a proper fix at this time, but as a workaround you can add an any
type assertion to shortcircuit typechecking for that call like in this commit (https://github.com/chrisabrams/lsp-react-slow/commit/85bd67f4e26d923f3f957a33e77d449cb2714f6f). That should make the LSP usable for you again in the meantime.
Version: Deno 1.43.1
I was excited by the snappy performance of the LSP in VS Code for version 1.43 however as soon as you load React's types the 10+ second processing time resumes. This is the culprit from what I can tell:
// @deno-types="npm:@types/react@18"
Removing that will resume the snappy performance, but neither Deno nor VS Code know what React's types are.
I am unable to get the LSP to recognize the types this way:
import type {} from "npm:@types/react"
I've created a sample repo for reference: https://github.com/chrisabrams/lsp-react-slow
I saw there is a new option
jsxImportSourceTypes
from https://github.com/denoland/deno/pull/23419 for 1.43 but when I tried adding that, VS Code was not aware of the types. For example here is what I did:With the
import_map.json
referencing their respectivenpm
package.Here is the language server performance: