Skip to content

Commit 6ed4bca

Browse files
committed
🤷
1 parent 73b0d8e commit 6ed4bca

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

‎package.json‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,17 @@
3939
"laravel_goto_view.folder": {
4040
"type": "array",
4141
"default": [
42-
"/resources/views"
42+
{
43+
"name": "default",
44+
"path":"/resources/views"
45+
}
4346
],
4447
"items": {
45-
"type": "string"
48+
"type": "object",
49+
"required": [
50+
"name",
51+
"path"
52+
]
4653
},
4754
"minItems": 1,
4855
"uniqueItems": true,

‎src/extension.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export function activate(context: ExtensionContext) {
1717
if(filePaths.length > 0){
1818
let text:string = "";
1919
for (let i in filePaths) {
20-
text += i == '0' ? `- \`Default\`` : `- \`Other\``;
21-
text += ` [${workspaceFolder.name + filePaths[i].showPath}](${filePaths[i].fileUri})\n`;
20+
text += `\`${filePaths[i].name}\` [${workspaceFolder.name + filePaths[i].showPath}](${filePaths[i].fileUri}) \r`;
2221
}
2322
return new Hover(new MarkdownString(text));
2423
}

‎src/util.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as fs from "fs";
55

66
export function getFilePath(text:string, document:TextDocument) {
77
let config = workspace.getConfiguration('laravel_goto_view');
8-
let filePath = workspace.getWorkspaceFolder(document.uri).uri.fsPath + config.folder[0] + "/" + text.replace(/\./g,'/').replace(/\"|\'/g,'') + ".blade.php";
8+
let filePath = workspace.getWorkspaceFolder(document.uri).uri.fsPath + config.folder[0].path + "/" + text.replace(/\./g,'/').replace(/\"|\'/g,'') + ".blade.php";
99
if(fs.existsSync(filePath)){
1010
return filePath;
1111
}else{
@@ -17,10 +17,14 @@ export function getFilePaths(text:string, document:TextDocument): any {
1717
let config = workspace.getConfiguration('laravel_goto_view');
1818
let result = [];
1919
for (let item of config.folder) {
20-
let showPath = item + "/" + text.replace(/\./g,'/').replace(/\"|\'/g,'') + ".blade.php";
20+
let showPath = item.path + "/" + text.replace(/\./g,'/').replace(/\"|\'/g,'') + ".blade.php";
2121
let filePath = workspace.getWorkspaceFolder(document.uri).uri.fsPath + showPath;
2222
if(fs.existsSync(filePath)){
23-
result.push({"showPath": showPath, "fileUri": Uri.file(filePath)});
23+
result.push({
24+
"name": item.name,
25+
"showPath": showPath,
26+
"fileUri": Uri.file(filePath)
27+
});
2428
}
2529
}
2630
return result;

0 commit comments

Comments
 (0)