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

Custom rule using lookbehind becomes Invalid configuration #5511

Open
asa08 opened this issue Mar 26, 2024 · 1 comment
Open

Custom rule using lookbehind becomes Invalid configuration #5511

asa08 opened this issue Mar 26, 2024 · 1 comment
Labels

Comments

@asa08
Copy link

asa08 commented Mar 26, 2024

I want to use lookbehind in a custom rule but get Invalid configuration for 'xxx'. Falling back to default..
Is there any other way?

Example

No setClass on the line before the line containing configur.

(?<!setClass.*?\n.*?)configur

Highlighted

func setup() {
  configur()
}

Not Highlighted

func setup() {
  setClass()
  configur()
}

Thank you.

@SimplyDanny
Copy link
Collaborator

Lookbehind is allowed in principle, yet the documentation for NSRegularExpression states:

The length of possible strings matched by the look-behind pattern must not be unbounded (no * or + operators).

That's causing the regex to fail to be constructed. You need to look for an alternative expression.

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

No branches or pull requests

2 participants