tamasfe / taplo

A TOML toolkit written in Rust
https://taplo.tamasfe.dev
MIT License
1.26k stars 108 forks source link

LSP: robust handling of `uri-reference` #605

Open bollwyvl opened 1 month ago

bollwyvl commented 1 month ago

thanks for taplo!

elevator pitch

When working with a schema-constrained TOML file in the language server, and a string is encountered with "format": "uri-reference", offer nice LSP features like:

motivation

Many TOML-based configuration files include references to other files and directories, some of which may not yet exist when the file is being written.

The uri-reference format for strings allows for precisely stating that the value is a POSIX-style relative path.

alternatives

If the above features would be undesirable everywhere, putting it behind x-taplo would limit it to taplo-aware schema that wanted this behavior:

{
  "x-taplo": {
    "uriReference": {
      "completion": true,
      "gotoDefinition": true,
      "diagnosticMissing": "Warning",
      "diagnosticExists": "Information",
    }
  }
}