You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "shanedell (via GitHub)" <gi...@apache.org> on 2023/07/28 15:42:06 UTC

[GitHub] [daffodil-vscode] shanedell commented on a diff in pull request #707: - Add missing element items xs:pattern, xs:totalDigits,

shanedell commented on code in PR #707:
URL: https://github.com/apache/daffodil-vscode/pull/707#discussion_r1277708260


##########
src/language/providers/attributeCompletion.ts:
##########
@@ -138,20 +150,37 @@ function checkNearestOpenItem(
   triggerText: string,
   nsPrefix: string,
   preVal: string,
-  additionalItems: string
+  additionalItems: string,
+  charBeforeTrigger: string,
+  charAfterTrigger: string
 ): vscode.CompletionItem[] | undefined {
+  let spacingChar = ''
+  if (
+    charBeforeTrigger !== ' ' &&
+    charBeforeTrigger !== '\n' &&
+    charBeforeTrigger !== '\t'
+  ) {
+    spacingChar = ' '
+  }

Review Comment:
   
   ```suggestion
     const spacingChar: String =
       charBeforeTrigger !== ' ' &&
       charBeforeTrigger !== '\n' &&
       charBeforeTrigger !== '\t'
         ? ' '
         : ''
   ```



##########
src/language/providers/elementCompletion.ts:
##########
@@ -203,36 +205,123 @@ function checkTagNearestOpen(
       )
     case 'restriction':
       return getElementCompletionItems(
-        ['maxInclusive', 'maxExclusive', 'minInclusive', 'minExclusive'],
+        [
+          'maxInclusive',
+          'maxExclusive',
+          'minInclusive',
+          'minExclusive',
+          'pattern',
+          'totalDigits',
+          'fractionDigits',
+          'enumeration',
+        ],
         '',
         '',
         nsPrefix
       )
     case 'annotation':
       return getElementCompletionItems(['appinfo'], '', '', nsPrefix)
     case 'appinfo':
-      return getElementCompletionItems(
-        [
-          'dfdl:assert',
-          'dfdl:discriminator',
-          'dfdl:defineFormat',
-          'dfdl:format',
-          'dfdl:defineVariable',
-          'dfdl:setVariable',
-          'dfdl:defineEscapeScheme',
-          'dfdl:element',
-          'dfdl:simpleType',
-        ],
-        '',
-        '',
-        nsPrefix
-      )
+      let triggerText = document.lineAt(tagPosition.line).text
+      let iCount = getItemsOnLineCount(triggerText)
+      let newPosition = tagPosition
+      if (iCount < 2) {
+        newPosition = new vscode.Position(
+          tagPosition.line - 1,
+          tagPosition.character
+        )
+      }

Review Comment:
   ```suggestion
         const newPosition =
           iCount < 2
             ? new vscode.Position(tagPosition.line - 1, tagPosition.character)
             : tagPosition
   ```



##########
src/language/providers/attributeCompletion.ts:
##########
@@ -138,20 +150,37 @@ function checkNearestOpenItem(
   triggerText: string,
   nsPrefix: string,
   preVal: string,
-  additionalItems: string
+  additionalItems: string,
+  charBeforeTrigger: string,
+  charAfterTrigger: string
 ): vscode.CompletionItem[] | undefined {
+  let spacingChar = ''
+  if (
+    charBeforeTrigger !== ' ' &&
+    charBeforeTrigger !== '\n' &&
+    charBeforeTrigger !== '\t'
+  ) {
+    spacingChar = ' '
+  }
+  let afterChar = ''
+  if (
+    charAfterTrigger !== ' ' &&
+    charAfterTrigger !== '\n' &&
+    charAfterTrigger !== '\t'
+  ) {
+    afterChar = ' '
+  }

Review Comment:
   ```suggestion
     const afterChar: String =
       charAfterTrigger !== ' ' &&
       charAfterTrigger !== '\n' &&
       charAfterTrigger !== '\t'
         ? ' '
         : ''
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org