Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate comment when converting back from document #25

Open
zoroaster00 opened this issue Jun 21, 2018 · 4 comments
Open

Duplicate comment when converting back from document #25

zoroaster00 opened this issue Jun 21, 2018 · 4 comments
Labels

Comments

@zoroaster00
Copy link

The yaml will contain duplicate comment when converting the parsed document by "toString"
Example:

test1:
  foo: #123
    bar: 1

After converting to document and toString

test1:
  foo: #123
    #123
    bar: 1
@mohsen1 mohsen1 added the bug label Jun 21, 2018
@mohsen1
Copy link
Owner

mohsen1 commented Jun 21, 2018

I'm planning a major refactor of this using a new parser. I'll make sure it is covering this issue as well

@cajurabi
Copy link

Moshen, have you started the rewrite? I just made a kludgy fix for one of the bugs I was encountering. It occurred to me the biggest issue is you are not modifying the AST, but instead are modifying the YAML directly, and not updating the AST pointers as text is added and removed. This causes offset issues into the YAML source. Add on top of it the NPM packages you are tied too are outdated and you are using deprecated NPM mechanisms. A rewrite will be a multi-day effort and is probably best done using yaml-ast-parser from Mulesoft. Even that isn't ideal but it will give you a good starting point. If you are going to do a rewrite, I will assist. Let me know.

@mohsen1
Copy link
Owner

mohsen1 commented Jun 21, 2018

I have started the refactoring #26

The goal is to never touch the yaml string and alway do the modifications in the AST because the new AST has comments in it too.

@cajurabi
Copy link

you have a slack channel? Let's divide and conquer on the refactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants