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

Remove Property is not working as expected. #10

Open
nonoroazoro opened this issue May 4, 2018 · 2 comments
Open

Remove Property is not working as expected. #10

nonoroazoro opened this issue May 4, 2018 · 2 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@nonoroazoro
Copy link

nonoroazoro commented May 4, 2018

It's such a great tool to handle JSON (with comments). Thanks!

But I find that it can not pass the following test:

test('remove property', () => {
    let content = '{\n  "x": "y",\n  // This is a comment\n  "test": "1"\n}';
    let edits = removeProperty(content, ['x'], formatterOptions);
    assertEdit(content, edits, '{\n  // This is a comment\n  "test": "1"\n}');
});

I've added a comment right after the property x. What I want is to remove the property but keep the comment. But jsonc-parser removes the comment too, which I think this maybe a bug or something?

P.S. You can test this in edit.test.ts.

@aeschli
Copy link
Contributor

aeschli commented May 4, 2018

Handing comments while editing is very tricky. There's no specific code yet for this.

@aeschli aeschli added the feature-request Request for new features or functionality label May 4, 2018
@nonoroazoro
Copy link
Author

I know, but that's why I use your great tool 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants