1- 'use strict' ;
2-
3- import { workspace , languages , Hover , ExtensionContext , MarkdownString , Uri } from 'vscode' ;
4- import { LinkProvider } from './link' ;
5- import * as util from './util' ;
6-
7- const REG = / ( [ ' " ] ) [ ^ ' " ] * \1/ ;
8-
9- export function activate ( context : ExtensionContext ) {
10- let config = workspace . getConfiguration ( 'laravel_goto_view' ) ;
11- let hover = languages . registerHoverProvider ( [ 'php' , 'blade' , 'laravel-blade' ] , {
12- provideHover ( document , position , token ) {
13- let linkRange = document . getWordRangeAtPosition ( position , REG ) ;
14- if ( linkRange ) {
15- let filePaths = util . getFilePaths ( document . getText ( linkRange ) , document ) ;
16- let workspaceFolder = workspace . getWorkspaceFolder ( document . uri ) ;
17- if ( filePaths . length > 0 ) {
18- let text :string = "" ;
19- for ( let i in filePaths ) {
20- text += `\`${ filePaths [ i ] . name } \` [${ workspaceFolder . name + filePaths [ i ] . showPath } ](${ filePaths [ i ] . fileUri } ) \r` ;
21- }
22- return new Hover ( new MarkdownString ( text ) ) ;
23- }
24- }
25- return ;
26- }
27- } ) ;
28- context . subscriptions . push ( hover ) ;
29-
30- if ( config . quick_click ) {
31- let link = languages . registerDocumentLinkProvider ( [ 'php' , 'blade' , 'laravel-blade' ] , new LinkProvider ( ) ) ;
32- context . subscriptions . push ( link ) ;
33- }
34- }
35-
36- export function deactivate ( ) {
37- //
1+ 'use strict' ;
2+
3+ import { workspace , languages , Hover , ExtensionContext , MarkdownString , Uri } from 'vscode' ;
4+ import { LinkProvider } from './link' ;
5+ import * as util from './util' ;
6+
7+ const REG = / ( [ ' " ] ) [ ^ ' " ] * \1/ ;
8+
9+ export function activate ( context : ExtensionContext ) {
10+ let config = workspace . getConfiguration ( 'laravel_goto_view' ) ;
11+ let hover = languages . registerHoverProvider ( [ 'php' , 'blade' , 'laravel-blade' ] , {
12+ provideHover ( document , position , token ) {
13+ let linkRange = document . getWordRangeAtPosition ( position , REG ) ;
14+ if ( linkRange ) {
15+ let filePaths = util . getFilePaths ( document . getText ( linkRange ) , document ) ;
16+ let workspaceFolder = workspace . getWorkspaceFolder ( document . uri ) ;
17+ if ( filePaths . length > 0 ) {
18+ let text :string = "" ;
19+ for ( let i in filePaths ) {
20+ text += `\`${ filePaths [ i ] . name } \` [${ workspaceFolder . name + filePaths [ i ] . showPath } ](${ filePaths [ i ] . fileUri } ) \r` ;
21+ }
22+ return new Hover ( new MarkdownString ( text ) ) ;
23+ }
24+ }
25+ return ;
26+ }
27+ } ) ;
28+ context . subscriptions . push ( hover ) ;
29+
30+ if ( config . quick_click ) {
31+ let link = languages . registerDocumentLinkProvider ( [ 'php' , 'blade' , 'laravel-blade' ] , new LinkProvider ( ) ) ;
32+ context . subscriptions . push ( link ) ;
33+ }
34+ }
35+
36+ export function deactivate ( ) {
37+ //
3838}
0 commit comments