Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 77 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"publisher": "jripouteau",
"name": "adonis-vscode-extension",
"displayName": "AdonisJS Extension",
"version": "1.3.0",
"version": "1.3.1",
"description": "The official VSCode extension of AdonisJS",
"author": "Julien Ripouteau <[email protected]>",
"license": "MIT",
Expand Down
9 changes: 6 additions & 3 deletions src/linkers/inertia_linker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ export class InertiaLinker {

// we have to lookup the line with the render( prefix because there could be multiple appearances of the same file name
// e.g. if you declare a route with the path /about and have your page called about.vue etc., it would highlight the wrong line
const line = lines.findIndex(
(line) => line.includes('render(') && line.includes(options.match[1]!)
)
const line = lines.findIndex((line) => {
return (
(line.includes('render(') || lines.includes('renderInertia(')) &&
line.includes(options.match[1]!)
)
})
const colStart = lines[line]!.indexOf(options.match[1]!)
const colEnd = colStart + options.match[1]!.length

Expand Down
7 changes: 5 additions & 2 deletions src/utilities/regexes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/**
* Used by inertia linker and suggester
*/
export const inertiaRegex = new RegExp(/inertia\.render\(["'](.*?)["']/, 'g')
export const inertiaCompletionRegex = new RegExp(/(?<=inertia\.render\()(["'])[^"']*\1/, 'g')
export const inertiaRegex = new RegExp(/(?:inertia\.render|renderInertia)\(["'](.*?)["']/, 'g')
export const inertiaCompletionRegex = new RegExp(
/(?<=(?:inertia\.render|renderInertia)\()(["'])[^"']*\1/,
'g'
)

/**
* Used by controller suggester
Expand Down