You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Look up the tag span ID (`currentTagSpan[elementNumber]`) in the `versionTags` array.
195
-
- Get the tag set ID from the `tagSet` property and assign it to `currentTagSetID`.
195
+
- Get the tag set ID from the `tagSet` property of the element we find in the `versionTags` array, and assign it to `currentTagSetID`.
196
196
- Find all the tags in the `versionTags` array that have the same tag set ID, and for each of these:
197
197
- Get the start and end positions of the tag.
198
198
- Add the start and end positions to an array of text ranges. We'll highlight these ranges in the editor.
@@ -336,7 +336,7 @@ This is a recap of what we do for each type of version tag we find when we're pa
336
336
When we find an `ifversion` tag we:
337
337
- Increment `tagCounter`, to use as a unique ID for this tag. This variable needs to survive from one tag processing to the next.
338
338
- Increment `nestingLevel`. Initially this is -1, so this becomes 0 for an un-nested tag set and 1 for the first nesting level. This variable needs to survive from one tag processing to the next
339
-
- Assign `tagCounter` to `tagSet[nestingLevel]`. This is the ID of the tag set that this tag belongs to (always the same as the ifversion ID). This array needs to survive from one tag processing to the next.
339
+
- Assign `tagCounter` to `tagSetID[nestingLevel]`. This is the ID of the tag set that this tag belongs to (always the same as the ifversion ID). This array needs to survive from one tag processing to the next.
340
340
- Get the start and end positions of the tag (i.e. the position of `{` and `}`) and assign them to `positionVersionTagStart` and `positionVersionTagEnd`. We do this using the `match` array that contains the tag text (e.g. `{% ifversion ghes %}`) that we found using the regular expression. We do this as follows:
341
341
342
342
```
@@ -359,7 +359,7 @@ When we find an `ifversion` tag we:
359
359
- Set `elsedVersions` to `"NOT " + versionDescription[nestingLevel]` (e.g. "NOT ghes"). For nested `ifversion` tags we prepend "\nAND " to the start of the string. This variable needs to survive from one tag processing to the next, so that we can build up a string that describes the versioning for the `else` tag in the tag set.
360
360
- Create a new element in the `versionTags` array, containing these properties:
361
361
-**tagID**: The unique ID (`tagCounter` number).
362
-
-**tagSet**: The tag set ID (`tagSet[nestingLevel]` number).
362
+
-**tagSet**: The tag set ID (`tagSetID[nestingLevel]` number).
363
363
-**versionDescription**: The version description (`versionDescription` array of strings).
364
364
-**positionVersionTagStart**: The start position of the tag (`positionVersionTagStart` vscode.Position).
365
365
-**positionVersionTagEnd**: The end position of the tag (`positionVersionTagEnd` vscode.Position).
@@ -371,11 +371,11 @@ When we find an `elsif` tag we:
371
371
- Increment `tagCounter`, to use as a unique ID for this tag.
372
372
- Get the start and end positions of the tag (i.e. the position of `{` and `}`) and assign them to `positionVersionTagStart` and `positionVersionTagEnd`.
373
373
- Check whether the cursor position is after the end position of the tag. If it is, we:
374
-
- Assign `tagSet[nestingLevel]` to `currentTagSpan[nestingLevel]`.
374
+
- Assign `tagSetID[nestingLevel]` to `currentTagSpan[nestingLevel]`.
375
375
- Get the version from the tag (e.g. "ghec").
376
376
- Assign the version to `versionDescription[nestingLevel]`.
377
377
- Set `elsedVersions` to `elsedVersions + " \nAND NOT " + versionDescription[nestingLevel]` (e.g. "NOT ghes \nAND NOT ghec").
378
-
- Create a new element in the `versionTags` array, as above. Note that we don't assign a value to `tagSet` because this tag doesn't start a new tag set. It belongs to the same tag set as the `ifversion` tag. So we use the same `tagSet` value as the `ifversion` tag.
378
+
- Create a new element in the `versionTags` array, as above. Note that we don't assign a value to `tagSetID[nestingLevel]` because this tag doesn't start a new tag set. It belongs to the same tag set as the `ifversion` tag. So we use the same `tagSetID[nestingLevel]` value that we set for the `ifversion` tag.
379
379
380
380
#### `else`
381
381
@@ -384,10 +384,10 @@ When we find an `else` tag we:
384
384
- Increment `tagCounter`, to use as a unique ID for this tag.
385
385
- Get the start and end positions of the tag (i.e. the position of `{` and `}`) and assign them to `positionVersionTagStart` and `positionVersionTagEnd`.
386
386
- Check whether the cursor position is after the end position of the tag. If it is, we:
387
-
- Assign `tagSet[nestingLevel]` to `currentTagSpan[nestingLevel]`.
387
+
- Assign `tagSetID[nestingLevel]` to `currentTagSpan[nestingLevel]`.
388
388
- If `nestingLevel` is >0, we set `versionDescription[nestingLevel]` to " AND ".
389
389
- Set `versionDescription[nestingLevel]` to `versionDescription[nestingLevel] + elsedVersions`.
390
-
- Create a new element in the `versionTags` array, as above, again reusing the unmodified `tagSet` value from the `ifversion` tag.
390
+
- Create a new element in the `versionTags` array, as above, again reusing the unmodified `tagSetID[nestingLevel]` value that we set for the `ifversion` tag.
391
391
392
392
#### `endif`
393
393
@@ -399,7 +399,7 @@ When we find an `endif` tag we:
399
399
- Set `elsedVersions` to `""`.
400
400
- Delete the last element in the `versionDescription` and `currentTagSpan` arrays.
401
401
- Decrement `nestingLevel`. At each `endif` we're stepping out of a level of nesting, or out of versioning altogether this is the `endif` for an un-nested tag set (in which case `nestingLevel` returns to -1).
402
-
- Create a new element in the `versionTags` array, as above, again reusing the unmodified `tagSet` value from the `ifversion` tag.
402
+
- Create a new element in the `versionTags` array, as above, again reusing the unmodified `tagSetID[nestingLevel]` value that we set for the `ifversion` tag.
403
403
404
404
Note: the cursor can never be within an `endif` tag span, because `endif` tags have no tag span. So we'll never use the `tagID` or `versionDescription` properties of an `endif` tag. We'll only use the `tagSet` property (to identify the `endif` tag to highlight when the cursor is somewhere else within this tag set) and the `positionVersionTagStart` and `positionVersionTagEnd` properties (to tell VS Code which characters to highlight for this tag).
0 commit comments