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

[json] problem from unaccessible schema is distracting #51032

Closed
Tyriar opened this issue Jun 3, 2018 · 14 comments
Closed

[json] problem from unaccessible schema is distracting #51032

Tyriar opened this issue Jun 3, 2018 · 14 comments
Assignees
Labels
feature-request Request for new features or functionality good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities json JSON support issues on-testplan
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Jun 3, 2018

I was on a plane without internet working and this popped up in the tsconfig.json. A silent failure would have been better in this case as I know I don't have internet:

Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/tsconfig.json': Unable to load schema from 'https://schemastore.azurewebsites.net/schemas/json/tsconfig.json': Unable to connect to https://schemastore.azurewebsites.net/schemas/json/tsconfig.json. Error: connect ETIMEDOUT 168.62.224.13:443

screen shot 2018-06-02 at 6 56 31 pm

@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Jun 3, 2018
@aeschli
Copy link
Contributor

aeschli commented Jun 4, 2018

Why do you think it is a bug? What do you suggest as improvement?

@usernamehw
Copy link
Contributor

Caching tsconfig.json schema?

@Tyriar
Copy link
Member Author

Tyriar commented Jun 4, 2018

Why do you think it is a bug? What do you suggest as improvement?

  1. I'm not sure why I got the error in the first place as the schema should have been cached.
  2. The main thing is to not show an error that cannot be dismissed just because I don't have an internet connection. I know I don't and I want to code on the plane without needless distractions that cannot be actioned. A console.error would be more appropriate.

@aeschli
Copy link
Contributor

aeschli commented Jun 4, 2018

Yes, schemas are cached, but we are pretty aggressive in reseting the cache for example on json settings changes. One reason for that is also that the server data can update any time.

What you get is a problem of severity information in the problems view. I personally don't find it very distractive but rather important information that explains why you don't get any validation and code assist on this file. Connectivity is one reason, but you might also have mistyped the URL or have proxy issues. Just logging that to the dev console is IMO not the right thing to do. The typical user doesn't have the dev tools open.

I'm happy to keep this request open for votes from other users.

@aeschli aeschli added feature-request Request for new features or functionality json JSON support issues and removed bug Issue identified by VS Code Team member as probable bug labels Jun 4, 2018
@aeschli aeschli added this to the Backlog milestone Jun 4, 2018
@aeschli aeschli changed the title Working offline eventually hit a schema error [json] problem from unaccessible schema is distracting Jun 4, 2018
@Tyriar
Copy link
Member Author

Tyriar commented Jun 5, 2018

I personally don't find it very distractive but rather important information that explains why you don't get any validation and code assist on this file.

I use F8 frequently to fix all errors in the project before committing, it's annoying that tsconfig.json keeps opening with an error that I cannot be "fixed".

Connectivity is one reason, but you might also have mistyped the URL or have proxy issues.

Wouldn't these return different error messages and can be handled separately?

@Tyriar
Copy link
Member Author

Tyriar commented Jun 11, 2018

What I saw on the next flight:

screen shot 2018-06-10 at 4 41 09 pm

@ramya-rao-a
Copy link
Contributor

@aeschli Having a non-actionable error/warning that cannot be removed is indeed distracting. Having a setting that controls this attempt to refresh the schema cache can help in 2 ways

  • When users are offline, they can now turn this feature off and have no distractions
  • As per Offline mode for VS Code #54354, users who want to control outgoing network requests from VS Code now can control the schema check.

Thoughts?

@Tyriar
Copy link
Member Author

Tyriar commented Jul 28, 2018

@ramya-rao-a a setting is all good and fine, but I don't want to go and manually change a bunch of settings when I'm offline for a while just to avoid online-related error message. It should silently fail and use a cached copy if no network is detected as having the absolute latest schema version isn't critical to operation.

@Ntropish
Copy link

Ntropish commented Oct 5, 2018

Slightly related, I get the same thing except it's trying to load the package.json schema. I work in a closed environment so that schema is never going to be loaded. I also like to use the built-in console as I develop so I always see "Problems (1)".

@Tyriar
Copy link
Member Author

Tyriar commented Oct 5, 2018

@aeschli is this a good candidate for help wanted/good first issue?

@aeschli aeschli added the help wanted Issues identified as good community contribution opportunities label Oct 8, 2018
@aeschli
Copy link
Contributor

aeschli commented Oct 8, 2018

Yes, good idea.
I was thinking we add a status bar entry for JSON like for TypeScript or TSLint. That can all be done on the JSON client. Write a middleware that intercepts the diagnostics from the server, filter the SchemaResolveError, create a status bar entry.

@aeschli aeschli added the good first issue Issues identified as good for first-time contributors label Oct 8, 2018
@literalplus
Copy link
Contributor

If this is what you mean by "create a status bar entry", then I'd like to try to solve this issue:
2018-10-09_00 10 27

literalplus added a commit to literalplus/vscode that referenced this issue Oct 8, 2018
This commit adds a middleware to the JSON Language Feature client
which intercepts diagnostics for schema resolution errors, and shows
them in the status bar instead of treating them as code errors.

Fixes microsoft#51032
@aeschli
Copy link
Contributor

aeschli commented Oct 9, 2018

I meant something like what TSLint shows:
image

There can be a hover on the status item explaining that validation for the current file is disabled as the schema could not be resolved.
Clicking on it can offer a retry action (that would likely require a new type of message that we send to the JSON server).

@aeschli
Copy link
Contributor

aeschli commented Oct 29, 2018

fixed by #60219

@aeschli aeschli closed this as completed Oct 29, 2018
@aeschli aeschli modified the milestones: Backlog, October 2018 Oct 29, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities json JSON support issues on-testplan
Projects
None yet
Development

No branches or pull requests

7 participants