Skip to content

fix: apply vocabulary gating to completion, hover, and document symbols - #349

Open
Muhammad Faseeh (Faseeh06) wants to merge 1 commit into
microsoft:mainfrom
Faseeh06:fix/vocabulary-gating-completion-hover-symbols
Open

fix: apply vocabulary gating to completion, hover, and document symbols#349
Muhammad Faseeh (Faseeh06) wants to merge 1 commit into
microsoft:mainfrom
Faseeh06:fix/vocabulary-gating-completion-hover-symbols

Conversation

@Faseeh06

Copy link
Copy Markdown

Fixes #330

JSONDocument.getMatchingSchemas() accepts an optional activeVocabularies parameter that applies 2019-09+ $vocabulary keyword gating (via isKeywordEnabled). The validation path already threads this through (jsonValidation.ts passes schema.activeVocabularies to jsonDocument.validate(...)), but the other four callers of getMatchingSchemas never did, even though ResolvedSchema already exposes the same activeVocabularies field:

  • jsonCompletion.ts (property completions and value completions)
  • jsonHover.ts
  • jsonDocumentSymbols.ts (findDocumentColors)

The result: a schema with a custom $vocabulary that disables certain keywords (e.g. properties) correctly excludes those keywords from validation diagnostics, but completion suggestions, hover text, and color/document-symbol extraction still processed them — an inconsistency between IntelliSense and validation.

Changes

  • Pass schema.activeVocabularies through at all four getMatchingSchemas call sites, matching the existing validation convention.
  • Added a regression test demonstrating that findDocumentColors now respects a meta-schema that omits the applicator vocabulary (fails without the fix, passes with it).

Test plan

  • New regression test added to src/test/documentSymbols.test.ts
  • Verified the new test fails on the unmodified call site and passes with the fix
  • Full relevant test suites (documentSymbols, completion, hover, parser, vocabularies — 173 tests) pass
  • eslint clean

JSONDocument.getMatchingSchemas() accepts an optional activeVocabularies
parameter that applies 2019-09+ $vocabulary keyword gating. The validation
path already threads this through (jsonValidation.ts passes
schema.activeVocabularies to jsonDocument.validate(...)), but the other
call sites never did, even though ResolvedSchema already exposes the
same activeVocabularies field:

- jsonCompletion.ts (property completions and value completions)
- jsonHover.ts
- jsonDocumentSymbols.ts (findDocumentColors)

The result: a schema with a custom $vocabulary that disables certain
keywords (e.g. properties) correctly excluded those keywords from
validation diagnostics, but completion suggestions, hover text, and
color/document-symbol extraction still processed them.

Passes schema.activeVocabularies through at all four call sites,
matching the existing validation convention. Adds a regression test
demonstrating that findDocumentColors now respects a meta-schema that
omits the applicator vocabulary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2019-09: vocabulary gating not applied to completion/hover/document symbols

3 participants