redhat-developer / redhat-developer/yaml-language-server

Github workflow deploy.yml detected as a PHP Deployer config

Open
#943 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

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 => deploy is 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" },

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the schema-pattern prioritization logic referenced in the issue and review how matches and schema priorities are currently compared. Verify the change with the conflicting .github/workflows/deploy.yaml and deploy.yaml patterns, ensuring the GitHub workflow receives the intended schema without breaking other matches.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.