redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.01k stars 244 forks source link

Github workflow deploy.yml detected as a PHP Deployer config #943

Open med8bra opened 6 months ago

med8bra commented 6 months ago

Is your enhancement related to a problem? Please describe.

The file name could match multiple schemas from schema store, in my case **/.github/workflows/deploy.yaml and deploy.yaml match GitHub and Deployer schemas.

Describe the solution you would like

I read the prioritization logic, and I believe it may make sense to give priority to patterns that match the longest:

Describe alternatives you have considered

There are solutions to overcome this:

Additional context

Here are some logs from LSP

lsp.lua:1392    "LSP[yamlls]"   "client.request"    2   "wk/willRenameFiles"    { files = { 
    { newUri = "file:///.github/workflows/deploy.yaml", oldUri = "file:///.github/workflows/deploy-it.yaml" }
    }}
rpc.lua:284 "rpc.send"  { id = 2, jsonrpc = "2.0", md = "wk/willRenameFiles", params = { files = {
  { newUri = "file:///.github/workflows/deploy.yaml", oldUri = "file:///.github/workflows/deploy-it.yaml" }
  }}}
rpc.lua:387 "rpc.receive"   { jsonrpc = "2.0", md = "textDocument/publishDiagnostics", params = { diagnostics = {}, uri = "file:///.github/workflows/deploy-it.yaml" }}
rpc.lua:387 "rpc.receive"   { error = { code = -32601, message = "Unhandled md wk/willRenameFiles" }, id = 2, jsonrpc = "2.0"}
rpc.lua:387 "rpc.receive"   { jsonrpc = "2.0", md = "textDocument/publishDiagnostics", params = { diagnostics = { {
  code = 0, 
  data = { properties = { "version", "import", "config", "hosts", "tasks", "before", "after" },
  schemaUri = { "https://raw.githubusercontent.com/deployphp/deployer/master/src/schema.json" } },
  message = "Property jobs is not allowed.",
  source = "yaml-schema: Deployer Recipe" },
  { code = 0, data = { properties = { "version", "import", "config", "hosts", "tasks", "before", "after" },
  schemaUri = { "https://raw.githubusercontent.com/deployphp/deployer/master/src/schema.json" } },
  message = "Property env is not allowed.",
  range = { ["end"] = { character = 3, line = 18 }, start = { character = 0, line = 18 } }, severity = 1, 
  source = "yaml-schema: Deployer Recipe" },
Tronikelis commented 1 day ago

bumping this as I just ran into this as well