taplo icon indicating copy to clipboard operation
taplo copied to clipboard

Watch `evenBetterToml.schema.associations` and auto-reload on change

Open loynoir opened this issue 1 year ago • 4 comments

actual

        "json.schemas": [
            {
                "fileMatch": [
                    "**/.cargo/config.json"
                ],
                "url": "http://127.0.0.1:8000/schema/cargo-config.schema.json?from=json&ts=v1"
            }
        ],
        "yaml.schemas": {
            "http://127.0.0.1:8000/schema/cargo-config.schema.json?from=yaml&ts=v1": [
                "**/.cargo/config.yaml"
            ]
        },
        "evenBetterToml.schema.associations": {
            "^.*/\\.cargo/config\\.toml$": "http://127.0.0.1:8000/schema/cargo-config.schema.json?from=toml&ts=v1"
        },

Change

  • ts=v1

To

  • ts=v2

See http.server log

127.0.0.1 - - [xxx] "GET /schema/cargo-config.schema.json?ts=v2&from=json HTTP/1.1" 200 -
127.0.0.1 - - [xxx] "GET /schema/cargo-config.schema.json?ts=v2&from=yaml HTTP/1.1" 200 -

vscode builtin json and redhat.vscode-yaml auto reload schema, but tamasfe.even-better-toml does not auto reload schema.

Thus, need to Ctrl+p Reload Window

expected

tamasfe.even-better-toml auto reload schema, like json and redhat.vscode-yaml.

loynoir avatar Nov 01 '23 11:11 loynoir

This is a duplicate of #375 that has been closed after updating the documentation in #452. I'll keep this open in case someone wants to write a PR. But note that there are others LSP that behave similarly, like rust-analyzer for Rust (needs a reload to change the config because they are provided as initializationParams).

ia0 avatar Nov 03 '23 16:11 ia0

I don't mean to watch all config.

Just watch jsonschema related config, such as evenBetterToml.schema.associations, should be fine.

Like vscode watch json.schemas, and redhat.vscode-yaml watch yaml.schemas.

loynoir avatar Nov 03 '23 17:11 loynoir

I see, I misunderstood. But then this looks even more niche, because those configs should very rarely change. This looks only useful for schema development. Still keeping open in case someone wants to implement it.

ia0 avatar Nov 03 '23 17:11 ia0

This looks only useful for schema development

Yes, partial schema as workaround for https://github.com/rust-lang/cargo/issues/12883

loynoir avatar Nov 04 '23 07:11 loynoir