File tree Expand file tree Collapse file tree 6 files changed +22
-11
lines changed
Expand file tree Collapse file tree 6 files changed +22
-11
lines changed Original file line number Diff line number Diff line change 11# Change Log
22
3- All notable changes to the " laravel-goto-components" extension will be documented in this file.
3+ ## [ v1.1.0 ] ( https://github.com/naoray/ laravel-factory-prefill/tree/v1.0.0 ) (2020-12-10)
44
5- Check [ Keep a Changelog] ( http://keepachangelog.com/ ) for recommendations on how to structure this file.
5+ ** Added**
6+ - quick navigation for nested components like ` x-input.button `
67
7- ## [ Unreleased ]
8+ ## [ v1.0.0 ] ( https://github.com/naoray/laravel-factory-prefill/tree/v1.0.0 ) (2020-12-09)
89
9- - Initial release
10+ ** Added**
11+ - ` CTRL ` + ` click ` to navigate ` x-components ` in the ` components ` directory
12+ - display existing components in ` blade.php ` files as links
Original file line number Diff line number Diff line change 33 "displayName" : " laravel-goto-components" ,
44 "description" : " Quick jump to components" ,
55 "icon" : " icon.png" ,
6- "version" : " 1.0.2 " ,
6+ "version" : " 1.1.0 " ,
77 "publisher" : " naoray" ,
88 "repository" : " https://github.com/naoray/laravel-goto-components.git" ,
99 "engines" : {
2727 "properties" : {
2828 "laravel_goto_components.regex" : {
2929 "type" : " string" ,
30- "default" : " (?<=<x-)(?!slot)[a-z-]+" ,
30+ "default" : " (?<=<x-)(?!slot)[a-z. -]+" ,
3131 "description" : " Custom regex for matching strings"
3232 }
3333 }
Original file line number Diff line number Diff line change 99 workspace ,
1010 ProviderResult ,
1111} from "vscode" ;
12+ import { nameToPath } from "./utils" ;
1213
1314export default class HoverProvider implements BaseHoverProvider {
1415 public provideHover (
@@ -24,7 +25,7 @@ export default class HoverProvider implements BaseHoverProvider {
2425 }
2526
2627 const componentName = doc . getText ( range ) ;
27- const componentPath = `/resources/views/components/ ${ componentName } .blade.php` ;
28+ const componentPath = nameToPath ( componentName ) ;
2829 const workspacePath = workspace . getWorkspaceFolder ( doc . uri ) ?. uri . fsPath ;
2930
3031 if ( ! existsSync ( workspacePath + componentPath ) ) {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 DocumentLink ,
1212 Range ,
1313} from "vscode" ;
14+ import { nameToPath } from "./utils" ;
1415
1516export default class LinkProvider implements DocumentLinkProvider {
1617 public provideDocumentLinks (
@@ -30,12 +31,15 @@ export default class LinkProvider implements DocumentLinkProvider {
3031 let result = line . text . match ( reg ) ;
3132
3233 if ( result !== null ) {
33- for ( let item of result ) {
34- const componentPath = `/resources/views/components/ ${ item } .blade.php` ;
34+ for ( let componentName of result ) {
35+ const componentPath = nameToPath ( componentName ) ;
3536
3637 if ( existsSync ( workspacePath + componentPath ) ) {
37- let start = new Position ( line . lineNumber , line . text . indexOf ( item ) ) ;
38- let end = start . translate ( 0 , item . length ) ;
38+ let start = new Position (
39+ line . lineNumber ,
40+ line . text . indexOf ( componentName )
41+ ) ;
42+ let end = start . translate ( 0 , componentName . length ) ;
3943 let documentlink = new DocumentLink (
4044 new Range ( start , end ) ,
4145 Uri . file ( workspacePath + componentPath )
Original file line number Diff line number Diff line change 1+ export function nameToPath ( path : string ) : string {
2+ return `/resources/views/components/${ path . replace ( / \. / g, "/" ) } .blade.php` ;
3+ }
You can’t perform that action at this time.
0 commit comments