You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2022/09/28 17:31:11 UTC

[GitHub] [daffodil-vscode] scholarsmate opened a new pull request, #309: Provides auto-complete and auto suggestions when multiple tags are on…

scholarsmate opened a new pull request, #309:
URL: https://github.com/apache/daffodil-vscode/pull/309

   … a single line
   
   completes tags on a single line with either the '/ or '>' character recognizes tags that are already complete when multiple tags are on a single line Possibly completes #165


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


[GitHub] [daffodil-vscode] scholarsmate commented on a diff in pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
scholarsmate commented on code in PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#discussion_r989277931


##########
src/language/providers/attributeCompletion.ts:
##########
@@ -71,19 +73,19 @@ export function getAttributeCompletionProvider() {
         ) {
           if (nearestOpenItem.includes('element')) {
             var preVal = ''
-            if (!wholeLine.includes('xs:element')) {
+            if (!wholeLine.includes(nsPrefix + 'element')) {

Review Comment:
   The namespace prefix patches have been detangled from this PR and are now merged into main.



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


[GitHub] [daffodil-vscode] scholarsmate commented on a diff in pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
scholarsmate commented on code in PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#discussion_r982709070


##########
src/language/providers/attributeCompletion.ts:
##########
@@ -71,19 +73,19 @@ export function getAttributeCompletionProvider() {
         ) {
           if (nearestOpenItem.includes('element')) {
             var preVal = ''
-            if (!wholeLine.includes('xs:element')) {
+            if (!wholeLine.includes(nsPrefix + 'element')) {

Review Comment:
   In asf/main, there are still several cases with `xs:` in the code, seen by doing a `git grep 'xs:'` in the `src/language` directory.



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


[GitHub] [daffodil-vscode] scholarsmate commented on a diff in pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
scholarsmate commented on code in PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#discussion_r982711580


##########
src/language/providers/attributeCompletion.ts:
##########
@@ -71,19 +73,19 @@ export function getAttributeCompletionProvider() {
         ) {
           if (nearestOpenItem.includes('element')) {
             var preVal = ''
-            if (!wholeLine.includes('xs:element')) {
+            if (!wholeLine.includes(nsPrefix + 'element')) {

Review Comment:
   I'll repair those instances with `xs:` still in there done in a separate PR, and hopefully get that fully behind us.



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


[GitHub] [daffodil-vscode] scholarsmate commented on pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by "scholarsmate (via GitHub)" <gi...@apache.org>.
scholarsmate commented on PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#issuecomment-1466235055

   This is OBE.


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


[GitHub] [daffodil-vscode] scholarsmate closed pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
scholarsmate closed pull request #309: Auto-complete and auto suggestions when multiple tags on single line
URL: https://github.com/apache/daffodil-vscode/pull/309


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


[GitHub] [daffodil-vscode] mbeckerle commented on pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by "mbeckerle (via GitHub)" <gi...@apache.org>.
mbeckerle commented on PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#issuecomment-1466992875

   What does OBE mean?
   
   On Mon, Mar 13, 2023 at 10:21 AM Davin Shearer ***@***.***>
   wrote:
   
   > This is OBE.
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/daffodil-vscode/pull/309#issuecomment-1466235055>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AALUDA66OM4QJTYSAJP44DTW34UNNANCNFSM6AAAAAAQYAAW2Q>
   > .
   > You are receiving this because you are subscribed to this thread.Message
   > ID: ***@***.***>
   >
   


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


[GitHub] [daffodil-vscode] scholarsmate commented on pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by "scholarsmate (via GitHub)" <gi...@apache.org>.
scholarsmate commented on PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#issuecomment-1474731762

   > What does OBE mean?
   > 
   > On Mon, Mar 13, 2023 at 10:21 AM Davin Shearer ***@***.***>
   > wrote:
   > 
   > > This is OBE.
   > >
   > > —
   > > Reply to this email directly, view it on GitHub
   > > <https://github.com/apache/daffodil-vscode/pull/309#issuecomment-1466235055>,
   > > or unsubscribe
   > > <https://github.com/notifications/unsubscribe-auth/AALUDA66OM4QJTYSAJP44DTW34UNNANCNFSM6AAAAAAQYAAW2Q>
   > > .
   > > You are receiving this because you are subscribed to this thread.Message
   > > ID: ***@***.***>
   > >
   > 
   
   Overtaken By Events 


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


[GitHub] [daffodil-vscode] scholarsmate commented on a diff in pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
scholarsmate commented on code in PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#discussion_r982709070


##########
src/language/providers/attributeCompletion.ts:
##########
@@ -71,19 +73,19 @@ export function getAttributeCompletionProvider() {
         ) {
           if (nearestOpenItem.includes('element')) {
             var preVal = ''
-            if (!wholeLine.includes('xs:element')) {
+            if (!wholeLine.includes(nsPrefix + 'element')) {

Review Comment:
   In asf/main, there are still several cases with `xs:` in the code, seen by doing a `git grep 'xs:' in the `src/language` directory.



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


[GitHub] [daffodil-vscode] scholarsmate commented on pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
scholarsmate commented on PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#issuecomment-1261247243

   Since @rt320 isn't currently available complete #304, I'll try to get it into mergeable shape.


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


[GitHub] [daffodil-vscode] stevedlawrence commented on a diff in pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on code in PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#discussion_r982690833


##########
src/language/providers/attributeCompletion.ts:
##########
@@ -71,19 +73,19 @@ export function getAttributeCompletionProvider() {
         ) {
           if (nearestOpenItem.includes('element')) {
             var preVal = ''
-            if (!wholeLine.includes('xs:element')) {
+            if (!wholeLine.includes(nsPrefix + 'element')) {

Review Comment:
   Did we just miss existing `xs:` removals that should have been included in PR #294? Is this intended fix that?
   
   From what I can tell, this does not address #165. 



##########
src/language/providers/closeElement.ts:
##########
@@ -32,93 +37,188 @@ export function getCloseElementProvider() {
         const wholeLine = document
           .lineAt(position)
           .text.substr(0, position.character)
+        var itemsOnLine = getItemsOnLineCount(wholeLine)
 
         if (
-          !wholeLine.includes('</') &&
           wholeLine.endsWith('>') &&
-          (wholeLine.includes('<' + nsPrefix + 'element') ||
-            nearestOpenItem.includes('element') ||
-            wholeLine.includes('<' + nsPrefix + 'group') ||
-            nearestOpenItem.includes('group') ||
-            wholeLine.includes('<' + nsPrefix + 'sequence') ||
-            nearestOpenItem.includes('sequence') ||
-            wholeLine.includes('<' + nsPrefix + 'simpleType') ||
-            nearestOpenItem.includes('simpleType') ||
-            wholeLine.includes('<' + nsPrefix + 'choice') ||
-            nearestOpenItem.includes('choice') ||
-            wholeLine.includes('dfdl:defineVariable') ||
-            nearestOpenItem.includes('Variable'))
+          ((wholeLine.includes('<' + nsPrefix + 'element') &&
+            nearestOpenItem.includes('element')) ||
+            (wholeLine.includes('<' + nsPrefix + 'group') &&
+              nearestOpenItem.includes('group')) ||
+            (wholeLine.includes('<' + nsPrefix + 'sequence') &&
+              nearestOpenItem.includes('sequence')) ||
+            (wholeLine.includes('<' + nsPrefix + 'simpleType') &&
+              nearestOpenItem.includes('simpleType')) ||
+            (wholeLine.includes('<' + nsPrefix + 'choice') &&
+              nearestOpenItem.includes('choice')) ||
+            (wholeLine.includes('dfdl:defineVariable') &&
+              nearestOpenItem.includes('Variable')))
         ) {
           var range = new vscode.Range(backpos, position)
           vscode.window.activeTextEditor?.edit((editBuilder) => {
             editBuilder.replace(range, '')
           })
-          if (
-            wholeLine.endsWith('>') &&
-            (wholeLine.includes('<' + nsPrefix + 'element ref') ||
-              wholeLine.includes('<' + nsPrefix + 'group ref'))
-          ) {
-            insertSnippet(' />\n$0', backpos)
-          } else if (
-            wholeLine.endsWith('>') &&
-            (wholeLine.includes('<' + nsPrefix + 'element') ||
-              nearestOpenItem.includes('element'))
-          ) {
-            insertSnippet('>\n\t$0\n</' + nsPrefix + 'element>', backpos)
-          } else if (
-            wholeLine.endsWith('>') &&
-            (wholeLine.includes('<' + nsPrefix + 'group') ||
-              nearestOpenItem.includes('group'))
-          ) {
-            insertSnippet('>\n\t$0\n</' + nsPrefix + 'group>', backpos)
-          } else if (
-            (wholeLine.endsWith('>') &&
-              wholeLine.includes('<' + nsPrefix + 'sequence')) ||
-            nearestOpenItem.includes('sequence')
-          ) {
-            insertSnippet('>\n\t$0\n</' + nsPrefix + 'sequence>', backpos)
-          } else if (
-            (wholeLine.endsWith('>') &&
-              wholeLine.includes('<' + nsPrefix + 'choice')) ||
-            nearestOpenItem.includes('choice')
-          ) {
-            insertSnippet('>\n\t$0\n</' + nsPrefix + 'choice>', backpos)
-          } else if (
-            (wholeLine.endsWith('>') &&
-              wholeLine.includes('<' + nsPrefix + 'simpleType')) ||
-            nearestOpenItem.includes('simpleType')
-          ) {
-            insertSnippet('>\n\t$0\n</' + nsPrefix + 'simpleType>', backpos)
-          } else if (
-            (wholeLine.endsWith('>') &&
-              wholeLine.includes('dfdl:defineVariable')) ||
-            nearestOpenItem.includes('defineVariable')
-          ) {
-            var startPos = document.lineAt(position).text.indexOf('<', 0)
-            var range = new vscode.Range(backpos, position)
-            vscode.window.activeTextEditor?.edit((editBuilder) => {
-              editBuilder.replace(range, '')
-            })
-            insertSnippet('>\n</dfdl:defineVariable>\n', backpos)
-            var backpos2 = position.with(position.line + 2, startPos - 2)
-            insertSnippet('</<' + nsPrefix + 'appinfo>\n', backpos2)
-            var backpos3 = position.with(position.line + 3, startPos - 4)
-            insertSnippet('</<' + nsPrefix + 'annotation>$0', backpos3)
-          } else if (
-            (wholeLine.endsWith('>') &&
-              wholeLine.includes('dfdl:setVariable')) ||
-            nearestOpenItem.includes('setVariable')
-          ) {
-            var startPos = document.lineAt(position).text.indexOf('<', 0)
-            var range = new vscode.Range(backpos, position)
-            vscode.window.activeTextEditor?.edit((editBuilder) => {
-              editBuilder.replace(range, '')
-            })
-            insertSnippet('>\n</dfdl:setVariable>\n', backpos)
-            var backpos2 = position.with(position.line + 2, startPos - 2)
-            insertSnippet('</' + nsPrefix + 'appinfo>\n', backpos2)
-            var backpos3 = position.with(position.line + 3, startPos - 4)
-            insertSnippet('</' + nsPrefix + 'annotation>$0', backpos3)
+          if (!wholeLine.includes('</') && itemsOnLine == 1) {
+            if (
+              wholeLine.endsWith('>') &&
+              (wholeLine.includes('<' + nsPrefix + 'element ref') ||
+                wholeLine.includes('<' + nsPrefix + 'group ref'))
+            ) {
+              insertSnippet(' />\n$0', backpos)
+            } else if (
+              wholeLine.endsWith('>') &&
+              wholeLine.includes('<' + nsPrefix + 'element') &&

Review Comment:
   wholeLine checks are not the way to solve #165 if that is the intention with this change.
   
   I have provided a rough algorithm of one way this could be solved. I'm sure there are other alternatives, but anything that does `wholeLine.endsWith` or `wholeLine.excludes` will not solve this issue.



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


[GitHub] [daffodil-vscode] scholarsmate commented on pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by GitBox <gi...@apache.org>.
scholarsmate commented on PR #309:
URL: https://github.com/apache/daffodil-vscode/pull/309#issuecomment-1270399400

   I believe this PR is at the point where @rt320 had it, except that the namespace changes were detangled and merged in separately, and all merge conflicts to this point have been resolved.


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


[GitHub] [daffodil-vscode] scholarsmate closed pull request #309: Auto-complete and auto suggestions when multiple tags on single line

Posted by "scholarsmate (via GitHub)" <gi...@apache.org>.
scholarsmate closed pull request #309: Auto-complete and auto suggestions when multiple tags on single line
URL: https://github.com/apache/daffodil-vscode/pull/309


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