microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.71k stars 131 forks source link

VS Code says "unable to load schema" because it redirects to `en-US` #253

Closed muuvmuuv closed 1 year ago

muuvmuuv commented 4 years ago

VS Code throws an JSON Schema error because https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json is redirecting to https://developer.microsoft.com/en-us/json-schemas/tsdoc/v0/tsdoc.schema.json. When changing the $schema to the redirected URL I get schema validation again but eslint now prints:

Error loading TSDoc config file:
Errors encountered for ./tsdoc.json:
  Unsupported JSON "$schema" value; expecting "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json"
eslinttsdoc/syntax
octogonz commented 4 years ago

@muuvmuuv Thanks for reporting this! Something might be wrong with the schema server. I'll ask around.

octogonz commented 4 years ago

Interestingly, this problem does NOT apply to other schema URLs from the same server. For example, this one does not redirect:

https://developer.microsoft.com/json-schemas/rush/rush.schema.json

And if you add en-us, it redirects back to the above URL:

https://developer.microsoft.com/en-us/json-schemas/rush/rush.schema.json

It seems that each folder must be individually configured, since the ones that work are older projects, and the ones that are broken are newer projects. We need to find the person who administers that web server, and get them to generalize the configuration to apply to all folders.

ghost commented 3 years ago

@octogonz Has anyone followed up the administrator to resolve this issue. Heft config schemas are unable to load as well. .e.g Unable to load schema from 'https://developer.microsoft.com/json-schemas/heft/typescript.schema.json': Request vscode/content failed unexpectedly without providing any details.. I have to add the en-us portion to have them loaded correctly.

octogonz commented 3 years ago

@apostolisms investigated earlier this summer but was unable to find anybody who owns that server. (This problem affects other groups like SPFx and Teams, so I'm surprised someone else hasn't pursued it.)

My proposal was to relocate all the Rush Stack schemas to https://rushstack.io/json-schemas/ which we control. It's not ideal, but it's easy to implement. If nobody has objections to that plan, lemme know.

adamsemma commented 1 year ago

Problems loading reference 'https://json.schemastore.org/package': Unable to load schema from 'https://json.schemastore.org/package': getaddrinfo EAI_AGAIN json.schemastore.org.

LGW22 commented 1 year ago

someone know this problem?

Problems loading reference 'vscode://schemas/settings/configurationDefaults': Unable to load schema from 'vscode://schemas/settings/configurationDefaults': cannot open vscode://schemas/settings/configurationDefaults. Detail: Unable to resolve text model content for resource vscode://schemas/settings/configurationDefaults.

octogonz commented 1 year ago

someone know this problem?

Problems loading reference 'vscode://schemas/settings/configurationDefaults': Unable to load schema from 'vscode://schemas/settings/configurationDefaults': cannot open vscode://schemas/settings/configurationDefaults. Detail: Unable to resolve text model content for resource vscode://schemas/settings/configurationDefaults.

This problem sounds unrelated to this issue.

octogonz commented 1 year ago

@DevArvindsa @iclanton @apostolisms FYI I just confirmed that the redirect is still happening for https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json

qionghe9 commented 1 year ago

someone know this problem?

Problems loading reference 'vscode://schemas/settings/configurationDefaults': Unable to load schema from 'vscode://schemas/settings/configurationDefaults': cannot open vscode://schemas/settings/configurationDefaults. Detail: Unable to resolve text model content for resource vscode://schemas/settings/configurationDefaults.

I have encountered the same problem, how did you solve it?

joshxyzhimself commented 1 year ago

Weird. I closed the tab of the file causing this error, the warning disappeared. I re-opened the tab of the file, warning did not reappear.

JohnSmall commented 1 year ago

Strange, this problem started happening sometime in the last few weeks. When creating a devcontainer for Rails + Posgres then the container can't access the outside world because it only has the localhost network interface setup. And I get this error from the devcontainer file Unable to load schema from 'https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json': getaddrinfo EAI_AGAIN raw.githubusercontent.com.

But starting a Node + Postgres devcontainer has no problem at all because it creates an extra network interface which does allow contact with the outside world.

brokenthorn commented 1 year ago

I have the same error. Autocomplete/suggestions don't work, which is how I noticed something was wrong: image

Error text:

Unable to load schema from 'vscode://schemas/settings/user': cannot open vscode://schemas/settings/user. Detail: Unable to resolve text model content for resource vscode://schemas/settings/user.(768)
loongzhu commented 1 year ago

I have the same error. Autocomplete/suggestions don't work, which is how I noticed something was wrong: image

Error text:

Unable to load schema from 'vscode://schemas/settings/user': cannot open vscode://schemas/settings/user. Detail: Unable to resolve text model content for resource vscode://schemas/settings/user.(768)

Hi, I also encountered the same problem,I've added following string to user settings, and the error was gone:

 "json.validate.enable": false
