Skip to content

Commit 2be71a5

Browse files
authored
fix(vscode): filter out non-file doc uri in stage change hook (#314)
* fix(vscode): filter out non-file doc uri in stage change hook * update * update * update
1 parent 05bf237 commit 2be71a5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/ide/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zenstack-v3",
33
"publisher": "zenstack",
4-
"version": "3.0.9",
4+
"version": "3.0.11",
55
"displayName": "ZenStack V3 Language Tools",
66
"description": "VSCode extension for ZenStack (v3) ZModel language",
77
"private": true,

packages/language/src/module.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,19 @@ export function createZModelLanguageServices(
9494

9595
// when documents reach Parsed state, inspect plugin declarations and load corresponding
9696
// plugin zmodel docs
97+
// Note we must use `onBuildPhase` instead of `onDocumentPhase` here because the latter is
98+
// not called when not running inside a language server.
9799
shared.workspace.DocumentBuilder.onBuildPhase(DocumentState.Parsed, async (documents) => {
98100
for (const doc of documents) {
99101
if (doc.parseResult.lexerErrors.length > 0 || doc.parseResult.parserErrors.length > 0) {
100102
// balk if there are lexer or parser errors
101103
continue;
102104
}
103105

106+
if (doc.uri.scheme !== 'file') {
107+
continue;
108+
}
109+
104110
const schemaPath = fileURLToPath(doc.uri.toString());
105111
const pluginSchemas = getPluginDocuments(doc.parseResult.value as Model, schemaPath);
106112
for (const plugin of pluginSchemas) {

0 commit comments

Comments
 (0)