tamasfe / taplo

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

Numerous bugs with schema #650

Open arisudesu opened 3 weeks ago

arisudesu commented 3 weeks ago

Vscode extension doesn't work if file extension is not .toml. Says "this document has been excluded" in the first line and schema selection doesn't work. File contents is Telegraf configuration.

Additionally, when I change the file extension to .toml, it shows "no schema selected", however I have associated any file with "any schema":

    "evenBetterToml.schema.associations": {
        "^.*$": "https://json.schemastore.org/any.json"
    },

Furthermore, the schema selection is tripled.

Extension version is: v0.19.2.

изображение

изображение

panekj commented 3 weeks ago

Furthermore, the schema selection is tripled.

Duplicate of https://github.com/tamasfe/taplo/issues/395

Additionally, when I change the file extension to .toml, it shows "no schema selected"

This is currently broken, use external LSP in settings. https://github.com/tamasfe/taplo/issues/624#issuecomment-2270463328

arisudesu commented 3 weeks ago

Thanks, I subbed to these issues. It is a bit hard to discover them, since their titles are vague.

However, the external LSP doesn't work for me too. Logs from the extension are:

[Info  - 19:12:14] Connection to server got closed. Server will restart.
[Error - 19:12:14] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Even Better TOML LSP client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 19:12:14] Connection to server got closed. Server will restart.
[Error - 19:12:14] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Even Better TOML LSP client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 19:12:14] Connection to server got closed. Server will restart.
[Error - 19:12:14] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Even Better TOML LSP client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 19:12:14] Connection to server got closed. Server will restart.
[Error - 19:12:14] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Even Better TOML LSP client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] The Even Better TOML LSP server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 19:12:14] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Even Better TOML LSP client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 19:12:14] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 

I tried taplo-cli latest and taplo-cli@0.8.1.

panekj commented 3 weeks ago

Did you configure both evenBetterToml.taplo.bundled and evenBetterToml.taplo.path (it has to be full path)?

arisudesu commented 3 weeks ago

Sure. My settings are:

    "evenBetterToml.taplo.bundled": false,
    "evenBetterToml.taplo.path": "D:\\RUST\\cargo\\bin\\taplo.exe",
    "evenBetterToml.taplo.extraArgs": []

and my taplo is here

> where taplo.exe
D:\RUST\cargo\bin\taplo.exe

> taplo.exe
taplo 0.9.3

USAGE:
    taplo [OPTIONS] <SUBCOMMAND>

OPTIONS:
        --colors <COLORS>    [default: auto] [possible values: auto, always, never]
    -h, --help               Print help information
        --log-spans          Enable logging spans
    -V, --version            Print version information
        --verbose            Enable a verbose logging format

SUBCOMMANDS:
    config    Operations with the Taplo config file [aliases: cfg]
    format    Format TOML documents [aliases: fmt]
    get       Extract a value from the given TOML document
    help      Print this message or the help of the given subcommand(s)
    lint      Lint TOML documents [aliases: check, validate]
    lsp       Language server operations
panekj commented 3 weeks ago

I'm rarely on Windows so I can't check right now but can you verify that taplo lsp works from terminal and eventually try with / instead of \\ as path separator?

arisudesu commented 3 weeks ago

I don't know what taplo is doing in normal conditions, but taplo lsp works and prints usage:

> taplo lsp
taplo-lsp
Language server operations

USAGE:
    taplo lsp [OPTIONS] <SUBCOMMAND>

OPTIONS:
    -c, --config <CONFIG>            Path to the Taplo configuration file [env: TAPLO_CONFIG=]
        --cache-path <CACHE_PATH>    Set a cache path
        --colors <COLORS>            [default: auto] [possible values: auto, always, never]
    -h, --help                       Print help information
        --log-spans                  Enable logging spans
        --no-auto-config             Do not search for a configuration file
        --verbose                    Enable a verbose logging format

SUBCOMMANDS:
    help     Print this message or the help of the given subcommand(s)
    stdio    Run the language server over the standard input and output
    tcp      Run the language server and listen on a TCP address

However, running taplo lsp tcp or taplo lsp stdio (which I presume is operating mode for talking to VSCode), gives no output and the process terminates immediately. I tested on my working machine and in "clean" environment - Windows Sandbox - with the same executable.

Changing slashes from \\ to / doesn't help, same effect.