Skip to content

Commit bfe9e33

Browse files
committed
Get the message display working
1 parent e8259ae commit bfe9e33

File tree

6 files changed

+185
-37
lines changed

6 files changed

+185
-37
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# .gitignore
2+
3+
# Node modules
4+
node_modules/
5+
6+
# Build files
7+
dist/
8+
9+
# Environment variables
10+
.env
11+
12+
# Editor files
13+
.vscode/
14+
*.log
15+
16+
# macOS files
17+
.DS_Store

dist/extension.js

Lines changed: 11 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/extension.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/extension.ts

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ function runExtension(isModal: boolean) {
6161
// Get the entire text of the active editor
6262
const text = activeEditor.document.getText();
6363

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;
6765

6866
// Define the arrays we're going to iteratively populate in the parsing loop:
6967
let versionTags: VersionTag[] = [];
@@ -222,17 +220,17 @@ function runExtension(isModal: boolean) {
222220
// }
223221

224222

225-
console.log("\n~~~~~~~~~~~~\nnestingLevel: " + nestingLevel + "\nelseVersions: " + elsedVersions);
226-
227-
228223
// Identify and highlight the version tags for the current cursor position:
229224
//ORIGINALLY:
230225
//highlightVersionTags(activeEditor, versionTags, currentIfVersionId, level);
231226

232227
// Prepare and display the popup message with versioning information
233228
//ORIGINALLY:
234229
//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);
236234

237235
} // End of runExtension() function
238236

@@ -241,25 +239,21 @@ function runExtension(isModal: boolean) {
241239
// --------------------------------
242240
// displayVersionMessage() function
243241
// --------------------------------
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[]) {
248243

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)} ) `;
250246
let message = "";
251-
for (let description of versionDescription) {
252-
message += description + "\n";
253-
}
254247

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+
}
263257

264258
if (isModal) {
265259
vscode.window.showInformationMessage(

0 commit comments

Comments
 (0)