-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Insert Missing Comma on Enter #6
Conversation
Wow looks interesting! I think current implementation is fine enough, but probably only for json without comments. Initially I was thinking of using some parsing method to insert comma more precisely, some cases to test: I marked with {
"key": "value" /* comment */ // case 1|
} Btw I checked that WebStorm doesn't do this auto comma inserting after comments and don't think its right. I think we can easily workaround this comments problem just by proceeding the editor text with Btw I see I didn't check this project for a long time, so I'll try to setup a decent CI soon. |
Thx for feedback!
Also added JSONC support with "strip-json-comments" In multicursor mode i have some problems: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed some minor changes, so be sure to check them! Other things I leave to you for now! I also did some changes on main branch, so could also merge or rebase them?
Also what about case that I mentioned above: {
"key": "value" //comment
} I think its still would be good to handle cases like this (insert comma after I think these requested changes are final, just need to figure out why CI checks don't run on this pull request? 🤔 Maybe you need to reopen the pr? |
Done.
Maybe, IDK. After all the issues are resolved, I will try to close this PR and create a new one |
Co-authored-by: Vitaly <[email protected]>
Hey, @AgentRBY I've pushed integration tests and also fixes for them. Can you please wether they are good for you? I tried to to cover only basic cases, but probably there are any other cases that you would like to cover? UPD: Also I removed the check that current line starts with comment. I didn't remember what cases it was covering? Gonna be honest, I don't think we ever need Meanwhile I'll try to fix CI issues here. |
I've added some other simple tests to test more cases
It was needed rather for optimization, in order to immediately discard values that begin with comments. In general, its removal does not harm anything. |
I was going to add them as well, but forgot about, thanks for pointing! |
@AgentRBY I misread your comment:
I didn't get the idea about what you were talking, as I can see in the gif, you're just doing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All LGTM! Can I merge, or you want anything else to add, @AgentRBY ?
Okay, I misunderstood the test you pointed out a bit. I just checked and it's really what I wanted I think it's ready to merge @zardoy |
Fix #5
P.s.: I have not written extensions in VS Code before, so I am open to suggestions