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

Don't respect Lisp comments on forwardSexp and backwardSexp when we are editing non-Lisp documents #80

Closed
ganaware opened this Issue Feb 21, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@ganaware
Copy link
Contributor

ganaware commented Feb 21, 2019

The current implementations of forwardSexp and backwardSexp seem to be always respecting Lisp comments: ';'.

For example, C# code is here:

bool Foo { get { return bar != default(Baz); } }

When a forwardSexp is executed on the second '{', it should move the cursor to the next to the first '}'.
But it moves the cursor to the end of the document.
This is beacuse it respects the lisp comment ';' before the first '}'.

So, please don't respect Lisp comments when we are editing non-Lisp documents.

@tuttieee

This comment has been minimized.

Copy link
Owner

tuttieee commented Feb 21, 2019

Now that behavior derived from paredit.js' code: https://github.com/rksm/paredit.js/blob/07f39ce097004beb49386ec7b41839a87af165b5/lib/reader.js#L58 in which the handling comments(";") is hardcoded.

To modify it,

  1. fork paredit.js and fix it to be able to ignore comments
  2. implement the original sexp parser

For now, I'm going to choose 1.

@tuttieee

This comment has been minimized.

Copy link
Owner

tuttieee commented Feb 26, 2019

Another simple solution: to replace ";" with anther character

@ganaware

This comment has been minimized.

Copy link
Contributor Author

ganaware commented Feb 27, 2019

Thank you but this problem is not fixed.

For example, C# code is here:

bool Foo { get { return (foo); } }
bool Bar { get { return (bar); } }
bool Baz { get { return (baz); } }
  • OK: When forwardSexp-ing on just after "Foo", the cursor moves to the end of the 1st line.
  • NG: When forwardSexp-ing on just after "Bar", the cursor moves to the end of the document.
  • NG: When forwardSexp-ing on just after "Baz", the cursor moves to the end of the document.

Hmm... only the first ';' is ignored?

@tuttieee tuttieee reopened this Feb 27, 2019

@tuttieee

This comment has been minimized.

Copy link
Owner

tuttieee commented Feb 28, 2019

Sorry, I found a bug and will fix it.

@ganaware

This comment has been minimized.

Copy link
Contributor Author

ganaware commented Feb 28, 2019

It works good. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.