@@ -9,19 +9,19 @@ import { JSONDocument } from '../parser/jsonParser';
99
1010export function findDefinition ( document : TextDocument , position : Position , doc : JSONDocument ) : Thenable < DefinitionLink [ ] > {
1111 const offset = document . offsetAt ( position ) ;
12- let node = doc . getNodeFromOffset ( offset , true ) ;
12+ const node = doc . getNodeFromOffset ( offset , true ) ;
1313 if ( ! node || ! isRef ( node ) ) {
1414 return Promise . resolve ( [ ] ) ;
1515 }
1616
17- let propertyNode : PropertyASTNode = node . parent as PropertyASTNode ;
18- let valueNode = propertyNode . valueNode as ASTNode ;
19- let path = valueNode . value as string ;
20- let targetNode = findTargetNode ( doc , path ) ;
17+ const propertyNode : PropertyASTNode = node . parent as PropertyASTNode ;
18+ const valueNode = propertyNode . valueNode as ASTNode ;
19+ const path = valueNode . value as string ;
20+ const targetNode = findTargetNode ( doc , path ) ;
2121 if ( ! targetNode ) {
2222 return Promise . resolve ( [ ] ) ;
2323 }
24- let definition : DefinitionLink = {
24+ const definition : DefinitionLink = {
2525 targetUri : document . uri ,
2626 originSelectionRange : createRange ( document , valueNode ) ,
2727 targetRange : createRange ( document , targetNode ) ,
@@ -44,7 +44,7 @@ function isRef(node: ASTNode): boolean {
4444}
4545
4646function findTargetNode ( doc : JSONDocument , path : string ) : ASTNode | null {
47- let tokens = parseJSONPointer ( path ) ;
47+ const tokens = parseJSONPointer ( path ) ;
4848 if ( ! tokens ) {
4949 return null ;
5050 }
@@ -61,15 +61,15 @@ function findNode(pointer: string[], node: ASTNode | null | undefined): ASTNode
6161
6262 const token : string = pointer . shift ( ) as string ;
6363 if ( node && node . type === 'object' ) {
64- let propertyNode : PropertyASTNode | undefined = node . properties . find ( ( propertyNode ) => propertyNode . keyNode . value === token ) ;
64+ const propertyNode : PropertyASTNode | undefined = node . properties . find ( ( propertyNode ) => propertyNode . keyNode . value === token ) ;
6565 if ( ! propertyNode ) {
6666 return null ;
6767 }
6868 return findNode ( pointer , propertyNode . valueNode ) ;
6969 } else if ( node && node . type === 'array' ) {
7070 if ( token . match ( / ^ ( 0 | [ 1 - 9 ] [ 0 - 9 ] * ) $ / ) ) {
7171 const index = Number . parseInt ( token ) ;
72- let arrayItem = node . items [ index ] ;
72+ const arrayItem = node . items [ index ] ;
7373 if ( ! arrayItem ) {
7474 return null ;
7575 }
0 commit comments