ansible-language-server icon indicating copy to clipboard operation
ansible-language-server copied to clipboard

Either upgrade npm yaml to 2.0 or switch to js-yaml

Open ssbarnea opened this issue 3 years ago • 1 comments

Few days ago yaml v2.0 was released and that had lots of breaking changes and apparently it did not include a clear migration strategy.

  • https://github.com/nodeca/js-yaml - 10yr old, 5.5k stars
  • https://github.com/eemeli/yaml - 4yr old, 0.5k stars

ssbarnea avatar Apr 14 '22 14:04 ssbarnea

I asked @tomaciazek why he picked it originally:

much better documentation, syntax-error detection for free, can still parse most of the document despite syntax-errors, returns AST (or CST), which allows more advanced/nuanced traversal, instead of an object representation and the AST/CST contains node ranges, without which no functionality could be implemented...

I guess that would explain the reasons. Now the tricky bit would be get the code upgraded to v2. I started the branch https://github.com/ansible/ansible-language-server/tree/fix/yaml-2.0 but sadly I will not be able to work on it any time soon due having urgent linter work, PTO next week. The fact that I do not know that bit of code makes it even harder.

@tomaciazek @ganeshrn @priyamsahoo If any of you can takeover this it would be awesome, especially as I suspect that the library maintainer will have zero interest in fixing anything in the old version. I suspect that very soon we might even see some security issues caused by this, so better to address it before this happens.

I did a debugging session with @priyamsahoo last week but without much progress, there are API changes that require rework. Anyone taking look at this: feel free to add more changes to that branch, even if you do not fix it completely.

ssbarnea avatar Apr 18 '22 07:04 ssbarnea