@@ -61,9 +61,7 @@ function runExtension(isModal: boolean) {
61
61
// Get the entire text of the active editor
62
62
const text = activeEditor . document . getText ( ) ;
63
63
64
- const cursorPosition = activeEditor . selection . active ;
65
- const positionString = " at the cursor position (line " + ( cursorPosition . line + 1 ) +
66
- ", character " + ( cursorPosition . character + 1 ) + ") " ;
64
+ const cursorPosition : vscode . Position = activeEditor . selection . active ;
67
65
68
66
// Define the arrays we're going to iteratively populate in the parsing loop:
69
67
let versionTags : VersionTag [ ] = [ ] ;
@@ -222,17 +220,17 @@ function runExtension(isModal: boolean) {
222
220
// }
223
221
224
222
225
- console . log ( "\n~~~~~~~~~~~~\nnestingLevel: " + nestingLevel + "\nelseVersions: " + elsedVersions ) ;
226
-
227
-
228
223
// Identify and highlight the version tags for the current cursor position:
229
224
//ORIGINALLY:
230
225
//highlightVersionTags(activeEditor, versionTags, currentIfVersionId, level);
231
226
232
227
// Prepare and display the popup message with versioning information
233
228
//ORIGINALLY:
234
229
//displayVersionMessage(isModal, versionArray, positionString);
235
- displayVersionMessage ( isModal , versionDescription , elsedVersions [ nestingLevel + 1 ] ) ;
230
+
231
+
232
+ // Note we add 1 to nestingLevel because
233
+ displayVersionMessage ( isModal , cursorPosition , versionDescription ) ;
236
234
237
235
} // End of runExtension() function
238
236
@@ -241,25 +239,21 @@ function runExtension(isModal: boolean) {
241
239
// --------------------------------
242
240
// displayVersionMessage() function
243
241
// --------------------------------
244
- function displayVersionMessage ( isModal : Boolean , versionDescription : string [ ] , tempElsedVersionsString : string = "" ) {
245
-
246
- // Create an array to hold the ranges of text to be highlighted
247
- //const ranges: vscode.Range[] = [];
242
+ function displayVersionMessage ( isModal : Boolean , cursorPosition : vscode . Position , versionDescription : string [ ] ) {
248
243
249
- // TODO: REMOVE THIS DEBUGGING CODE:
244
+ // Note: we add +1 to the line and character numbers because they are zero-based:
245
+ const positionString = ` at the cursor position (line ${ ( cursorPosition . line + 1 ) } , character ${ ( cursorPosition . character + 1 ) } ) ` ;
250
246
let message = "" ;
251
- for ( let description of versionDescription ) {
252
- message += description + "\n" ;
253
- }
254
247
255
-
256
- // For debugging purposes only TODO: DELETE THIS:
257
- let lineNumber = parseInt ( ( new Error ( ) . stack ?. split ( '\n' ) [ 1 ] . match ( / : ( \d + ) : \d + \) $ / ) ?. [ 1 ] ) || '' ) + 1 ;
258
- console . log ( "\n-----------\nOn line " + lineNumber + ":" +
259
- "\nThis is where I am now." +
260
- "\ntempElsedVersionsString: \n" + tempElsedVersionsString +
261
- "\n\nversionDescription: \n============\n" + message + "============"
262
- ) ;
248
+ if ( versionDescription . length === 0 ) {
249
+ message = "There is no inline versioning " + positionString + "." ;
250
+ }
251
+ else {
252
+ message = "The inline versioning " + positionString + " is:\n\n" ;
253
+ for ( let description of versionDescription ) {
254
+ message += description + "\n" ;
255
+ }
256
+ }
263
257
264
258
if ( isModal ) {
265
259
vscode . window . showInformationMessage (
0 commit comments