yaml-language-server
yaml-language-server copied to clipboard
Github workflow deploy.yml detected as a PHP Deployer config
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:
- for each schema pattern match, compute priority for schema as
match.length+(schema.priority??0) - and then select the highest (as implemented now)
Describe alternatives you have considered
There are solutions to overcome this:
- Renaming the file =>
deployis very generic name, and it's bad that I cannot use it just because LSP cannot detect it as a github workflow. - Adding modeline => adds extra noise, especially that other files don't need it (so one exception)
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" },
bumping this as I just ran into this as well