redhat-developer / redhat-developer/vscode-yaml

`registerContributor` is not called when yaml file is opened at vscode start

Open
#261 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

In our vscode-quarkus, we use registerContributor to manage Quarkus application.yaml. It starts working well but I have a problem with this following usecase: when I start vscode and I open application.yaml there are no validation which is done.

Indeed in this usecase, my registerContributor is registered AFTER the application.yaml is opened and yaml language server execute diagnostics. If I type some character, diagnostics is working.

My understand is that we need to start vscode-yaml to get the registerContributor. If application.yaml is opened, the registerContributor is done after.

See my PR at https://github.com/redhat-developer/vscode-quarkus/pull/189

IMHO to fix this issue, I think vscode-yaml should loop for each extension which wants to register JSON Schema with registerContributor (like Eclipse Plugin extension could do it).

For instance, a vscode extension could delcare in their package.json that:

contributeToJSonSchema: true

and the vscode extension should return a list of YamlSchemaContributor :

declare type YamlSchemaContributor = (schema: string,
  requestSchema: (resource: string) => string | undefined,
  requestSchemaContent: (uri: string) => Promise<string>) => void;

@JPinkney @itowlson what do you think about this idea?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked PR 189 and trace the registerContributor startup path, especially when diagnostics run for application.yaml opened at VS Code launch. Define the extension contribution mechanism and confirm that registered contributors are available before initial diagnostics, with startup-open validation matching validation after editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.