atom / ide-typescript

TypeScript and Javascript language support for Atom-IDE
MIT License
368 stars 63 forks source link

v0.8.0 does not parse JSX in .tsx files #145

Closed aergonaut closed 5 years ago

aergonaut commented 5 years ago

Upgrading to v0.8.0 of the package seems to break JSX in .tsx files.

With v0.8.0, all of the JSX tags in my .tsx files are highlighted as errors, with error messages like "Cannot find name span", etc. Additionally, the import React from "react" import at the top of my files is highlighted as unused.

With v0.7.9, there are no errors in my files.

As an example, you can check this file from one of my public projects: https://github.com/aergonaut/jiken/blob/master/app/javascript/incidents/Incident.tsx

mcous commented 5 years ago

I've noticed this issue with .tsx files, too. In my case, I'm able to consistently trigger a few ways (definitely not sure if this list is exhaustive):

This also seems related to the new tree-sitter parser enabled by default in Atom 1.32. With the "Core > Use Tree Sitter Parsers" setting disabled, I do not run into this issue.

Maybe related: with Tree Sitter enabled, the scope of .tsx files is source.ts (TypeScript), but the Tree Sitter disabled, it's source.tsx (TypeScriptReact). I wonder if this is bumping into theia-ide/typescript-language-server#90 somehow?

aergonaut commented 5 years ago

Thanks for the workaround @mcous. Turning off tree-sitter also fixes the problem for me.

dfrankland commented 5 years ago

I still needed to use tree-sitter for other languages like Rust, so I instead removed the tree-sitter grammars from the language-typescript package and then everything worked out fine with the "Core > Use Tree Sitter Parsers" still enabled.

  1. Install language-typescript with apm even though it is bundled with Atom:

    apm install language-typescript
  2. Then delete the tree-sitter grammars from the language-typescript package:

    rm ~/.atom/packages/language-typescript/grammars/tree-sitter*.cson
  3. Restart Atom

adammenges commented 5 years ago

Thanks, turning off tree-sitter worked for me too. Hopefully I'll be able to re-enable it again soon.