ide-typescript icon indicating copy to clipboard operation
ide-typescript copied to clipboard

Not recognizing TypeScript files in project

Open dannyfritz opened this issue 8 years ago • 8 comments

Some of my TS projects are working just fine. Getting outlines, linting, errors, etc.

But this project isn't getting any IDE support and I'm not sure why https://github.com/corvid-coder/nuthatch

Try opening this file in Atom after cloning and see what happens: https://github.com/corvid-coder/nuthatch/blob/master/packages/debug/src/index.ts

atom_2017-09-30_21-08-50

dannyfritz avatar Oct 01 '17 03:10 dannyfritz

Please open the dev tools window in Atom and see if there are any errors reported.

If there are not please enter atom.config.set('core.debugLSP', true) and press enter then restart Atom to see diagnostics information for ide-typescript and let us know of any relevant messages.

damieng avatar Oct 01 '17 05:10 damieng

Same issue here, nothing in DevTools console.

aSapien avatar Oct 01 '17 10:10 aSapien

It was a problem in my tsconfig.json

When I turned on the debug messages I got: atom_2017-10-01_07-04-24

So I modified my tsconfig.json over and over trying to fix it. What finally fixed it for me was modifying the tsconfig.json and then reloading the atom window and then it worked!

(trailing comma after "inlineSourceMap: false, was the culprit.)

dannyfritz avatar Oct 01 '17 13:10 dannyfritz

We just hit this issue as well and this time it was due to a trailing comma before a closing curly brace. We also noticed that tsc --init generates a JSON configuration file that contains comments (which are invalid in actual JSON).

We should probably:

  • Parse this file as JavaScript so that the parser is more forgiving (which seems to match TypeScript and VSCode expectations)
  • Surface errors like this to the user via a notification instead of having to enable core.debugLSP. If we weren't on the core team and didn't know about core.debugLSP, we probably would have given up and just used VS Code.

I am going to re-open this because it's a show-stopping issue when users have a configuration file that contains technically invalid JSON that TypeScript nevertheless accepts.

/cc: @damieng @daviwil

as-cii avatar Jan 24 '18 19:01 as-cii

We can probably wire up notifications if we see them - I'm not sure if we have any way to tell the typescript language server to treat .json files any differently from the current behavior. (This might be a limitation of the sourcegraph wrapper in which case a fix would need to go upstream)

damieng avatar Jan 24 '18 19:01 damieng

Hi! is this issue fixed now?

B4xAbhishek avatar Jul 17 '20 10:07 B4xAbhishek

check the tree setter to fix the issue. settings-core-treesetter

B4xAbhishek avatar Jul 28 '20 16:07 B4xAbhishek

check the tree setter to fix the issue. settings-core-treesetter

Specifically, check the "Use Tree Sitter Parsers" box. This worked for me!

johncmerfeld avatar Jan 08 '21 21:01 johncmerfeld