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

make auto pairing optional for quotes and parens #475

Merged
merged 12 commits into from
Jul 3, 2022

Conversation

marmoure
Copy link
Contributor

@marmoure marmoure commented May 30, 2022

this PR introduce a new feature that allows to toggle auto pairing for quotas and parens
Fixes #117
image

This open source contribution to the eXide project was commissioned by the Office of the Historian, U.S. Department of State, https://history.state.gov/.

@marmoure
Copy link
Contributor Author

marmoure commented Jun 9, 2022

@cmccrorie this needs review and testing

@marmoure marmoure changed the title [DRAFT] disable auto pairs make auto pairing optional for quatos and parens Jun 9, 2022
@cmccrorie
Copy link
Contributor

@cmccrorie this needs review and testing

@marmoure I have taken a look at this and the option to enable and disable this with in Edit > autopair works. I have had no issue when testing this.

@joewiz
Copy link
Member

joewiz commented Jun 22, 2022

@marmoure In my testing, toggling the new "Edit > autoPair" command does toggle the auto-pairing of single quotes, double quotes, and parentheses: ' " (. This is great! I have a couple of questions:

  1. Reloading the page resets the current selection for the toggle, but the setting should be persistent across reloads of the application, and it should live in "Edit > Preferences" as a checkbox. Could you please move this setting into "Edit > Preferences" as a checkbox with the label "Auto-pair characters"?
  2. With auto-pairing on, square and curly braces - [ { - are not auto-paired, but should be. Would it be easy/quick to extend the auto-pairing behavior to these characters?

Reminder to self: add a note about this new option to https://github.com/eXist-db/eXide/blob/develop/docs/docs.md (perhaps under "code completion"?) before releasing.

@marmoure
Copy link
Contributor Author

thanks @joewiz sounds good
i ll take a look, for the braces i didn't change the original behavior when auto pair is on,would you like to do so?

@joewiz
Copy link
Member

joewiz commented Jun 22, 2022

@marmoure Interesting! In my original note, I mentioned that square brackets were being auto-paired, but perhaps I was mistaken or the behavior changed in the meantime. (I see square brackets are auto-paired in the demo at https://ace.c9.io/.)

Yes, if it's not too much trouble, I think that in the XQuery context it's natural to have auto-pairing on these two characters - [ and {.

But if it looks complex, the PR is acceptable without extending auto-pairing to these characters.

Thanks!

@joewiz
Copy link
Member

joewiz commented Jun 22, 2022

(I see other ace users have requested more configurable behavior regarding auto-pairing... ajaxorg/ace#4199.)

@joewiz joewiz changed the title make auto pairing optional for quatos and parens make auto pairing optional for quoats and parens Jun 22, 2022
@joewiz joewiz changed the title make auto pairing optional for quoats and parens make auto pairing optional for quotes and parens Jun 22, 2022
@marmoure
Copy link
Contributor Author

@joewiz we can have that as a feature if needed
we can configure the wanted behavior in eXide

@marmoure
Copy link
Contributor Author

@joewiz the autoPair is now in EDIT -> Preferences and it's persistent
doing it this way makes it enabled globally for all documents as per the previous approach it was document independent
image

@joewiz
Copy link
Member

joewiz commented Jun 23, 2022

I can confirm that the auto-pair preference works as expected. It changes operations immediately and persists across reloads of eXide.

Could you fix the preference label? It should be "Auto-pair characters" rather than "auto pair".

@joewiz
Copy link
Member

joewiz commented Jun 24, 2022

@marmoure GitHub is reporting a conflict in the PR.

@marmoure
Copy link
Contributor Author

@joewiz can you give this one, a final spin and see the output

@joewiz
Copy link
Member

joewiz commented Jun 30, 2022

@marmoure I see that when I enter [ or { the corresponding closing character is added, with the cursor going between the two characters, as expected. But when I hit the delete key to delete the opening character, both the opening and closing character should be deleted. This is the case with ', ", and ( pairs. Would it be possible to ensure the same behavior in the case of [ and {?

@marmoure
Copy link
Contributor Author

@joewiz i ll try to copy the behavior from the double quotes, it's a nice suggestion

Copy link
Member

@joewiz joewiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works perfectly!

@joewiz joewiz merged commit 680ae40 into eXist-db:develop Jul 3, 2022
@joewiz
Copy link
Member

joewiz commented Jul 3, 2022

@marmoure Thank you!

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

Successfully merging this pull request may close these issues.

Add option to disable auto-pair of quotes, parens, etc.
3 participants