1- import * as vscode from " vscode" ;
2- import PositionObject from " ../positionObject" ;
3- import getHoverInformation from " ../hover" ;
1+ import * as vscode from ' vscode' ;
2+ import PositionObject from ' ../positionObject' ;
3+ import getHoverInformation from ' ../hover' ;
44
55export default async function findStackPositions (
66 document
77) : Promise < PositionObject [ ] > {
88 const documentContent = document . getText ( ) ;
9- const lines = documentContent . split ( "\n" ) ;
9+ const lines = documentContent . split ( '\n' ) ;
1010
1111 let positions = [ ] ; // Array to store positions
1212
1313 for ( let i = 0 ; i < lines . length ; i ++ ) {
14- let stackIndex = lines [ i ] . indexOf ( " stack(" ) ;
14+ let stackIndex = lines [ i ] . indexOf ( ' stack(' ) ;
1515 while ( stackIndex >= 0 ) {
1616 const position = new vscode . Position ( i , stackIndex ) ;
1717 const typeInfo = await getHoverInformation ( position ) ;
@@ -20,7 +20,7 @@ export default async function findStackPositions(
2020 stackPosition : position ,
2121 } ;
2222
23- console . log ( " stackPosition added:" , positionObject . stackPosition ) ;
23+ console . log ( ' stackPosition added:' , positionObject . stackPosition ) ;
2424
2525 // Function to find the next occurrence of a keyword after a given index
2626 function findNextKeyword ( keyword , startIndex , currentLine ) {
@@ -34,36 +34,36 @@ export default async function findStackPositions(
3434 return null ;
3535 }
3636
37- // Find the position of 'input :'
38- let inputPosition = findNextKeyword ( "input" , i , stackIndex ) ;
37+ // Find the position of 'in :'
38+ let inputPosition = findNextKeyword ( 'in' , i , stackIndex ) ;
3939 if ( inputPosition ) {
40- positionObject [ " inputPosition" ] = inputPosition ;
41- console . log ( " inputPosition added:" , positionObject . inputPosition ) ;
40+ positionObject [ ' inputPosition' ] = inputPosition ;
41+ console . log ( ' inputPosition added:' , positionObject . inputPosition ) ;
4242 }
4343
44- // Find the position of 'outExample :'
45- let outExamplePosition = findNextKeyword (
46- "outExample:" ,
44+ // Find the position of 'out :'
45+ let outPosition = findNextKeyword (
46+ 'out:' ,
4747 i ,
4848 stackIndex
4949 ) ;
50- if ( outExamplePosition ) {
51- positionObject [ "outExamplePosition" ] = outExamplePosition ;
50+ if ( outPosition ) {
51+ positionObject [ 'outPosition' ] = outPosition ;
5252 console . log (
53- "outExamplePosition added:" ,
54- positionObject . outExamplePosition
53+ 'outPosition added:' ,
54+ positionObject . outPosition
5555 ) ;
5656 }
5757
5858 positions . push ( positionObject ) ;
59- console . log ( " Position object added:" , positionObject ) ;
59+ console . log ( ' Position object added:' , positionObject ) ;
6060 }
6161
6262 // Find next occurrence of 'stack(' in the same line
63- stackIndex = lines [ i ] . indexOf ( " stack(" , stackIndex + 1 ) ;
63+ stackIndex = lines [ i ] . indexOf ( ' stack(' , stackIndex + 1 ) ;
6464 }
6565 }
6666
67- console . log ( " Final positions array:" , positions ) ;
67+ console . log ( ' Final positions array:' , positions ) ;
6868 return positions ; // Return array of positions
6969}
0 commit comments