blakeNaccarato commented 1 year ago

EDIT: If you came here from Google like me looking for a solution to VSCode settings.json autocomplete/hover breaking, note that it's already being addressed over at https://github.com/microsoft/vscode/issues/177142. This issue topic is actually not the right place to discuss that issue, I found out after typing the essay below. It should be fixed in a hotfix or the next release.

A workaround for now: I found that poking any json.<...> settings key in settings.json restores proper autocomplete/hover in VSCode's settings.json until next VSCode restart. But a json key must be poked after every restart. For example, put "json.schemaDownload.enable": true, at the top of your settings.json and save the file. You will have to toggle and save this key every time you start VSCode. See my repro below, collapsed under "details" because it's actually off-topic to this issue we're in right now.

details

I can confirm that setting `"json.validate.enable": false` allows hover hints and completion to function again, e.g. in VSCode's own `settings.json` modification. However, this workaround throws out all JSON linting and reporting in the "Problems" pane, so it's sort of the nuclear option. This issue just cropped up for me in the past few days, so it may be a regression associated with the latest release? After further investigation, I find that poking any `json.<...>` settings key in `settings.json` restores proper autocomplete/hover in VSCode's `setitngs.json` _until next VSCode restart_. But a `json` key must be poked after every restart. Here's a rundown: 1. Ensure all `json.<...>` tree of settings keys are initially at their defaults, e.g. none of these keys are explicitly specified in any of your `settings.json` (maybe unnecessary, but this is my starting state). 3. Restart VSCode (e.g. with `Developer: Reload Window`). Navigate to your user `settings.json`. The following warning presents in the Problems pane: ```Plaintext Unable to load schema from 'vscode://schemas/settings/user': cannot open vscode://schemas/settings/user. Detail: Unable to resolve text model content for resource vscode://schemas/settings/user. ``` 4. Make a trivial setting modification in the `json` tree of settings keys, _even if that modification is a no-op, like explicitly specifying a default as its default value_. For example, put `"json.schemaDownload.enable": true,` at the top of your `settings.json` and save the file. (You could've also poked `"json.validate.enable"` to be either `true` or `false` I think, maybe?) 5. Check whether autocomplete/hover works properly in `settings.json`, completing settings names and such. It should work now. 6. You can even remove the edit you made in step (4), save `settings.json` again, and autocomplete/hover still works. 7. Restart VSCode. 8. Now autocomplete/hover is broken again in `settings.json`, until some modification to the `json.<...>` tree of settings keys is made again, like in step 4. For example, commenting out `"json.validate.enable": true` if it's there, and saving, restores autocomplete/hover. So this issue may have to do with unstable startup behavior of JSON schema handling, perhaps isolated to VSCode's own `settings.json` or perhaps all JSON schemas more broadly, and this unstable state can be temporarily fixed by poking a `json.<...>` settings key, but the unstable behavior returns on the next program start. At least in my case.

SabitaOjha commented 1 year ago

Getting the following error while opening angular project in vs code. error

ypkkhatri commented 1 year ago

Getting the following error while opening angular project in vs code. error

I'm getting the same error from a few days back.

Ender-Wang commented 1 year ago

Error: Unable to load schema from 'vscode://schemas/settings/user': cannot open vscode://schemas/settings/user. Detail: Unable to resolve text model content for resource vscode://schemas/settings/user.(768) Fix: add this line in the beginning of your User/settings.json file: "json.schemaDownload.enable": true,.

Zamiell commented 1 year ago

@Ender-Wang Thanks, that worked for me! Can you give more context? What does this configuration change do, and why is it necessary?

Ender-Wang commented 1 year ago

@Ender-Wang Thanks, that worked for me! Can you give more context? What does this configuration change do, and why is it necessary?

It seems the schema vscode trying to get is either not in the dir or the version doesn't matter what vscode expect. And the line enables vscode to download the desired version.

Asiinoob commented 1 year ago

Weird. I closed the tab of the file causing this error, the warning disappeared. I re-opened the tab of the file, warning did not reappear.

Same here.

KnifeFed commented 1 year ago

Fix: add this line in the beginning of your User/settings.json file: "json.schemaDownload.enable": true,.

That only works for me until VSCode is restarted.

octogonz commented 1 year ago

I'm closing this issue because the original problem (redirecting to en-us localized URLs) has been solved. If anyone is still having trouble, please open a new GitHub issue with repro steps. Thanks!

jayant0146 commented 1 year ago

Kindly help me with this problem?

Problems loading reference 'vscode://schemas/settings/configurationDefaults': Unable to load schema from 'vscode://schemas/settings/configurationDefaults': cannot open vscode://schemas/settings/configurationDefaults. Detail: Unable to resolve text model content for resource vscode://schemas/settings/configurationDefaults.

cebasfu93 commented 1 year ago

I just encountered the same issue. Switching to the pre-release version of the Python extension solved it for me... for now 😅