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 2
2
"name" : " laravel-goto-view" ,
3
3
"displayName" : " Laravel goto view" ,
4
4
"description" : " Quick jump to view" ,
5
- "version" : " 1.1.2 " ,
5
+ "version" : " 1.1.3 " ,
6
6
"publisher" : " codingyu" ,
7
7
"engines" : {
8
8
"vscode" : " ^1.15.0"
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ export function activate(context: ExtensionContext) {
11
11
provideHover ( document , position , token ) {
12
12
let linkRange = document . getWordRangeAtPosition ( position , REG ) ;
13
13
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 ) ;
15
16
if ( filePath != null ) {
16
- return new Hover ( filePath . replace ( workspace . rootPath + '/' , '' ) ) ;
17
+ return new Hover ( workspaceFolder . name + filePath . replace ( workspaceFolder . uri . fsPath , '' ) ) ;
17
18
}
18
19
}
19
20
return ;
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ export class LinkProvider implements DocumentLinkProvider {
13
13
let result = line . text . match ( reg ) ;
14
14
if ( result != null ) {
15
15
for ( let item of result ) {
16
- let filePath = util . getFilePath ( item ) ;
16
+ let filePath = util . getFilePath ( item , document ) ;
17
17
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 ) ;
20
20
let documentlink = new DocumentLink ( new Range ( start , end ) , Uri . file ( filePath ) ) ;
21
21
documentLinks . push ( documentlink ) ;
22
22
} ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- import { workspace } from 'vscode' ;
3
+ import { workspace , TextDocument } from 'vscode' ;
4
4
import * as fs from "fs" ;
5
5
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" ;
8
8
if ( fs . existsSync ( filePath ) ) {
9
9
return filePath ;
10
10
} else {
You can’t perform that action at this time.
0 commit comments