@@ -124,17 +124,6 @@ function runExtension(isModal: boolean) {
124
124
elsedVersions [ nestingLevel ] = "NOT " + match [ 2 ] ;
125
125
}
126
126
}
127
-
128
- // For debugging purposes only TODO: DELETE THIS:
129
- // let lineNumber = parseInt((new Error().stack?.split('\n')[1].match(/:(\d+):\d+\)$/)?.[1]) || '') + 1;
130
- // console.log("\n-----------\nOn line " + lineNumber +
131
- // ":\ncursorPosition: " + cursorPosition.line + ", " + cursorPosition.character +
132
- // "\ntagCounter: " + tagCounter +
133
- // "\nnestingLevel: " + nestingLevel +
134
- // "\ncurrentTagStart: " + currentTagStart.line + ", " + currentTagStart.character +
135
- // "\ncurrentTagEnd: " + currentTagEnd.line + ", " + currentTagEnd.character
136
- // );
137
-
138
127
}
139
128
else if ( match [ 1 ] === "elsif" && beforeCursor ) {
140
129
currentTagSpan [ nestingLevel ] = tagSetID [ nestingLevel ] ; // The cursor may be within this tag
@@ -158,7 +147,6 @@ function runExtension(isModal: boolean) {
158
147
nestingLevel -- ; // Decrement the nesting level
159
148
}
160
149
161
-
162
150
// For each tag:
163
151
// Add the details of the current version tag to the versionTags array.
164
152
// Each element of the array is an object containing the following properties:
@@ -169,70 +157,38 @@ function runExtension(isModal: boolean) {
169
157
positionVersionTagEnd : currentTagEnd
170
158
} ) ;
171
159
172
- // For debugging purposes only TODO: DELETE THIS:
173
- // let lineNumber = parseInt((new Error().stack?.split('\n')[1].match(/:(\d+):\d+\)$/)?.[1]) || '') + 1;
174
- // console.log("\n================================\nOn line " + lineNumber +
175
- // ":\ncursorPosition: " + cursorPosition.line + ", " + cursorPosition.character +
176
- // ":\nbeforeCursor: " + beforeCursor +
177
- // "\ntagCounter: " + tagCounter +
178
- // "\nnestingLevel: " + nestingLevel +
179
- // "\ncurrentTagStart: " + currentTagStart.line + ", " + currentTagStart.character +
180
- // "\ncurrentTagEnd: " + currentTagEnd.line + ", " + currentTagEnd.character +
181
- // "\nversionTags.length: " + versionTags.length
182
- // );
160
+ } // End of the tag parsing loop
183
161
184
162
185
- // For debugging purposes only TODO: DELETE THIS:
186
- // lineNumber = parseInt((new Error().stack?.split('\n')[1].match(/:(\d+):\d+\)$/)?.[1]) || '') + 1;
187
- // //console.log("\n-----------\nOn line " + lineNumber + "\nversionTags:");
188
- // let lastTag = versionTags[versionTags.length - 1];
189
- // console.log("tagID: " + lastTag.tagID);
190
- // console.log("tagSet: " + lastTag.tagSet);
191
- // console.log("positionVersionTagStart: " + JSON.stringify(lastTag.positionVersionTagStart));
192
- // console.log("positionVersionTagEnd: " + JSON.stringify(lastTag.positionVersionTagEnd));
193
- // console.log("match[1]: " + match[1]);
194
- // console.log("versionDescription[" + (tagCounter -1) + "]: " + versionDescription[tagCounter -1]);
163
+ // Identify and highlight the version tags for the current cursor position:
164
+ highlightVersionTags ( activeEditor , currentTagSpan ) ;
195
165
196
- } // End of the tag parsing loop
166
+ // Prepare and display the message with versioning information:
167
+ displayVersionMessage ( isModal , cursorPosition , versionDescription ) ;
197
168
169
+ } // End of runExtension() function
198
170
199
171
200
- // Prepare and display the popup message with versioning information
201
- // let message = "";
202
- // versionArray = versionArray.map(tag => tag.trim()); // Remove leading and trailing spaces
203
- // if (versionArray.length === 0) {
204
- // message = "There is no inline versioning " + positionString + ".";
205
- // }
206
- // else {
207
- // message = "The inline versioning " + positionString + " is:\n\n" + versionArray.join("\nAND ");
208
- // }
209
172
210
- // if (isModal) {
211
- // vscode.window.showInformationMessage(
212
- // message,
213
- // { modal: true } // Make the popup modal rather than a "toast" notification
214
- // );
215
- // } else {
216
- // vscode.window.showInformationMessage(
217
- // message,
218
- // "OK" // Show a "toast" notification with an "OK" button
219
- // );
220
- // }
173
+ // --------------------------------
174
+ // highlightVersionTags() function
175
+ // --------------------------------
176
+ function highlightVersionTags ( activeEditor : vscode . TextEditor | undefined , currentTagSpan : number [ ] ) {
221
177
222
178
223
- // Identify and highlight the version tags for the current cursor position:
224
- //ORIGINALLY:
225
- //highlightVersionTags(activeEditor, versionTags, currentIfVersionId, level);
179
+ // Create an array to hold the ranges of text to be highlighted
180
+ const ranges : vscode . Range [ ] = [ ] ;
226
181
227
- // Prepare and display the popup message with versioning information
228
- //ORIGINALLY:
229
- //displayVersionMessage(isModal, versionArray, positionString);
182
+ for ( let elementNumber = currentTagSpan . length - 1 ; elementNumber >= 0 ; elementNumber -- ) {
230
183
184
+ // For debugging purposes only TODO: DELETE THIS:
185
+ let lineNumber = parseInt ( ( new Error ( ) . stack ?. split ( '\n' ) [ 1 ] . match ( / : ( \d + ) : \d + \) $ / ) ?. [ 1 ] ) || '' ) + 1 ;
186
+ console . log ( `\n-----------\nOn line ${ lineNumber } :\n currentTagSpan[${ elementNumber } ]: ${ currentTagSpan [ elementNumber ] } ` ) ;
231
187
232
- // Note we add 1 to nestingLevel because
233
- displayVersionMessage ( isModal , cursorPosition , versionDescription ) ;
188
+ }
234
189
235
- } // End of runExtension() function
190
+
191
+ }
236
192
237
193
238
194
0 commit comments