You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sh...@apache.org on 2023/04/06 17:48:52 UTC

[daffodil-vscode] branch main updated: - fix problems with tags with multi-line attributes - remove an incorrect newline in the hiddenGroupRef snippet

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

shanedell 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 dda551d      - fix problems with tags with multi-line attributes     - remove an incorrect newline in the hiddenGroupRef snippet
dda551d is described below

commit dda551d4fa1c709eeebc0b4b553b5eaf39bfde20
Author: rt320 <98...@users.noreply.github.com>
AuthorDate: Tue Apr 4 12:04:25 2023 -0400

        - fix problems with tags with multi-line attributes
        - remove an incorrect newline in the hiddenGroupRef snippet
    
        Closes #562
        Closes #563
---
 src/language/providers/intellisense/attributeItems.ts |  2 +-
 src/language/providers/utils.ts                       | 13 ++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/language/providers/intellisense/attributeItems.ts b/src/language/providers/intellisense/attributeItems.ts
index 2943c1a..6d5f20e 100644
--- a/src/language/providers/intellisense/attributeItems.ts
+++ b/src/language/providers/intellisense/attributeItems.ts
@@ -281,7 +281,7 @@ export const attributeCompletion = (additionalItems, nsPrefix: string, dfdlPrefi
       },
       {
         item: 'dfdl:hiddenGroupRef',
-        snippetString: '<' + nsPrefix + 'dfdl:hiddenGroupRef="$1"\n$0',
+        snippetString: 'dfdl:hiddenGroupRef="$1"$0',
         markdownString: 'Reference to a global model group definition',
       },
       {
diff --git a/src/language/providers/utils.ts b/src/language/providers/utils.ts
index 811f6b2..6c711e4 100644
--- a/src/language/providers/utils.ts
+++ b/src/language/providers/utils.ts
@@ -220,7 +220,7 @@ export function checkTagOpen(
       return true
     }
   }
-  if (!isMultiLineTag) {
+  if (!isMultiLineTag || tagPos === -1) {
     return false
   }
   //if this tag is part of a multi line set of annotations return true
@@ -276,14 +276,12 @@ export function checkMultiLineTag(
     while (currentText.trim() === '' || !currentText.includes('<')) {
       --currentLine
       currentText = document.lineAt(currentLine).text
-      if (!currentText.endsWith('/>')) {
-        break
-      }
     }
     if (
       currentText.indexOf('<' + nsPrefix + tag) !== -1 &&
       currentText.indexOf('>') === -1 &&
-      currentText.indexOf('<' + nsPrefix + tag) < position.character
+      (currentText.indexOf('<' + nsPrefix + tag) < position.character ||
+        currentLine < position.line)
     ) {
       return true
     }
@@ -293,8 +291,9 @@ export function checkMultiLineTag(
     let tagEndPos = currentText.indexOf('/>')
     let triggerLine = position.line
     if (
-      (triggerLine <= currentLine && triggerPos < tagEndPos) ||
-      (triggerLine === tagLine && triggerPos > tagPos && tagPos !== -1)
+      (triggerLine === currentLine && triggerPos < tagEndPos) ||
+      (triggerLine === tagLine && triggerPos > tagPos && tagPos !== -1) ||
+      triggerLine < currentLine
     ) {
       return true
     }