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

Invalid projects.json causes issues #82

Closed
Gama11 opened this issue Jan 24, 2017 · 10 comments
Closed

Invalid projects.json causes issues #82

Gama11 opened this issue Jan 24, 2017 · 10 comments
Labels

Comments

@Gama11
Copy link
Contributor

Gama11 commented Jan 24, 2017

Using the latest version (0.13.0) + VSCode 1.8.1.

If the projects.json file is completely empty, the following error appears:

This is not particularly surprising.

However, clicking "Open File" here doesn't do anything. It even looks like the extension crashes entirely (?), since no project manager command works anymore:

This means you have to manually locate the projects.json file to correct the issue (not a big issue in my case since I knew where it was, but this could be considered bad UX).


Note: if projects.json contains {} instead of being completely empty, it fails slightly differently:

So that might be a different issue.

@equinusocio
Copy link

equinusocio commented Jan 25, 2017

@Gama11 I have the same issue, where is the projects.json file?!

@Gama11
Copy link
Contributor Author

Gama11 commented Jan 25, 2017

(on windows)

%AppData%/Code/User/projects.json

@equinusocio
Copy link

equinusocio commented Jan 25, 2017

Thank you, on macOS is at:
/Users/[USER]/Library/Application Support/Code/User/projects.json

@alefragnani
Copy link
Owner

@Gama11 thanks for the detailed description 👍.

I think I have to revisit this code. It's probably related to the refactoring that was made to support VSCode, Git and SVN auto-detection.

But, I don't see why projects.json file should be empty, unless you removed the projects from there and started to use VSCode, Git or SVN support, am I right? Or it was cleared with the extension update?

In the meantime, try to add a temporary project in projects.json, until I'm able to release a fix.

Thanks for your help

@Gama11
Copy link
Contributor Author

Gama11 commented Jan 25, 2017

But, I don't see why projects.json file should be empty, unless you removed the projects from there and started to use VSCode, Git or SVN support, am I right?

Yes, I manually emptied the file to check out the project auto-detection feature.

In the meantime, try to add a temporary project in projects.json, until I'm able to release a fix.

Like I mentioned, that's what I did. I just thought I should report this anyway so the UX can be improved. :)

@alefragnani
Copy link
Owner

Better UX is aways a good point, but in this case, is really a bug 😄

@ghost
Copy link

ghost commented Jan 28, 2017

I submitted PR #81, which probably fixes this issue.

@alefragnani Can you please have a look and confirm if that's the case?

@alefragnani
Copy link
Owner

Hi @samuelsuarez ,

First of all, thanks for you PR. I didn't evaluate yet because I'm on vacation, and decided give a break on some coding 😄 . I must return to play next week.

About the fix, I guess aren't related. The problem here appears to be not handling malformed json files, instead of empty project list. I didn't check/debug the issue yet to be sure, but if your PR fixes, I will be _veeery happy 😁

@alefragnani
Copy link
Owner

alefragnani commented Jan 28, 2017

Well, I can't simply read/write e-mails, developers loves to code 😄

I debugged this issue and discovered some things:

  • An empty file is not supported, but instead of leaving it empty, it should be deleted. That would be the case if you don't want any Saved Project, but only VSCode, Git or SVN. But, the Open File button should work, so I will fix that 😄
  • An empty list is supported, but is not working, and @samuelsuarez PR fixes that 🎉
  • An invalid json file is supported, but is not working, so I will fix that.

It will be fixed soon, but first I have to merge 2 PRs and merge another internal code that I'm doing. After that I have to check #84

Thanks for your help

@alefragnani
Copy link
Owner

@samuelsuarez ,

Looks like you were right, your PR fixes the empty list problem 👍 🎉.

Thank you!

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

No branches or pull requests

3 participants