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

preserving comments #28

Open
wmtorode opened this issue Aug 16, 2019 · 5 comments
Open

preserving comments #28

wmtorode opened this issue Aug 16, 2019 · 5 comments

Comments

@wmtorode
Copy link

Is there a way to preserve comments so that if I edit a file the comments it contained are still there?

@dpranke
Copy link
Owner

dpranke commented Aug 16, 2019

Unfortunately, no, not currently.

In order to do that you need to preserve the whole parse tree, which certainly doesn't work inside the existing simple load/dump API.

I would like to support this, though, it's something of a challenging problem. I've never seen an API for doing something like that and so it's a bit unclear what a good API would look like.

@wmtorode
Copy link
Author

Thanks, I figured that would be the answer. It would be great if this could be supported even if it's through a different API than the current load and dump.

@dpranke
Copy link
Owner

dpranke commented Jan 14, 2020

Agreed. (Sorry for not responding sooner. I'm still mulling over what an API like this might look like.)

@qneill
Copy link

qneill commented Jul 17, 2020

This npm package is doing it (or claiming to): https://www.npmjs.com/package/comment-json

@dpranke
Copy link
Owner

dpranke commented Jul 21, 2020

@qneill Thanks for the pointer. I'm looking at that now, and it does seem to be at least reasonable well-worked out.

parasyte added a commit to parasyte/sublime_rainbow_csv that referenced this issue Aug 28, 2024
- The color scheme path could not be found due to a syntax error
  (case sensitivity).
- When pregenerated grammars are used, the wrong settings path was
  chosen.
  - And auto detection/reloading package settings wasn't working when
    Rainbow CSV syntax was auto-detected by file extension, because then
    it was no longer "plain text".
- Use json5 to parse Syntax-specific settings and set the color scheme.
  - Fixes a bug where modifying the Syntax-specific settings would
    conflict with how the color scheme was enabled and disabled:
  - A pre-existing settings file would prevent the color scheme from
    being used.
  - Disabling the custom color scheme would remove all settings,
    including user preferences like disabling `word_wrap`.
  - Unfortunately, comments are not preserved, so this still leads to
    some data loss. See: dpranke/pyjson5#28

Closes mechatroner#39
parasyte added a commit to parasyte/sublime_rainbow_csv that referenced this issue Aug 28, 2024
- The color scheme path could not be found due to a syntax error
  (case sensitivity).
- When pregenerated grammars are used, the wrong settings path was
  chosen.
  - And auto detection/reloading package settings wasn't working when
    Rainbow CSV syntax was auto-detected by file extension, because then
    it was no longer "plain text".
- Use json5 to parse Syntax-specific settings and set the color scheme.
  - Fixes a bug where modifying the Syntax-specific settings would
    conflict with how the color scheme was enabled and disabled:
  - A pre-existing settings file would prevent the color scheme from
    being used.
  - Disabling the custom color scheme would remove all settings,
    including user preferences like disabling `word_wrap`.
  - Unfortunately, comments are not preserved, so this still leads to
    some data loss. See: dpranke/pyjson5#28

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

No branches or pull requests

3 participants