Skip to content

Full regex support in lookaheads (or at least \n and \s) #134

@nianiam

Description

@nianiam

Sometimes, for the sake of formatting my code to look nice, I like to add a new line immediately after the template literal tick. For example:

const test = await client.query(`
  select * from test
`)

Obviously this simple example does not need the new line (or I could have escaped before the tick), but larger queries often do to maintain alignment. No matter what I try, I cannot get the lookahead to match the whitespace because \s results in a JSCustom error "invalid escape character" .

I have tried "[\n\t ]*select" which will happily match spaces and tabs, but not the new line.

Also, your example in the config settings select\b does not match a template string select 1 from dual.

I find it strange that some regex works, but others don't. Personally, whitespace matching would solve my problem, but it seems sensible to parse all valid regex.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions