Open gcampbell-msft opened 2 months ago
Follow the repro steps for this bug: https://github.com/microsoft/vscode-cmake-tools/issues/3651. This is the root bug that I was investigating that caused me to create this.
Sorry, I cannot go through that. Minimal repro steps welcome.
This makes me think that the provideTextDocumentContent isn't being called again for new providers when extensions are activated.
Can you provide more context? Is the CMakePresets.json
-file a real file on disk or where does it come from? Also, who is provide its contents in case your extension hasn't been activated yet.
Generally, "yes" we don't call provideTextDocumentContent again if the document is already open and "owned" by another provider
@jrieken CMakePresets.json is a real file. My expectation is that it wouldn't be owned by another provider except for when our extension is activated.
Minimal repro steps:
This is where I would slightly expect that when we provide the schema provider, it would get re-called and it would resolve.
To see how our extension does provide the schema:
Notice that there is a warning at the top saying it couldn't load the schema.
So, you register a text document content provider for the schema, not for the file itself. But the schema-uri is passed through some other way, right?
Correct.
I'm not 100% sure I understand your question. But the CMake Tools extension uses the package.json jsonValidation
entry to associate the files with the schema-uri
Does this issue occur when all extensions are disabled?: Yes/No
Steps to Reproduce:
Follow the repro steps for this bug: https://github.com/microsoft/vscode-cmake-tools/issues/3651. This is the root bug that I was investigating that caused me to create this.
I think I've noticed the issue.
Effectively, if you open the folder WITHOUT the CMakePresets.json file open. Then, perform an action that activates the CMake Tools extension, THEN open up the CMakePresets.json file, since the provider is already activated, the
provideTextDocumentContent
method that the CMake Tools extension provides will get called.However, if you open the CMakePresets.json file BEFORE the CMake Tools extension is activated, even after activating the CMake Tools extension and closing an reopening the CMakePresets.json file, the validation still fails.
This makes me think that the
provideTextDocumentContent
isn't being called again for new providers when extensions are activated.Technically we could fix this by adding an
onFileSystem:cmake-tools-schema
activationEvent, but I'm not sure yet whether we want to do this.Thanks