File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed
Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 22 "name" : " laravel-goto-view" ,
33 "displayName" : " Laravel goto view" ,
44 "description" : " Quick jump to view" ,
5- "version" : " 1.1.2 " ,
5+ "version" : " 1.1.3 " ,
66 "publisher" : " codingyu" ,
77 "engines" : {
88 "vscode" : " ^1.15.0"
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ export function activate(context: ExtensionContext) {
1111 provideHover ( document , position , token ) {
1212 let linkRange = document . getWordRangeAtPosition ( position , REG ) ;
1313 if ( linkRange ) {
14- let filePath = util . getFilePath ( document . getText ( linkRange ) ) ;
14+ let filePath = util . getFilePath ( document . getText ( linkRange ) , document ) ;
15+ let workspaceFolder = workspace . getWorkspaceFolder ( document . uri ) ;
1516 if ( filePath != null ) {
16- return new Hover ( filePath . replace ( workspace . rootPath + '/' , '' ) ) ;
17+ return new Hover ( workspaceFolder . name + filePath . replace ( workspaceFolder . uri . fsPath , '' ) ) ;
1718 }
1819 }
1920 return ;
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ export class LinkProvider implements DocumentLinkProvider {
1313 let result = line . text . match ( reg ) ;
1414 if ( result != null ) {
1515 for ( let item of result ) {
16- let filePath = util . getFilePath ( item ) ;
16+ let filePath = util . getFilePath ( item , document ) ;
1717 if ( filePath != null ) {
18- let start = new Position ( line . lineNumber , line . text . indexOf ( item ) ) ;
19- let end = start . translate ( 0 , item . length ) ;
18+ let start = new Position ( line . lineNumber , line . text . indexOf ( item ) + 1 ) ;
19+ let end = start . translate ( 0 , item . length - 2 ) ;
2020 let documentlink = new DocumentLink ( new Range ( start , end ) , Uri . file ( filePath ) ) ;
2121 documentLinks . push ( documentlink ) ;
2222 } ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- import { workspace } from 'vscode' ;
3+ import { workspace , TextDocument } from 'vscode' ;
44import * as fs from "fs" ;
55
6- export function getFilePath ( text :string ) {
7- let filePath = workspace . rootPath + "/resources/views/" + text . replace ( / \. / g, '/' ) . replace ( / \" | \' / g, '' ) + ".blade.php" ;
6+ export function getFilePath ( text :string , document : TextDocument ) {
7+ let filePath = workspace . getWorkspaceFolder ( document . uri ) . uri . fsPath + "/resources/views/" + text . replace ( / \. / g, '/' ) . replace ( / \" | \' / g, '' ) + ".blade.php" ;
88 if ( fs . existsSync ( filePath ) ) {
99 return filePath ;
1010 } else {
You can’t perform that action at this time.
0 commit comments