Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp: JSX cannot be used #8993

Closed
FallingSnow opened this issue Jan 4, 2021 · 7 comments · Fixed by #9407
Closed

lsp: JSX cannot be used #8993

FallingSnow opened this issue Jan 4, 2021 · 7 comments · Fixed by #9407
Assignees
Labels
bug Something isn't working correctly lsp related to the language server

Comments

@FallingSnow
Copy link

How can I pass the --jsx flag to the deno lsp?

Describe the bug

While using the Canary extension, I get the following errors all over my project.

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. deno-ts(7026)
Cannot use JSX unless the '--jsx' flag is provided. deno-ts(17004)

Versions

vscode: 1.52.1
deno: 1.6.3
extension: 0.0.6

@kitsonk kitsonk transferred this issue from denoland/vscode_deno Jan 4, 2021
@kitsonk kitsonk changed the title Enable JSX usage lsp: JSX cannot be used Jan 4, 2021
@kitsonk kitsonk added bug Something isn't working correctly lsp related to the language server labels Jan 4, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Jan 4, 2021

It should just work, it is a bug with the lsp that we need to fix.

@FallingSnow
Copy link
Author

Is there a work around I can use in the mean time?

I tried adding a tsconfig.json which from what I've read should fix it. But it seems like deno_vscode doesn't pick up on it.

{
    "compilerOptions": {
        "jsx": "react-jsx",
    }
}

Or maybe no changes in a tsconfig.json can help, it must be done in the lsp?

@lucacasonato
Copy link
Member

If you use the canary channel of Deno, there should be support for tsconfig in the recent builds. You can specify the tsconfig path via the deno.config preference.

@FallingSnow
Copy link
Author

FallingSnow commented Jan 5, 2021

I set "deno.config": "./tsconfig.json" on .vscode/settings.json but still see the same errors. I tired excluding everything to see if the tsconfig was being picked up but the errors still come through.

settings.json

{
    "files.eol": "\n",
    "files.trimTrailingWhitespace": true,
    "files.exclude": {
        "**/.git": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true,
        "**/.aleph": true
    },
    "deno.enable": true,
    "deno.config": "./tsconfig.json",
    "deno.unstable": false,
    "deno.import_map": "./import_map.json"
}

tsconfig.json

{
    "exclude": [
        "**/*"
    ],
    "compilerOptions": {
        "jsx": "react-jsx"
    }
}

Also are you referring to Canary for the deno or vscode_deno? (I'm using denoland.vscode-deno-canary 0.0.6)

@LRNZ09
Copy link

LRNZ09 commented Jan 29, 2021

I'm having this error with the Canary version of the vscode extension, no problem with the stable one.

@reggi
Copy link

reggi commented Aug 19, 2022

Just got this out of nowhere after working with fresh for about 2 hours. 👀

@reggi
Copy link

reggi commented Aug 19, 2022

I think it's because I had some malformed TSX, if you're seeing this just piece it back together and check for bugs. Weird message tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly lsp related to the language server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants