Skip to content

Commit

Permalink
fix: broken hyperlinks when using function calls to pass props (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhedger committed Jan 21, 2023
1 parent e0e7d51 commit e2d9923
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/providers/inertiaComponentLink.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ export class InertiaComponentLinkProvider implements DocumentLinkProvider {
): ProviderResult<DocumentLink[]> {
// https://regex101.com/r/YiSfGR/2
const helperRegex = new RegExp(
'^(?!Route::)inertia\\(\\s*([\'"])(?<component>.+)(\\1)\\s*(?:,[\\s\\S]*?)?\\)',
'^(?!Route::)inertia\\(\\s*([\'"])(?<component>(?:(?!\\1).)*)(\\1)\\s*(?:,[\\s\\S]*?)?\\);',
'gmd'
);

// https://regex101.com/r/3eqwp0/2
// https://regex101.com/r/FheqGS/1
const renderRegex = new RegExp(
'\\bInertia::render\\(\\s*([\'"])(?<component>.+)(\\1)\\s*(?:,[\\s\\S]*?)?\\)',
'\\bInertia::render\\(\\s*([\'"])(?<component>(?:(?!\\1).)*)(\\1)\\s*(?:,[\\s\\S]*?)?\\);',
'gmd'
);

// https://regex101.com/r/3tjDRd/2
// https://regex101.com/r/3tjDRd/3
const routesRegex = new RegExp(
'\\bRoute::inertia\\(\\s*(["\']).+\\1\\s*,\\s*(["\'])(?<component>.+)\\2\\s*(?:,[\\s\\S]*?)?\\)',
'\\bRoute::inertia\\(\\s*(["\']).+\\1\\s*,\\s*(["\'])(?<component>(?:(?!\\2).)*)\\2\\s*(?:,[\\s\\S]*?)?\\);',
'gmd'
);

Expand Down

0 comments on commit e2d9923

Please sign in to comment.