Closed dnicolson closed 10 months ago
I'll look into it. What version of the extension are you using?
Version v0.13.0.
I see what you mean. Looks like the extension is being activated on ordinary json files which it shouldn't be.
I've stopped the extension activating on all .json, .yaml and .xml files, now it's just .tmLanguage.json, .JSON-tmLanguage, .tmLanguage.yaml, .YAML-tmLanguage, .tmLanguage.yaml and .tmLanguage. I think this is the right thing to do even if it's a bit unsubtle. See bf6d918 If you can test it yourself, great, otherwise I'll publish a new version in the next few days.
@dnicolson new version 0.14.0 has been uploaded to the marketplace, if you've got time please can you tell me if it fixes this issue!
Version 0.14.0 resolves the issue.
Initially, I wasn't able to reproduce the original issue because the diagnostics are only run after file changes. Is this intentional? If not, adding this to extension.ts
will check files before changes are made (onDidOpenTextDocument
is not called when a workspace is reopened):
const document = vscode.workspace.textDocuments[0];
if (document) {
diagnosticProvider.CreateDiagnostics(document);
}
vscode.workspace.onDidOpenTextDocument(document => {
diagnosticProvider.CreateDiagnostics(document)
})
I haven't had time to dig into this, but I think it's not working properly in fact - if you have a folder with a .tmlanguage.json
file and a 'plain' .json
file, the extension will not activate until you open the former but then it will attach diagnostics to both of them. The fix may be just checking the document's languageId
before proceeding.
A JSON file containing the following:
Results in: