Skip to content

Multiple tsconfig.json files - files section no longer updated #708

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

Closed
LivesleyWA opened this issue Nov 7, 2015 · 9 comments
Closed

Multiple tsconfig.json files - files section no longer updated #708

LivesleyWA opened this issue Nov 7, 2015 · 9 comments

Comments

@LivesleyWA
Copy link

I have a project with two tsconfig.json files. Used to update the files section of both. No longer works - one does the other does not.

@LivesleyWA
Copy link
Author

This seems to be a wider problem. I have a project where none of the tsconfig files entries are being populated. Same general entries and it was working before the latest updates so I don't think it's the tsconfig file.

@Zyzle
Copy link

Zyzle commented Nov 11, 2015

Yup, I'm seeing the same problem here, filesGlob no longer populates the files section.

Atom 1.2.0-beta-0 atom-typescript 7.8.0

@basarat
Copy link
Member

basarat commented Nov 14, 2015

@LivesleyWA try running sync on your project with a ts file from the same project open https://github.com/TypeStrong/atom-typescript#sync

Does that fix it?

@LivesleyWA
Copy link
Author

I have a structure

  • lib
    tsconfig.json
    • ts
    • stuff one
    • stuff two
  • test
    tsconfig.json
    • ts
    • test stuff one
    • test stuff two

By default, the lib tsconfig file is populating the files entry automatically whilst the test tsconfig file is not.

For a number of reasons to do with Webstorm (used for testing nodejs apps) test tsconfig contains references to lib folders (Webstorm can't handle more than one tsconfig file and seems to find the test tsconfig file). So test tsconfig has the following

"filesGlob": [
"./ts//*.ts",
"./typescript references/
/.d.ts",
"../lib/ts/**/
.ts",
"../lib/typescript references/**/*.d.ts"
],

After a bit of fiddling I have found that to regenerate test tsconfig

  • The test ts folder (or one of its sub-folders) must contain at least one ts file.
  • A sync run on a ts file in the test folder (or one of its sub-folders) regenerates the test tsconfig file entries.

Once the test tsconfig file is synched, it continues to work, although the lib tsconfig file then stops updating the files entries. If I shut down Atom and restart, the synching reverts to the lib tsconfig file.

Hope this helps. Now I know the trick I at least have a workable work-around.

@basarat
Copy link
Member

basarat commented Nov 16, 2015

This is by design. We cache the contents of tsconfig till you open a file we do not know about from our previous look at tsconfig. And we have a single file -> tsconfig map so if a file is in two tsconfig the last tsconfig that was used is what is considered active. We show this in our panel.

image

An ideal solution would be to force the user to select the tsconfig they are working with upfront, or provide an option for sticky current project 🌹

@flahertyb
Copy link

Yes, would be nice to have manual control over the active tsconfig.

@psnider
Copy link

psnider commented Apr 7, 2016

I'm using version 8.5.0 of atom-typescript.

I have several tsconfig.json files in my project, which has several aggregated micro-services,
each laid out in this structure:

  • src/SERVICE_NAME/server/tsconfig.json
  • src/SERVICE_NAME/client/tsconfig.json

The tsconfig files also reference some shared files in:

  • src/shared.

I've found that sometimes the tsconfig.json updating works fine,
but other times, it just doesn't seem to happen no matter what I try.

Unfortunately, I haven't found any clues to what triggers this behavior.

@basarat
Copy link
Member

basarat commented Apr 7, 2016

but other times, it just doesn't seem to happen no matter what I try

If you open a file from server first then all the files referenced (including shared) will point to that tsconfig.json. Then even if you update client/tsconfig.json it will have seemingly no effect on any file that the editor opens (as they all already point to server).

Fix

We need a project selector. I'll create an issue documenting this fact.

@basarat
Copy link
Member

basarat commented Apr 7, 2016

I've created an issue for discussion : #910 🌹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants