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

Fix “E54: Unmatched (” when jumping to related from a .sql file #580

Merged
merged 1 commit into from
Aug 21, 2021
Merged

Fix “E54: Unmatched (” when jumping to related from a .sql file #580

merged 1 commit into from
Aug 21, 2021

Conversation

jasoncodes
Copy link
Contributor

This PR fixes the following error when invoking :R from a .sql file:

Error detected while processing function <SNR>143_Related[1]..<SNR>143_AR[54]..<SNR>143_readable_alternate[1]..<SNR>143_readable_alternate_candidates[2]..<SNR>143_readable_placeholders[5]..<SNR>143_readable_last_method:
line    7:
E54: Unmatched (

The problem is the s:sql_define pattern sets \v (very magic mode) which is then embedded into a matchstr pattern inside s:readable_last_method which does not expect the magic mode to the changed from the default.

I saw two options for solving this:

  1. update the s:sql_define pattern to reset back to magic mode (\m), or
  2. update s:readable_last_method to reset back to magic mode (\m) after embedding self.define_pattern()

The second option seemed to be more robust against other pattern inputs and I did not see s:sql_define being used as a part of other patterns elsewhere.

When the current buffer is an SQL file, `define_pattern()` will
be `s:sql_define`, which uses "very magic" mode.
@tpope tpope merged commit 03a5c3e into tpope:master Aug 21, 2021
@tpope
Copy link
Owner

tpope commented Aug 21, 2021

Wow, how long has this bug been hiding? If I was writing it today I would probably avoid \v entirely, but this is more than good enough.

@jasoncodes
Copy link
Contributor Author

I discovered this when updating an older install and bisected it down to 37aa670. So, only 3 years or so. :)

Good to know you’d probably avoid \v today. I might have gone for a rewrite if it were the only \v I spotted in the code but decided for a minimal change instead.

@jasoncodes jasoncodes deleted the reset-sql-pattern-magic branch August 21, 2021 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants