vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

Auto-reload yaml schema if edited in the workspace

Open apupier opened this issue 4 years ago • 8 comments

when developing a yaml schema, it would be useful that when it is modified, the modified file is picked up automatically. Currently, I need to restart VS Code.

Use case:

  • create a yaml schema
  • modify settings yaml.schemas to point to it
  • open a file X.yaml matching the glob pattern provided for yaml.schemas
  • call completion in the X.yaml file
  • modify the yaml schema, save
  • go back to X.yaml editor --> have completion/validation corresponding to the modified and saved yaml schema

apupier avatar Jul 01 '20 14:07 apupier

Just doing a window reload works as well, but that kills my bootstrapped shell (that holds many env settings), which is not nice.

Morriz avatar Oct 08 '20 11:10 Morriz

Reloading the window after schema modifications shouldn't be the proper way of updating the validation. There should be an auto-reload mechanism upon schema change, or at least a command to reload schemas manually.

warthist avatar Oct 14 '20 09:10 warthist

As a workaround, if you remove the file manually from your settings.json, save it, and then add it back, VS will force reload the new schema on disk.

runyontr avatar Aug 20 '21 11:08 runyontr

I notice automatic reloading since a couple of weeks...so this is resolved imo

Morriz avatar Aug 23 '21 18:08 Morriz

Not resolved for me here on Mac, also a duplicate has been opened after @Morriz comment: https://github.com/redhat-developer/vscode-yaml/issues/639

corneliusroemer avatar Aug 12 '22 15:08 corneliusroemer

I can confirm the issue persists on Mac. Particularly when using the inline # yaml-language-server: $schema=... method. Current workaround for me is to (tediously):

  1. Remove the inline comment.
    - # yaml-language-server: $schema=path/to/my.schema.json
      ---
      $schema: https://json-schema.org/draft-07/schema
    
  2. Apply a random schema using schema-selector in the bottom right corner. image and... image
  3. Re-adding the inline comment.
    + # yaml-language-server: $schema=path/to/my.schema.json
      ---
      $schema: https://json-schema.org/draft-07/schema
    

Not fun, nor ideal, when moving at a fast-pace.

LeShaunJ avatar Jun 16 '23 17:06 LeShaunJ