#lvim tsx language server
9 messages · Page 1 of 1 (latest)
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the error message "Cannot find name 'React'", it seems like the issue might be related to TypeScript not recognizing the React namespace or not having the appropriate type definitions for React.
Here are a couple of things you might want to check:
-
Ensure that you have the React and ReactDOM type definitions installed. These are usually included if you have a
deps.tsfile that imports React in a Deno project. -
Check if your
tsconfig.json(if you have one) is properly configured to include JSX support. You might need to set thejsxoption to"react"andjsxFactorytoReact.createElementif you're using React without any JSX transform. -
Make sure that you are importing React in your
routes/index.tsxfile. You should have a line at the top of the file that says:import React from 'https://cdn.skypack.dev/react';or a similar import that suits your project setup.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. Since you're using LunarVim, which is an environment for Neovim, ensure that your language server is properly configured for Deno and TypeScript. You might also want to check the LunarVim documentation or community for more specific guidance on setting up TypeScript and React support.
@full sparrow Did you ever find a solution to this? I found that if I was using the denols LSP and the tsserver LSP I had to add the following arguments to the setup() calls:
that's really cool. I'll give deno in lvim a try again 🤞😀
can you share your init.lua? struggling with this right now, didn't work for me
@void barn
return {
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = {"denols"},
})
end,
},
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
lspconfig.denols.setup({
})
end,
},
}
fwiw I only use the denols LSP and it works as expected
one thing that you can do if you have a library that is returning react elements you might have to alias the outputs for preact
import { BLAH } from 'https://esm.sh/@whatever/library?alias=react:preact/compat&alias=external:preact/compat';