This is an automated email from the ASF dual-hosted git repository.

rthomas320 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git


The following commit(s) were added to refs/heads/main by this push:
     new bbe9619  corrects a problem with the logic to determine if an XML tag 
is spread across multiple lines corrects a problem where a cursor after an end 
tag is not recognized correctly in some instances
bbe9619 is described below

commit bbe96198f6cab10c0919c0eb5f583955b0e8c36d
Author: rthomas320 <[email protected]>
AuthorDate: Wed Jul 23 09:30:43 2025 -0400

    corrects a problem with the logic to determine if an XML tag is spread
    across multiple lines
    corrects a problem where a cursor after an end tag is not recognized
    correctly in some instances
    
    closes #1332
    closes #1333
---
 src/language/providers/utils.ts | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/language/providers/utils.ts b/src/language/providers/utils.ts
index 10e19fd..7c99123 100644
--- a/src/language/providers/utils.ts
+++ b/src/language/providers/utils.ts
@@ -273,11 +273,13 @@ export function checkTagOpen(
     }
   }
 
+  // If there is one or less xml tags on the line and the beginning of the line
+  // contains the start tag and there is not an ending tag character after the
+  // start tag assume it is a multi-line tag
   if (
-    !(
-      triggerText.trim().startsWith('<' + nsPrefix + tag) &&
-      triggerText.endsWith('>')
-    )
+    itemsOnLine < 2 &&
+    triggerText.trim().startsWith('<' + nsPrefix + tag) &&
+    triggerText.indexOf('>', tagPos) < 0 //if tag ending character is missing 
will return -1
   ) {
     isMultiLineTag = true
   }
@@ -395,7 +397,20 @@ export function checkMultiLineTag(
   let currentLine = position.line
   let openTagLine = position.line
   let closeTagLine = position.line
-  const origText = document.lineAt(currentLine).text
+  let origText = document.lineAt(currentLine).text
+  //if the original line is blank get the previous line
+  while (origText.trim() === '') {
+    origText = document.lineAt(--currentLine).text
+  }
+  //If the cursor is after an end tag return false
+  if (
+    (position.character > origText.indexOf('</') ||
+      position.line > currentLine) &&
+    (origText.includes('</' + nsPrefix + tag) || origText.includes('/>'))
+  ) {
+    return [false, isDfdlTag, attributeNames]
+  }
+
   let currentText = origText
 
   //Get the opening tag
@@ -423,6 +438,9 @@ export function checkMultiLineTag(
       closeText = document.lineAt(closeTagLine).text
       multiLineText += ' ' + closeText.trim()
     }
+    if (closeText.includes('>')) {
+      multiLineText += closeText.trim()
+    }
     currentText = multiLineText
 
     if (

Reply via email to