Skip to content

Commit

Permalink
Merge pull request #35 from absszero/fix-App-namespace
Browse files Browse the repository at this point in the history
Fix app namespace
  • Loading branch information
absszero authored Mar 12, 2024
2 parents 86d64e6 + 3ecba2f commit 8b78da5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 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 @@
"name": "vscode-laravel-goto",
"displayName": "Laravel Goto",
"description": "Go to various Laravel files",
"version": "4.28.3",
"version": "4.28.4",
"publisher": "absszero",
"license": "MIT",
"icon": "icon.png",
Expand Down
8 changes: 8 additions & 0 deletions src/Finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ export class Finder {
place.path = this.path + '.php';
}

if (place.path.startsWith('\\')) {
place.path = place.path.substring(1);
}

if (place.path.startsWith('App\\')) {
place.path = 'a' + place.path.substring(1);
}

return place;
}

Expand Down
5 changes: 4 additions & 1 deletion src/test/suite/Finder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ suite('Finder Test Suite', () => {

test('namespace file', async () => {
await replace(editor, '"App\\Use|r"');
await assertPath("App\\User.php");
await assertPath("app\\User.php");

await replace(editor, '"\\App\\Use|r"');
await assertPath("app\\User.php");
});

test('closing tag Component', async () => {
Expand Down

0 comments on commit 8b78da5

Please sign in to comment.