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 fcb4109  Suggest namespace prefixes based on schema element prefix
fcb4109 is described below

commit fcb410960202076d994bde53d3fc53e967976556
Author: rt320 <[email protected]>
AuthorDate: Wed Sep 14 13:53:51 2022 -0400

    Suggest namespace prefixes based on schema element prefix
    
    -add function to parse prefix from schema tag and return the prefix plus a 
colon or return nothing
    -added calls to the new function
    -modified the intellisense snippets to prepend the prefix value to the auto 
complete return element
    -added schema regex to retrieve the prefix or empty value
    
    Closes #120
---
 package.json                                       | 966 +++++++++++----------
 src/language/providers/closeElement.ts             |  49 +-
 src/language/providers/closeElementSlash.ts        |  18 +-
 src/language/providers/elementCompletion.ts        |  17 +-
 .../providers/intellisense/elementItems.ts         |  36 +-
 src/language/providers/utils.ts                    | 118 +--
 src/tests/suite/language/items.test.ts             |   2 +-
 7 files changed, 617 insertions(+), 589 deletions(-)

diff --git a/package.json b/package.json
index a81ffdd..d7014c9 100644
--- a/package.json
+++ b/package.json
@@ -1,481 +1,487 @@
 {
-  "name": "apache-daffodil-vscode",
-  "displayName": "Apache Daffodil VS Code Extension",
-  "description": "VS Code extension for Apache Daffodil DFDL schema debugging",
-  "version": "1.1.0-SNAPSHOT",
-  "daffodilVersion": "3.3.0",
-  "omegaEditServerHash": 
"ffabce0d095364d1c863466f522dfa0ac2f0574d6394a82c0239a613bb84baf7c7b9fd92fdb0457e1d3c9321249acc21567d7dcfd6ff0528e0e792da1b487407",
-  "publisher": "asf",
-  "author": "Apache Daffodil",
-  "license": "Apache-2.0",
-  "engines": {
-    "vscode": "^1.55.0"
-  },
-  "icon": "images/daffodil.ico",
-  "categories": [
-    "Debuggers",
-    "Programming Languages"
-  ],
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/apache/daffodil-vscode.git";
-  },
-  "bugs": {
-    "url": "https://github.com/apache/daffodil-vscode/issues";
-  },
-  "scripts": {
-    "omega-edit-download": "node -e 
\"require('./build/scripts/omega_edit_download.ts').downloadServer()\"",
-    "precompile": "node -p \"'export const LIB_VERSION = ' + 
JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
-    "compile": "tsc -p ./ && yarn omega-edit-download",
-    "lint": "yarn run prettier src -c",
-    "watch": "yarn omega-edit-download && webpack --watch --devtool 
nosources-source-map --config ./build/extension.webpack.config.js",
-    "watch2": "tsc -watch -p ./",
-    "webpack": "webpack --mode production --config 
./build/extension.webpack.config.js",
-    "prepackage": "yarn sbt && yarn install && yarn compile && yarn webpack",
-    "package": "yarn package-setup && yarn package-create",
-    "package-setup": "node -e 
\"require('./build/scripts/package.ts').setup()\"",
-    "package-create": "node -e 
\"require('./build/scripts/package.ts').create()\"",
-    "pretest": "yarn run compile && yarn run webpack",
-    "test": "node ./out/tests/runTest.js",
-    "sbt": "sbt universal:packageBin"
-  },
-  "dependencies": {
-    "@grpc/grpc-js": "^1.5.4",
-    "await-notify": "1.0.1",
-    "child_process": "1.0.2",
-    "google-protobuf": "3.20.1",
-    "hexy": "0.3.4",
-    "omega-edit": "0.9.20",
-    "unzip-stream": "0.3.1",
-    "uuid": "^8.3.2",
-    "vscode-debugadapter": "1.51.0",
-    "wait-port": "^0.3.0",
-    "xdg-app-paths": "7.3.0"
-  },
-  "devDependencies": {
-    "@types/glob": "^7.1.3",
-    "@types/mocha": "^9.1.1",
-    "@types/node": "^18.0.0",
-    "@types/vscode": "^1.55.0",
-    "@vscode/test-electron": "^2.1.5",
-    "glob": "8.0.3",
-    "mocha": "10.0.0",
-    "prettier": "2.7.1",
-    "ts-loader": "8.1.0",
-    "typescript": "4.3.5",
-    "vsce": "2.9.2",
-    "vscode-debugadapter-testsupport": "1.51.0",
-    "webpack": "5.73.0",
-    "webpack-cli": "4.10.0"
-  },
-  "extensionDependencies": [
-    "vincaslt.highlight-matching-tag"
-  ],
-  "main": "./dist/ext/extension.js",
-  "activationEvents": [
-    "onLanguage:dfdl",
-    "onDebugResolve:dfdl",
-    "onDebugDynamicConfigurations:dfdl",
-    "onCommand:extension.dfdl-debug.getProgramName",
-    "onCommand:extension.dfdl-debug.getDataName",
-    "onCommand:extension.dfdl-debug.runEditorContents",
-    "onCommand:extension.dfdl-debug.debugEditorContents",
-    "onCommand:launch.config",
-    "onCommand:data.edit",
-    "onCommand:omega_edit.version",
-    "onCommand:toggle.experimental",
-    "onCommand:extension.dfdl-debug.debugLastEditorContents"
-  ],
-  "workspaceTrust": {
-    "request": "never"
-  },
-  "contributes": {
-    "languages": [
-      {
-        "id": "dfdl",
-        "aliases": [
-          "dfdl"
-        ],
-        "extensions": [
-          ".dfdl.xsd"
-        ],
-        "configuration": "./language/dfdl.json"
-      }
-    ],
-    "grammars": [
-      {
-        "language": "dfdl",
-        "scopeName": "text.xml.dfdl.xsd",
-        "path": "./language/syntaxes/dfdl.tmLanguage.json"
-      }
-    ],
-    "menus": {
-      "editor/title": [
-        {
-          "command": "launch.config",
-          "group": "navigation@1"
-        },
-        {
-          "command": "hexview.display",
-          "when": "resourceLangId == dfdl",
-          "group": "navigation@4"
-        },
-        {
-          "command": "infoset.display",
-          "when": "resourceLangId == dfdl",
-          "group": "navigation@2"
-        },
-        {
-          "command": "infoset.diff",
-          "when": "resourceLangId == dfdl",
-          "group": "navigation@3"
-        }
-      ],
-      "editor/title/run": [
-        {
-          "command": "extension.dfdl-debug.runEditorContents",
-          "when": "resourceLangId == dfdl"
-        },
-        {
-          "command": "extension.dfdl-debug.debugEditorContents",
-          "when": "resourceLangId == dfdl"
-        },
-        {
-          "command": "extension.dfdl-debug.debugLastEditorContents",
-          "when": "resourceLangId == dfdl"
-        }
-      ],
-      "commandPalette": [
-        {
-          "command": "extension.dfdl-debug.debugEditorContents",
-          "when": "resourceLangId == dfdl"
-        },
-        {
-          "command": "extension.dfdl-debug.runEditorContents",
-          "when": "resourceLangId == dfdl"
-        },
-        {
-          "command": "data.edit",
-          "enablement": "experimentalFeaturesEnabled"
-        },
-        {
-          "command": "omega_edit.version",
-          "enablement": "experimentalFeaturesEnabled"
-        },
-        {
-          "command": "toggle.experimental"
-        },
-        {
-          "command": "extension.dfdl-debug.debugLastEditorContents",
-          "when": "resourceLangId == dfdl"
-        }
-      ],
-      "debug/variables/context": [
-        {
-          "command": "extension.dfdl-debug.toggleFormatting",
-          "when": "debugType == 'dfdl' && debugProtocolVariableMenuContext == 
'simple'"
-        }
-      ]
-    },
-    "commands": [
-      {
-        "command": "extension.dfdl-debug.debugEditorContents",
-        "title": "Debug File",
-        "category": "Daffodil Debug",
-        "enablement": "!inDebugMode",
-        "icon": "$(debug-alt)"
-      },
-      {
-        "command": "extension.dfdl-debug.runEditorContents",
-        "title": "Run File",
-        "category": "Daffodil Debug",
-        "enablement": "!inDebugMode",
-        "icon": "$(play)"
-      },
-      {
-        "command": "extension.dfdl-debug.debugLastEditorContents",
-        "title": "Debug Last File",
-        "category": "Daffodil Debug",
-        "enablement": "!inDebugMode",
-        "icon": "$(debug-alt)"
-      },
-      {
-        "command": "extension.dfdl-debug.toggleFormatting",
-        "title": "Toggle between decimal and hex formatting",
-        "category": "Daffodil Debug",
-        "enablement": "inDebugMode"
-      },
-      {
-        "command": "hexview.display",
-        "title": "Display the hex view",
-        "category": "Daffodil Debug",
-        "enablement": "inDebugMode",
-        "icon": "$(file-binary)"
-      },
-      {
-        "command": "infoset.display",
-        "title": "Display the infoset view",
-        "category": "Daffodil Debug",
-        "enablement": "inDebugMode",
-        "icon": "$(file-code)"
-      },
-      {
-        "command": "infoset.diff",
-        "title": "View infoset diff",
-        "category": "Daffodil Debug",
-        "enablement": "inDebugMode",
-        "icon": "$(diff)"
-      },
-      {
-        "command": "infoset.save",
-        "title": "Save the current infoset",
-        "category": "Daffodil Debug",
-        "enablement": "inDebugMode"
-      },
-      {
-        "command": "launch.config",
-        "title": "Configure launch.json",
-        "category": "Daffodil Debug",
-        "enablement": "!inDebugMode",
-        "icon": "$(debug-configure)"
-      },
-      {
-        "command": "toggle.experimental",
-        "title": "Enable Experimental Features",
-        "category": "Daffodil Debug"
-      },
-      {
-        "command": "omega_edit.version",
-        "title": "Omega Edit Ω Version Info",
-        "category": "OmegaEdit",
-        "enablement": "experimentalFeaturesEnabled"
-      },
-      {
-        "command": "data.edit",
-        "title": "Data Editor",
-        "category": "OmegaEdit",
-        "enablement": "experimentalFeaturesEnabled"
-      },
-      {
-        "command": "position.goto",
-        "title": "Go to position",
-        "category": "OmegaEdit",
-        "enablement": "experimentalFeaturesEnabled"
-      }
-    ],
-    "keybindings": [
-      {
-        "command": "position.goto",
-        "key": "ctrl+alt+g",
-        "mac": "ctrl+cmd+g",
-        "when": "editorTextFocus"
-      }
-    ],
-    "breakpoints": [
-      {
-        "language": "dfdl"
-      }
-    ],
-    "debuggers": [
-      {
-        "type": "dfdl",
-        "languages": [
-          "dfdl"
-        ],
-        "label": "Daffodil Debug",
-        "program": "./out/extension.js",
-        "runtime": "node",
-        "configurationAttributes": {
-          "launch": {
-            "required": [
-              "program",
-              "data"
-            ],
-            "properties": {
-              "program": {
-                "type": "string",
-                "description": "Absolute path to the DFDL schema file.",
-                "default": "${command:AskForProgramName}"
-              },
-              "data": {
-                "type": "string",
-                "description": "Absolute path to the input data file.",
-                "default": "${command:AskForDataName}"
-              },
-              "infosetOutput": {
-                "type": "object",
-                "description": "Destination for final Infoset (file-path | 
'console' | 'none')",
-                "default": {
-                  "type": "console",
-                  "path": "${workspaceFolder}/infoset.xml"
-                }
-              },
-              "stopOnEntry": {
-                "type": "boolean",
-                "description": "Automatically stop after launch.",
-                "default": true
-              },
-              "trace": {
-                "type": "boolean",
-                "description": "Enable logging of the Debug Adapter Protocol.",
-                "default": true
-              },
-              "debugServer": {
-                "type": "integer",
-                "description": "Port debug server running on",
-                "default": 4711
-              },
-              "useExistingServer": {
-                "type": "boolean",
-                "description": "Enable connection to running DAP Server",
-                "default": false
-              },
-              "openHexView": {
-                "type": "boolean",
-                "description": "Open hexview on debug start",
-                "default": false
-              },
-              "openInfosetView": {
-                "type": "boolean",
-                "description": "Open hexview on debug start",
-                "default": false
-              },
-              "openInfosetDiffView": {
-                "type": "boolean",
-                "description": "Open hexview on debug start",
-                "default": false
-              },
-              "daffodilDebugClasspath": {
-                "type": "string",
-                "description": "Additional classpaths to be exported to the 
debugger",
-                "default": ""
-              }
-            }
-          }
-        },
-        "initialConfigurations": [
-          {
-            "type": "dfdl",
-            "request": "launch",
-            "name": "Ask for file name",
-            "program": "${command:AskForProgramName}",
-            "stopOnEntry": true,
-            "data": "${command:AskForDataName}",
-            "infosetOutput": {
-              "type": "file",
-              "path": "${workspaceFolder}/infoset.xml"
-            },
-            "debugServer": 4711,
-            "openHexView": false,
-            "openInfosetView": false,
-            "openInfosetDiffView": false,
-            "daffodilDebugClasspath": ""
-          }
-        ],
-        "configurationSnippets": [
-          {
-            "label": "Daffodil Debug: Launch",
-            "description": "A new configuration for 'debugging' a user 
selected xml file.",
-            "body": {
-              "type": "dfdl",
-              "request": "launch",
-              "name": "Ask for file name",
-              "program": "^\"\\${command:AskForProgramName}\"",
-              "stopOnEntry": true,
-              "data": "^\"\\${command:AskForDataName}\"",
-              "infosetOutput": {
-                "type": "file",
-                "path": "${workspaceFolder}/infoset.xml"
-              },
-              "debugServer": 4711,
-              "openHexView": false,
-              "openInfosetView": false,
-              "openInfosetDiffView": false,
-              "daffodilDebugClasspath": ""
-            }
-          }
-        ],
-        "variables": {
-          "AskForProgramName": "extension.dfdl-debug.getProgramName",
-          "AskForDataName": "extension.dfdl-debug.getDataName"
-        }
-      }
-    ],
-    "configuration": [
-      {
-        "title": "Daffodil Debugger Global",
-        "properties": {
-          "type": {
-            "type": "string",
-            "default": "dfdl"
-          },
-          "program": {
-            "type": "string",
-            "description": "Absolute path to the DFDL schema file.",
-            "default": "${command:AskForProgramName}"
-          },
-          "data": {
-            "type": "string",
-            "description": "Absolute path to the input data file.",
-            "default": "${command:AskForDataName}"
-          },
-          "infosetOutputType": {
-            "type": "string",
-            "description": "Destination for final Infoset (file | 'console' | 
'none')",
-            "enum": [
-              "file",
-              "console",
-              "none"
-            ],
-            "default": "none"
-          },
-          "infosetOutputFilePath": {
-            "type": "string",
-            "description": "Path to output for Infoset file (req: 
infosetOutput=file)",
-            "default": "${workspaceFolder}/infoset.xml"
-          },
-          "stopOnEntry": {
-            "type": "boolean",
-            "description": "Automatically stop after launch.",
-            "default": true
-          },
-          "trace": {
-            "type": "boolean",
-            "description": "Enable logging of the Debug Adapter Protocol.",
-            "default": true
-          },
-          "useExistingServer": {
-            "type": "boolean",
-            "description": "Enable connection to running DAP Server",
-            "default": false
-          },
-          "debugServer": {
-            "type": "integer",
-            "description": "Port debug server running on",
-            "default": 4711
-          },
-          "openHexView": {
-            "type": "boolean",
-            "description": "Open hexview on debug start",
-            "default": false
-          },
-          "openInfosetView": {
-            "type": "boolean",
-            "description": "Open hexview on debug start",
-            "default": false
-          },
-          "openInfosetDiffView": {
-            "type": "boolean",
-            "description": "Open hexview on debug start",
-            "default": false
-          },
-          "daffodilDebugClasspath": {
-            "type": "string",
-            "description": "Additional classpaths to be exported to the 
debugger",
-            "default": ""
-          }
-        }
-      }
-    ]
-  }
-}
+       "name": "apache-daffodil-vscode",
+       "displayName": "Apache Daffodil VS Code Extension",
+       "description": "VS Code extension for Apache Daffodil DFDL schema 
debugging",
+       "version": "1.1.0-SNAPSHOT",
+       "daffodilVersion": "3.3.0",
+       "omegaEditServerHash": 
"ffabce0d095364d1c863466f522dfa0ac2f0574d6394a82c0239a613bb84baf7c7b9fd92fdb0457e1d3c9321249acc21567d7dcfd6ff0528e0e792da1b487407",
+       "publisher": "asf",
+       "author": "Apache Daffodil",
+       "license": "Apache-2.0",
+       "engines": {
+               "vscode": "^1.55.0"
+       },
+       "icon": "images/daffodil.ico",
+       "categories": [
+               "Debuggers",
+               "Programming Languages"
+       ],
+       "repository": {
+               "type": "git",
+               "url": "https://github.com/apache/daffodil-vscode.git";
+       },
+       "bugs": {
+               "url": "https://github.com/apache/daffodil-vscode/issues";
+       },
+       "scripts": {
+               "omega-edit-download": "node -e 
\"require('./build/scripts/omega_edit_download.ts').downloadServer()\"",
+               "precompile": "node -p \"'export const LIB_VERSION = ' + 
JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
+               "compile": "tsc -p ./ && yarn omega-edit-download",
+               "lint": "yarn run prettier src -c",
+               "watch": "yarn omega-edit-download && webpack --watch --devtool 
nosources-source-map --config ./build/extension.webpack.config.js",
+               "watch2": "tsc -watch -p ./",
+               "webpack": "webpack --mode production --config 
./build/extension.webpack.config.js",
+               "prepackage": "yarn sbt && yarn install && yarn compile && yarn 
webpack",
+               "package": "yarn package-setup && yarn package-create",
+               "package-setup": "node -e 
\"require('./build/scripts/package.ts').setup()\"",
+               "package-create": "node -e 
\"require('./build/scripts/package.ts').create()\"",
+               "pretest": "yarn run compile && yarn run webpack",
+               "test": "node ./out/tests/runTest.js",
+               "sbt": "sbt universal:packageBin"
+       },
+       "dependencies": {
+               "@grpc/grpc-js": "^1.5.4",
+               "await-notify": "1.0.1",
+               "child_process": "1.0.2",
+               "google-protobuf": "3.20.1",
+               "hexy": "0.3.4",
+               "omega-edit": "0.9.20",
+               "unzip-stream": "0.3.1",
+               "uuid": "^8.3.2",
+               "vscode-debugadapter": "1.51.0",
+               "wait-port": "^0.3.0",
+               "xdg-app-paths": "7.3.0"
+       },
+       "devDependencies": {
+               "@types/glob": "^7.1.3",
+               "@types/mocha": "^9.1.1",
+               "@types/node": "^18.0.0",
+               "@types/vscode": "^1.55.0",
+               "@vscode/test-electron": "^2.1.5",
+               "glob": "8.0.3",
+               "mocha": "10.0.0",
+               "prettier": "2.7.1",
+               "ts-loader": "8.1.0",
+               "typescript": "4.3.5",
+               "vsce": "2.9.2",
+               "vscode-debugadapter-testsupport": "1.51.0",
+               "webpack": "5.73.0",
+               "webpack-cli": "4.10.0"
+       },
+       "extensionDependencies": [
+               "vincaslt.highlight-matching-tag"
+       ],
+       "main": "./dist/ext/extension.js",
+       "activationEvents": [
+               "onLanguage:dfdl",
+               "onDebugResolve:dfdl",
+               "onDebugDynamicConfigurations:dfdl",
+               "onCommand:extension.dfdl-debug.getProgramName",
+               "onCommand:extension.dfdl-debug.getDataName",
+               "onCommand:extension.dfdl-debug.runEditorContents",
+               "onCommand:extension.dfdl-debug.debugEditorContents",
+               "onCommand:launch.config",
+               "onCommand:data.edit",
+               "onCommand:omega_edit.version",
+               "onCommand:toggle.experimental",
+               "onCommand:extension.dfdl-debug.debugLastEditorContents"
+       ],
+       "workspaceTrust": {
+               "request": "never"
+       },
+       "contributes": {
+               "languages": [
+                       {
+                               "id": "dfdl",
+                               "aliases": [
+                                       "dfdl"
+                               ],
+                               "extensions": [
+                                       ".dfdl.xsd"
+                               ],
+                               "configuration": "./language/dfdl.json"
+                       }
+               ],
+               "grammars": [
+                       {
+                               "language": "dfdl",
+                               "scopeName": "text.xml.dfdl.xsd",
+                               "path": 
"./language/syntaxes/dfdl.tmLanguage.json"
+                       }
+               ],
+               "menus": {
+                       "editor/title": [
+                               {
+                                       "command": "launch.config",
+                                       "group": "navigation@1"
+                               },
+                               {
+                                       "command": "hexview.display",
+                                       "when": "resourceLangId == dfdl",
+                                       "group": "navigation@4"
+                               },
+                               {
+                                       "command": "infoset.display",
+                                       "when": "resourceLangId == dfdl",
+                                       "group": "navigation@2"
+                               },
+                               {
+                                       "command": "infoset.diff",
+                                       "when": "resourceLangId == dfdl",
+                                       "group": "navigation@3"
+                               }
+                       ],
+                       "editor/title/run": [
+                               {
+                                       "command": 
"extension.dfdl-debug.runEditorContents",
+                                       "when": "resourceLangId == dfdl"
+                               },
+                               {
+                                       "command": 
"extension.dfdl-debug.debugEditorContents",
+                                       "when": "resourceLangId == dfdl"
+                               },
+                               {
+                                       "command": 
"extension.dfdl-debug.debugLastEditorContents",
+                                       "when": "resourceLangId == dfdl"
+                               }
+                       ],
+                       "commandPalette": [
+                               {
+                                       "command": 
"extension.dfdl-debug.debugEditorContents",
+                                       "when": "resourceLangId == dfdl"
+                               },
+                               {
+                                       "command": 
"extension.dfdl-debug.runEditorContents",
+                                       "when": "resourceLangId == dfdl"
+                               },
+                               {
+                                       "command": "data.edit",
+                                       "enablement": 
"experimentalFeaturesEnabled"
+                               },
+                               {
+                                       "command": "omega_edit.version",
+                                       "enablement": 
"experimentalFeaturesEnabled"
+                               },
+                               {
+                                       "command": "toggle.experimental"
+                               },
+                               {
+                                       "command": 
"extension.dfdl-debug.debugLastEditorContents",
+                                       "when": "resourceLangId == dfdl"
+                               }
+                       ],
+                       "debug/variables/context": [
+                               {
+                                       "command": 
"extension.dfdl-debug.toggleFormatting",
+                                       "when": "debugType == 'dfdl' && 
debugProtocolVariableMenuContext == 'simple'"
+                               }
+                       ]
+               },
+               "commands": [
+                       {
+                               "command": 
"extension.dfdl-debug.debugEditorContents",
+                               "title": "Debug File",
+                               "category": "Daffodil Debug",
+                               "enablement": "!inDebugMode",
+                               "icon": "$(debug-alt)"
+                       },
+                       {
+                               "command": 
"extension.dfdl-debug.runEditorContents",
+                               "title": "Run File",
+                               "category": "Daffodil Debug",
+                               "enablement": "!inDebugMode",
+                               "icon": "$(play)"
+                       },
+                       {
+                               "command": 
"extension.dfdl-debug.debugLastEditorContents",
+                               "title": "Debug Last File",
+                               "category": "Daffodil Debug",
+                               "enablement": "!inDebugMode",
+                               "icon": "$(debug-alt)"
+                       },
+                       {
+                               "command": 
"extension.dfdl-debug.toggleFormatting",
+                               "title": "Toggle between decimal and hex 
formatting",
+                               "category": "Daffodil Debug",
+                               "enablement": "inDebugMode"
+                       },
+                       {
+                               "command": "hexview.display",
+                               "title": "Display the hex view",
+                               "category": "Daffodil Debug",
+                               "enablement": "inDebugMode",
+                               "icon": "$(file-binary)"
+                       },
+                       {
+                               "command": "infoset.display",
+                               "title": "Display the infoset view",
+                               "category": "Daffodil Debug",
+                               "enablement": "inDebugMode",
+                               "icon": "$(file-code)"
+                       },
+                       {
+                               "command": "infoset.diff",
+                               "title": "View infoset diff",
+                               "category": "Daffodil Debug",
+                               "enablement": "inDebugMode",
+                               "icon": "$(diff)"
+                       },
+                       {
+                               "command": "infoset.save",
+                               "title": "Save the current infoset",
+                               "category": "Daffodil Debug",
+                               "enablement": "inDebugMode"
+                       },
+                       {
+                               "command": "launch.config",
+                               "title": "Configure launch.json",
+                               "category": "Daffodil Debug",
+                               "enablement": "!inDebugMode",
+                               "icon": "$(debug-configure)"
+                       },
+                       {
+                               "command": "toggle.experimental",
+                               "title": "Enable Experimental Features",
+                               "category": "Daffodil Debug"
+                       },
+                       {
+                               "command": "omega_edit.version",
+                               "title": "Omega Edit Ω Version Info",
+                               "category": "OmegaEdit",
+                               "enablement": "experimentalFeaturesEnabled"
+                       },
+                       {
+                               "command": "data.edit",
+                               "title": "Data Editor",
+                               "category": "OmegaEdit",
+                               "enablement": "experimentalFeaturesEnabled"
+                       },
+                       {
+                               "command": "position.goto",
+                               "title": "Go to position",
+                               "category": "OmegaEdit",
+                               "enablement": "experimentalFeaturesEnabled"
+                       }
+               ],
+               "keybindings": [
+                       {
+                               "command": "position.goto",
+                               "key": "ctrl+alt+g",
+                               "mac": "ctrl+cmd+g",
+                               "when": "editorTextFocus"
+                       }
+               ],
+               "breakpoints": [
+                       {
+                               "language": "dfdl"
+                       }
+               ],
+               "debuggers": [
+                       {
+                               "type": "dfdl",
+                               "languages": [
+                                       "dfdl"
+                               ],
+                               "label": "Daffodil Debug",
+                               "program": "./out/extension.js",
+                               "runtime": "node",
+                               "configurationAttributes": {
+                                       "launch": {
+                                               "required": [
+                                                       "program",
+                                                       "data"
+                                               ],
+                                               "properties": {
+                                                       "program": {
+                                                               "type": 
"string",
+                                                               "description": 
"Absolute path to the DFDL schema file.",
+                                                               "default": 
"${command:AskForProgramName}"
+                                                       },
+                                                       "data": {
+                                                               "type": 
"string",
+                                                               "description": 
"Absolute path to the input data file.",
+                                                               "default": 
"${command:AskForDataName}"
+                                                       },
+                                                       "infosetOutput": {
+                                                               "type": 
"object",
+                                                               "description": 
"Destination for final Infoset (file-path | 'console' | 'none')",
+                                                               "default": {
+                                                                       "type": 
"console",
+                                                                       "path": 
"${workspaceFolder}/infoset.xml"
+                                                               }
+                                                       },
+                                                       "stopOnEntry": {
+                                                               "type": 
"boolean",
+                                                               "description": 
"Automatically stop after launch.",
+                                                               "default": true
+                                                       },
+                                                       "trace": {
+                                                               "type": 
"boolean",
+                                                               "description": 
"Enable logging of the Debug Adapter Protocol.",
+                                                               "default": true
+                                                       },
+                                                       "debugServer": {
+                                                               "type": 
"integer",
+                                                               "description": 
"Port debug server running on",
+                                                               "default": 4711
+                                                       },
+                                                       "useExistingServer": {
+                                                               "type": 
"boolean",
+                                                               "description": 
"Enable connection to running DAP Server",
+                                                               "default": false
+                                                       },
+                                                       "openHexView": {
+                                                               "type": 
"boolean",
+                                                               "description": 
"Open hexview on debug start",
+                                                               "default": false
+                                                       },
+                                                       "openInfosetView": {
+                                                               "type": 
"boolean",
+                                                               "description": 
"Open hexview on debug start",
+                                                               "default": false
+                                                       },
+                                                       "openInfosetDiffView": {
+                                                               "type": 
"boolean",
+                                                               "description": 
"Open hexview on debug start",
+                                                               "default": false
+                                                       },
+                                                       
"daffodilDebugClasspath": {
+                                                               "type": 
"string",
+                                                               "description": 
"Additional classpaths to be exported to the debugger",
+                                                               "default": ""
+                                                       }
+                                               }
+                                       }
+                               },
+                               "initialConfigurations": [
+                                       {
+                                               "type": "dfdl",
+                                               "request": "launch",
+                                               "name": "Ask for file name",
+                                               "program": 
"${command:AskForProgramName}",
+                                               "stopOnEntry": true,
+                                               "data": 
"${command:AskForDataName}",
+                                               "infosetOutput": {
+                                                       "type": "file",
+                                                       "path": 
"${workspaceFolder}/infoset.xml"
+                                               },
+                                               "debugServer": 4711,
+                                               "openHexView": false,
+                                               "openInfosetView": false,
+                                               "openInfosetDiffView": false,
+                                               "daffodilDebugClasspath": ""
+                                       }
+                               ],
+                               "configurationSnippets": [
+                                       {
+                                               "label": "Daffodil Debug: 
Launch",
+                                               "description": "A new 
configuration for 'debugging' a user selected xml file.",
+                                               "body": {
+                                                       "type": "dfdl",
+                                                       "request": "launch",
+                                                       "name": "Ask for file 
name",
+                                                       "program": 
"^\"\\${command:AskForProgramName}\"",
+                                                       "stopOnEntry": true,
+                                                       "data": 
"^\"\\${command:AskForDataName}\"",
+                                                       "infosetOutput": {
+                                                               "type": "file",
+                                                               "path": 
"${workspaceFolder}/infoset.xml"
+                                                       },
+                                                       "debugServer": 4711,
+                                                       "openHexView": false,
+                                                       "openInfosetView": 
false,
+                                                       "openInfosetDiffView": 
false,
+                                                       
"daffodilDebugClasspath": ""
+                                               }
+                                       }
+                               ],
+                               "variables": {
+                                       "AskForProgramName": 
"extension.dfdl-debug.getProgramName",
+                                       "AskForDataName": 
"extension.dfdl-debug.getDataName"
+                               }
+                       }
+               ],
+               "configuration": [
+                       {
+                               "title": "Daffodil Debugger Global",
+                               "properties": {
+                                       "type": {
+                                               "type": "string",
+                                               "default": "dfdl"
+                                       },
+                                       "program": {
+                                               "type": "string",
+                                               "description": "Absolute path 
to the DFDL schema file.",
+                                               "default": 
"${command:AskForProgramName}"
+                                       },
+                                       "data": {
+                                               "type": "string",
+                                               "description": "Absolute path 
to the input data file.",
+                                               "default": 
"${command:AskForDataName}"
+                                       },
+                                       "infosetOutputType": {
+                                               "type": "string",
+                                               "description": "Destination for 
final Infoset (file | 'console' | 'none')",
+                                               "enum": [
+                                                       "file",
+                                                       "console",
+                                                       "none"
+                                               ],
+                                               "default": "none"
+                                       },
+                                       "infosetOutputFilePath": {
+                                               "type": "string",
+                                               "description": "Path to output 
for Infoset file (req: infosetOutput=file)",
+                                               "default": 
"${workspaceFolder}/infoset.xml"
+                                       },
+                                       "stopOnEntry": {
+                                               "type": "boolean",
+                                               "description": "Automatically 
stop after launch.",
+                                               "default": true
+                                       },
+                                       "trace": {
+                                               "type": "boolean",
+                                               "description": "Enable logging 
of the Debug Adapter Protocol.",
+                                               "default": true
+                                       },
+                                       "useExistingServer": {
+                                               "type": "boolean",
+                                               "description": "Enable 
connection to running DAP Server",
+                                               "default": false
+                                       },
+                                       "debugServer": {
+                                               "type": "integer",
+                                               "description": "Port debug 
server running on",
+                                               "default": 4711
+                                       },
+                                       "openHexView": {
+                                               "type": "boolean",
+                                               "description": "Open hexview on 
debug start",
+                                               "default": false
+                                       },
+                                       "openInfosetView": {
+                                               "type": "boolean",
+                                               "description": "Open hexview on 
debug start",
+                                               "default": false
+                                       },
+                                       "openInfosetDiffView": {
+                                               "type": "boolean",
+                                               "description": "Open hexview on 
debug start",
+                                               "default": false
+                                       },
+                                       "daffodilDebugClasspath": {
+                                               "type": "string",
+                                               "description": "Additional 
classpaths to be exported to the debugger",
+                                               "default": ""
+                                       }
+                               }
+                       }
+               ]
+       },
+       "__metadata": {
+               "id": "4f1304da-7e65-48f1-9126-0a143e2e5ef2",
+               "publisherDisplayName": "Apache Software Foundation",
+               "publisherId": "4dbc1d1a-d64b-46f8-8756-1c234855f645",
+               "isPreReleaseVersion": false
+       }
+}
\ No newline at end of file
diff --git a/src/language/providers/closeElement.ts 
b/src/language/providers/closeElement.ts
index 7d271c4..6ba48ef 100644
--- a/src/language/providers/closeElement.ts
+++ b/src/language/providers/closeElement.ts
@@ -16,7 +16,7 @@
  */
 
 import * as vscode from 'vscode'
-import { insertSnippet, nearestOpen } from './utils'
+import { getXsdNsPrefix, insertSnippet, nearestOpen } from './utils'
 
 export function getCloseElementProvider() {
   return vscode.languages.registerCompletionItemProvider(
@@ -27,22 +27,24 @@ export function getCloseElementProvider() {
         position: vscode.Position
       ) {
         var backpos = position.with(position.line, position.character - 1)
+        const nsPrefix = getXsdNsPrefix(document, position)
         const nearestOpenItem = nearestOpen(document, position)
         const wholeLine = document
           .lineAt(position)
           .text.substr(0, position.character)
 
         if (
+          !wholeLine.includes('</') &&
           wholeLine.endsWith('>') &&
-          (wholeLine.includes('xs:element') ||
+          (wholeLine.includes('<' + nsPrefix + 'element') ||
             nearestOpenItem.includes('element') ||
-            wholeLine.includes('xs:group') ||
+            wholeLine.includes('<' + nsPrefix + 'group') ||
             nearestOpenItem.includes('group') ||
-            wholeLine.includes('xs:sequence') ||
+            wholeLine.includes('<' + nsPrefix + 'sequence') ||
             nearestOpenItem.includes('sequence') ||
-            wholeLine.includes('xs:simpleType') ||
+            wholeLine.includes('<' + nsPrefix + 'simpleType') ||
             nearestOpenItem.includes('simpleType') ||
-            wholeLine.includes('xs:choice') ||
+            wholeLine.includes('<' + nsPrefix + 'choice') ||
             nearestOpenItem.includes('choice') ||
             wholeLine.includes('dfdl:defineVariable') ||
             nearestOpenItem.includes('Variable'))
@@ -53,37 +55,40 @@ export function getCloseElementProvider() {
           })
           if (
             wholeLine.endsWith('>') &&
-            (wholeLine.includes('xs:element ref') ||
-              wholeLine.includes('xs:group ref'))
+            (wholeLine.includes('<' + nsPrefix + 'element ref') ||
+              wholeLine.includes('<' + nsPrefix + 'group ref'))
           ) {
             insertSnippet(' />\n$0', backpos)
           } else if (
             wholeLine.endsWith('>') &&
-            (wholeLine.includes('xs:element') ||
+            (wholeLine.includes('<' + nsPrefix + 'element') ||
               nearestOpenItem.includes('element'))
           ) {
-            insertSnippet('>\n\t$0\n</xs:element>', backpos)
+            insertSnippet('>\n\t$0\n</' + nsPrefix + 'element>', backpos)
           } else if (
             wholeLine.endsWith('>') &&
-            (wholeLine.includes('xs:group') ||
+            (wholeLine.includes('<' + nsPrefix + 'group') ||
               nearestOpenItem.includes('group'))
           ) {
-            insertSnippet('>\n\t$0\n</xs:group>', backpos)
+            insertSnippet('>\n\t$0\n</' + nsPrefix + 'group>', backpos)
           } else if (
-            (wholeLine.endsWith('>') && wholeLine.includes('xs:sequence')) ||
+            (wholeLine.endsWith('>') &&
+              wholeLine.includes('<' + nsPrefix + 'sequence')) ||
             nearestOpenItem.includes('sequence')
           ) {
-            insertSnippet('>\n\t$0\n</xs:sequence>', backpos)
+            insertSnippet('>\n\t$0\n</' + nsPrefix + 'sequence>', backpos)
           } else if (
-            (wholeLine.endsWith('>') && wholeLine.includes('xs:choice')) ||
+            (wholeLine.endsWith('>') &&
+              wholeLine.includes('<' + nsPrefix + 'choice')) ||
             nearestOpenItem.includes('choice')
           ) {
-            insertSnippet('>\n\t$0\n</xs:choice>', backpos)
+            insertSnippet('>\n\t$0\n</' + nsPrefix + 'choice>', backpos)
           } else if (
-            (wholeLine.endsWith('>') && wholeLine.includes('xs:simpleType')) ||
+            (wholeLine.endsWith('>') &&
+              wholeLine.includes('<' + nsPrefix + 'simpleType')) ||
             nearestOpenItem.includes('simpleType')
           ) {
-            insertSnippet('>\n\t$0\n</xs:simpleType>', backpos)
+            insertSnippet('>\n\t$0\n</' + nsPrefix + 'simpleType>', backpos)
           } else if (
             (wholeLine.endsWith('>') &&
               wholeLine.includes('dfdl:defineVariable')) ||
@@ -96,9 +101,9 @@ export function getCloseElementProvider() {
             })
             insertSnippet('>\n</dfdl:defineVariable>\n', backpos)
             var backpos2 = position.with(position.line + 2, startPos - 2)
-            insertSnippet('</xs:appinfo>\n', backpos2)
+            insertSnippet('</<' + nsPrefix + 'appinfo>\n', backpos2)
             var backpos3 = position.with(position.line + 3, startPos - 4)
-            insertSnippet('</xs:annotation>$0', backpos3)
+            insertSnippet('</<' + nsPrefix + 'annotation>$0', backpos3)
           } else if (
             (wholeLine.endsWith('>') &&
               wholeLine.includes('dfdl:setVariable')) ||
@@ -111,9 +116,9 @@ export function getCloseElementProvider() {
             })
             insertSnippet('>\n</dfdl:setVariable>\n', backpos)
             var backpos2 = position.with(position.line + 2, startPos - 2)
-            insertSnippet('</xs:appinfo>\n', backpos2)
+            insertSnippet('</' + nsPrefix + 'appinfo>\n', backpos2)
             var backpos3 = position.with(position.line + 3, startPos - 4)
-            insertSnippet('</xs:annotation>$0', backpos3)
+            insertSnippet('</' + nsPrefix + 'annotation>$0', backpos3)
           }
         }
         return undefined
diff --git a/src/language/providers/closeElementSlash.ts 
b/src/language/providers/closeElementSlash.ts
index 9019444..39fca75 100644
--- a/src/language/providers/closeElementSlash.ts
+++ b/src/language/providers/closeElementSlash.ts
@@ -16,7 +16,12 @@
  */
 
 import * as vscode from 'vscode'
-import { insertSnippet, nearestOpen, checkBraceOpen } from './utils'
+import {
+  insertSnippet,
+  nearestOpen,
+  checkBraceOpen,
+  getXsdNsPrefix,
+} from './utils'
 
 export function getCloseElementSlashProvider() {
   return vscode.languages.registerCompletionItemProvider(
@@ -27,6 +32,7 @@ export function getCloseElementSlashProvider() {
         position: vscode.Position
       ) {
         var backpos = position.with(position.line, position.character - 1)
+        const nsPrefix = getXsdNsPrefix(document, position)
         const wholeLine = document
           .lineAt(position)
           .text.substr(0, position.character)
@@ -36,11 +42,11 @@ export function getCloseElementSlashProvider() {
         }
         if (
           wholeLine.endsWith('/') &&
-          (wholeLine.includes('xs:element') ||
+          (wholeLine.includes('<' + nsPrefix + 'element') ||
             nearestOpenItem.includes('element') ||
-            wholeLine.includes('xs:group') ||
+            wholeLine.includes('<' + nsPrefix + 'group') ||
             nearestOpenItem.includes('group') ||
-            wholeLine.includes('xs:sequence') ||
+            wholeLine.includes('<' + nsPrefix + 'sequence') ||
             nearestOpenItem.includes('sequence'))
         ) {
           var range = new vscode.Range(backpos, position)
@@ -63,9 +69,9 @@ export function getCloseElementSlashProvider() {
           })
           insertSnippet('/>\n', backpos)
           var backpos2 = position.with(position.line + 1, startPos - 2)
-          insertSnippet('</xs:appinfo>\n', backpos2)
+          insertSnippet('</<' + nsPrefix + 'appinfo>\n', backpos2)
           var backpos3 = position.with(position.line + 2, startPos - 4)
-          insertSnippet('</xs:annotation>$0', backpos3)
+          insertSnippet('</<' + nsPrefix + 'annotation>$0', backpos3)
         }
         return undefined
       },
diff --git a/src/language/providers/elementCompletion.ts 
b/src/language/providers/elementCompletion.ts
index 4d06297..64532e9 100644
--- a/src/language/providers/elementCompletion.ts
+++ b/src/language/providers/elementCompletion.ts
@@ -16,7 +16,7 @@
  */
 
 import * as vscode from 'vscode'
-import { checkBraceOpen } from './utils'
+import { checkBraceOpen, getXsdNsPrefix } from './utils'
 import { elementCompletion } from './intellisense/elementItems'
 import { createCompletionItem } from './utils'
 
@@ -32,6 +32,7 @@ export function 
getElementCompletionProvider(dfdlFormatString: string) {
         console.log('in elementCompletionProvider - brace is showing open')
         return undefined
       }
+      var nsPrefix = getXsdNsPrefix(document, position)
       var definedVariables = getDefinedVariables(document)
 
       // a completion item that inserts its text as snippet,
@@ -39,12 +40,14 @@ export function 
getElementCompletionProvider(dfdlFormatString: string) {
       // honored by the editor.
       let compItems: vscode.CompletionItem[] = []
 
-      elementCompletion(definedVariables, dfdlFormatString).items.forEach(
-        (e) => {
-          const completionItem = createCompletionItem(e, '')
-          compItems.push(completionItem)
-        }
-      )
+      elementCompletion(
+        definedVariables,
+        dfdlFormatString,
+        nsPrefix
+      ).items.forEach((e) => {
+        const completionItem = createCompletionItem(e, '')
+        compItems.push(completionItem)
+      })
 
       return compItems
     },
diff --git a/src/language/providers/intellisense/elementItems.ts 
b/src/language/providers/intellisense/elementItems.ts
index 7d51715..bbedd1c 100644
--- a/src/language/providers/intellisense/elementItems.ts
+++ b/src/language/providers/intellisense/elementItems.ts
@@ -16,7 +16,7 @@
  */
 
 // prettier-ignore
-export const elementCompletion = (definedVariables, dfdlFormatString) => {
+export const elementCompletion = (definedVariables, dfdlFormatString, 
nsPrefix) => {
   return {
     items: [
       {
@@ -29,36 +29,36 @@ export const elementCompletion = (definedVariables, 
dfdlFormatString) => {
       },
       {
         item: 'xs:element name',
-        snippetString: '<xs:element name="$1"$0',
+        snippetString: '<' + nsPrefix + 'element name="$1"$0',
         markdownString: 'A new xs element',
       },
       {
         item: 'xs:element ref',
-        snippetString: '<xs:element ref="$1"$0',
+        snippetString: '<' + nsPrefix + 'element ref="$1"$0',
         markdownString: 'A new dfdl reference to an item',
       },
       {
         item: 'xs:group name',
-        snippetString: '<xs:group name = "$1">\n\t$0\n</xs:group>',
+        snippetString: '<' + nsPrefix + 'group name = "$1">\n\t$0\n</' + 
nsPrefix + 'group>',
       },
       {
         item: 'xs:group ref',
-        snippetString: '<xs:group ref="$1"$0',
+        snippetString: '<' + nsPrefix + 'group ref="$1"$0',
         markdownString: 'A new dfdl reference to an item',
       },
       {
         item: 'dfdl:assert',
-        snippetString: '<xs:annotation>\n\t<xs:appinfo 
source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:assert>"<$1>"</dfdl:assert>\n\t</xs:appinfo>\n</xs:annotation>$0',
+        snippetString: '<' + nsPrefix + 'annotation>\n\t<' + nsPrefix + 
'appinfo 
source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:assert>"<$1>"</dfdl:assert>\n\t</'
 + nsPrefix + 'appinfo>\n</' + nsPrefix + 'annotation>$0',
         markdownString: 'dfdl assertion test',
       },
       {
         item: 'dfdL:discriminator',
-        snippetString: '<xs:annotation>\n\t<xs:appinfo 
source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:discriminator 
test="{$1}"/>\n\t</xs:appinfo>\n</xs:annotation>$0',
+        snippetString: '<' + nsPrefix + 'annotation>\n\t<' + nsPrefix + 
'appinfo source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:discriminator 
test="{$1}"/>\n\t</' + nsPrefix + 'appinfo>\n</' + nsPrefix + 'annotation>$0',
         markdownString: 'dfdl discriminator test',
       },
       {
         item: 'dfdl:hiddenGroupRef',
-        snippetString: '<xs:sequence dfdl:hiddenGroupRef="$1"/>\n$0',
+        snippetString: '<' + nsPrefix + 'sequence 
dfdl:hiddenGroupRef="$1"/>\n$0',
       },
       {
         item: 'dfdl:format',
@@ -66,47 +66,47 @@ export const elementCompletion = (definedVariables, 
dfdlFormatString) => {
       },
       {
         item: 'xs:annotation',
-        snippetString: '<xs:annotation>\n\t<xs:appinfo 
source="http://www.ogf.org/dfdl/";>\n\t\t$0\n\t</xs:appinfo>\n</xs:annotation>',
+        snippetString: '<' + nsPrefix + 'annotation>\n\t<' + nsPrefix + 
'appinfo source="http://www.ogf.org/dfdl/";>\n\t\t$0\n\t</' + nsPrefix + 
'appinfo>\n</' + nsPrefix + 'annotation>',
       },
       {
         item: 'xs:appinfo',
-        snippetString: '<xs:annotation>\n\t<xs:appinfo 
source="http://www.ogf.org/dfdl/";>\n\t\t$0\n\t</xs:appinfo>\n</xs:annotation>',
+        snippetString: '<' + nsPrefix + 'annotation>\n\t<' + nsPrefix + 
'appinfo source="http://www.ogf.org/dfdl/";>\n\t\t$0\n\t</' + nsPrefix + 
'appinfo>\n</' + nsPrefix + 'annotation>',
       },
       {
         item: 'xs:complexType',
-        snippetString: '<xs:complexType>\n\t$0\n</xs:complexType>',
+        snippetString: '<' + nsPrefix + 'complexType>\n\t$0\n</' + nsPrefix + 
'complexType>',
         markdownString: 'Starts a complex type definition',
       },
       {
         item: 'xs:complexType name=',
-        snippetString: '<xs:complexType Name="$1">\n\t$0\n</xs:complexType>',
+        snippetString: '<' + nsPrefix + 'complexType Name="$1">\n\t$0\n</' + 
nsPrefix + 'complexType>',
         markdownString: 'Starts a complex type definition',
       },
       {
         item: 'xs:simpleType',
-        snippetString: '<xs:simpleType>\n\t$0\n</xs:simpleType>',
+        snippetString: '<' + nsPrefix + 'simpleType>\n\t$0\n</' + nsPrefix + 
'simpleType>',
         markdownString: 'Starts a simple type definition',
       },
       {
         item: 'xs:simpleType name=',
-        snippetString: '<xs:simpleType Name="$1"$0',
+        snippetString: '<' + nsPrefix + 'simpleType Name="$1"$0',
         markdownString: 'Starts a simple type definition',
       },
       {
         item: 'xs:sequence',
-        snippetString: '<xs:sequence',
+        snippetString: '<' + nsPrefix + 'sequence',
       },
       {
         item: 'xs:choice',
-        snippetString: '<xs:choice',
+        snippetString: '<' + nsPrefix + 'choice',
       },
       {
         item: 'dfdl:defineVariable',
-        snippetString: '<xs:annotation>\n\t<xs:appinfo 
source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:defineVariable name="$1"$0',
+        snippetString: '<' + nsPrefix + 'annotation>\n\t<' + nsPrefix + 
'appinfo source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:defineVariable 
name="$1"$0',
       },
       {
         item: 'dfdl:setVariable',
-        snippetString: '<xs:annotation>\n\t<xs:appinfo 
source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:setVariable ref="${1|' + 
definedVariables + '|}"$0',
+        snippetString: '<' + nsPrefix + 'annotation>\n\t<' + nsPrefix + 
'appinfo source="http://www.ogf.org/dfdl/";>\n\t\t<dfdl:setVariable ref="${1|' + 
definedVariables + '|}"$0',
       },
     ],
   }
diff --git a/src/language/providers/utils.ts b/src/language/providers/utils.ts
index 19979aa..0f2bc31 100644
--- a/src/language/providers/utils.ts
+++ b/src/language/providers/utils.ts
@@ -17,6 +17,8 @@
 
 import * as vscode from 'vscode'
 
+const schemaPrefixRegEx = new RegExp('</?(|[^ ]+:)schema')
+
 // Function to insert snippet to active editor
 export function insertSnippet(snippetString: string, backpos: vscode.Position) 
{
   vscode.window.activeTextEditor?.insertSnippet(
@@ -31,15 +33,11 @@ export function checkLastItemOpen(
   position: vscode.Position
 ) {
   var lineNum = position.line
-  const wholeLine = document
-    .lineAt(lineNum)
-    .text.substr(0, document.lineAt(lineNum).range.end.character)
+  const wholeLine = document.lineAt(lineNum).text
   while (wholeLine.length === 0) {
     --lineNum
   }
-  const previousLine = document
-    .lineAt(lineNum)
-    .text.substr(0, document.lineAt(lineNum - 1).range.end.character)
+  const previousLine = document.lineAt(lineNum).text
   if (
     previousLine.includes('</') ||
     previousLine.includes('/>') ||
@@ -61,15 +59,14 @@ export function lineCount(
 ) {
   var lineNum = position.line
   var lineCount = 0
+  const nsPrefix = getXsdNsPrefix(document, position)
   while (lineNum !== 0) {
     --lineNum
     ++lineCount
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substr(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
     if (
-      wholeLine.includes('<xs:element') &&
-      !wholeLine.includes('</xs:element') &&
+      wholeLine.includes('<' + nsPrefix + 'element') &&
+      !wholeLine.includes('</' + nsPrefix + 'element') &&
       !wholeLine.includes('/>')
     ) {
       return lineCount
@@ -83,10 +80,9 @@ export function nearestOpen(
   position: vscode.Position
 ) {
   var lineNum = position.line
+  const nsPrefix = getXsdNsPrefix(document, position)
   while (lineNum !== -1) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substring(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
     if (wholeLine.includes('element') && !wholeLine.includes('/>')) {
       if (checkElementOpen(document, position)) {
         return 'element'
@@ -101,8 +97,8 @@ export function nearestOpen(
       }
     } else if (wholeLine.includes('group')) {
       if (
-        wholeLine.includes('<xs:group') &&
-        !wholeLine.includes('</xs:group') &&
+        wholeLine.includes('<' + nsPrefix + 'group') &&
+        !wholeLine.includes('</' + nsPrefix + 'group') &&
         !wholeLine.includes('/>') &&
         !wholeLine.includes('/')
       ) {
@@ -135,25 +131,24 @@ export function checkElementOpen(
   document: vscode.TextDocument,
   position: vscode.Position
 ) {
+  const nsPrefix = getXsdNsPrefix(document, position)
   var lineNum = position.line
   while (lineNum !== -1) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substr(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
     if (
-      wholeLine.includes('<xs:element') &&
+      wholeLine.includes('<' + nsPrefix + 'element') &&
       (wholeLine.includes('>') ||
-        wholeLine.includes('</xs:element') ||
+        wholeLine.includes('</' + nsPrefix + 'element') ||
         wholeLine.includes('/>'))
     ) {
       return false
     }
-    if (wholeLine.includes('</xs:element>')) {
+    if (wholeLine.includes('</' + nsPrefix + 'element')) {
       return false
     }
     if (
-      wholeLine.includes('<xs:element') &&
-      !wholeLine.includes('</xs:element') &&
+      wholeLine.includes('<' + nsPrefix + 'element') &&
+      !wholeLine.includes('</' + nsPrefix + 'element') &&
       !wholeLine.includes('/>') &&
       !wholeLine.includes('>')
     ) {
@@ -168,21 +163,21 @@ export function checkSequenceOpen(
   document: vscode.TextDocument,
   position: vscode.Position
 ) {
+  const nsPrefix = getXsdNsPrefix(document, position)
   var lineNum = position.line
   while (lineNum !== 0) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substr(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
     if (
-      (wholeLine.includes('<xs:sequence') &&
-        (wholeLine.includes('</xs:sequence') || wholeLine.includes('/>'))) ||
-      wholeLine.includes('</xs:sequence>')
+      (wholeLine.includes('<' + nsPrefix + 'sequence') &&
+        (wholeLine.includes('</' + nsPrefix + 'sequence') ||
+          wholeLine.includes('/>'))) ||
+      wholeLine.includes('</' + nsPrefix + 'sequence>')
     ) {
       return false
     }
     if (
-      wholeLine.includes('<xs:sequence') &&
-      !wholeLine.includes('</xs:sequence') &&
+      wholeLine.includes('<' + nsPrefix + 'sequence') &&
+      !wholeLine.includes('</' + nsPrefix + 'sequence') &&
       !wholeLine.includes('/>')
     ) {
       return true
@@ -196,21 +191,21 @@ export function checkChoiceOpen(
   document: vscode.TextDocument,
   position: vscode.Position
 ) {
+  const nsPrefix = getXsdNsPrefix(document, position)
   var lineNum = position.line
   while (lineNum !== 0) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substr(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
     if (
-      (wholeLine.includes('<xs:choice') &&
-        (wholeLine.includes('</xs:choice') || wholeLine.includes('/>'))) ||
-      wholeLine.includes('</xs:choice>')
+      (wholeLine.includes('<' + nsPrefix + 'choice') &&
+        (wholeLine.includes('</' + nsPrefix + 'choice') ||
+          wholeLine.includes('/>'))) ||
+      wholeLine.includes('</' + nsPrefix + 'choice>')
     ) {
       return false
     }
     if (
-      wholeLine.includes('<xs:choice') &&
-      !wholeLine.includes('</xs:choice') &&
+      wholeLine.includes('<' + nsPrefix + 'choice') &&
+      !wholeLine.includes('</' + nsPrefix + 'choice') &&
       !wholeLine.includes('/>')
     ) {
       return true
@@ -223,15 +218,13 @@ export function checkSimpleTypeOpen(
   document: vscode.TextDocument,
   position: vscode.Position
 ) {
+  const nsPrefix = getXsdNsPrefix(document, position)
   var lineNum = position.line
   while (lineNum !== 0) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substr(0, document.lineAt(lineNum).range.end.character)
-
+    const wholeLine = document.lineAt(lineNum).text
     if (
-      wholeLine.includes('<xs:simpleType') &&
-      !wholeLine.includes('</xs:simpleType') &&
+      wholeLine.includes('<' + nsPrefix + 'simpleType') &&
+      !wholeLine.includes('</' + nsPrefix + 'simpleType') &&
       !wholeLine.includes('/>')
     ) {
       return true
@@ -247,9 +240,7 @@ export function checkDefineVariableOpen(
 ) {
   var lineNum = position.line
   while (lineNum !== 0) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substr(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
     if (
       wholeLine.includes('<dfdl:defineVariable') &&
       !wholeLine.includes('</dfdl:defineVariable') &&
@@ -268,9 +259,7 @@ export function checkSetVariableOpen(
 ) {
   var lineNum = position.line
   while (lineNum !== 0) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substr(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
     if (
       wholeLine.includes('<dfdl:setVariable') &&
       !wholeLine.includes('</dfdl:setVariable') &&
@@ -283,6 +272,26 @@ export function checkSetVariableOpen(
   return false
 }
 
+//returns an empty value or a prefix plus a colon
+export function getXsdNsPrefix(
+  document: vscode.TextDocument,
+  position: vscode.Position
+) {
+  var initialLineNum = position.line
+  var lineNum = 0
+  while (initialLineNum !== 0 && lineNum <= initialLineNum) {
+    const lineText = document.lineAt(lineNum).text
+    // returns either empty prefix value or a prefix plus a colon
+    let text = lineText.match(schemaPrefixRegEx)
+    if (text != null) {
+      return text[1]
+    }
+    ++lineNum
+  }
+  //returns the standard prefix plus a colon in the case of missing schema tag
+  return 'xs:'
+}
+
 export function checkBraceOpen(
   document: vscode.TextDocument,
   position: vscode.Position
@@ -290,9 +299,8 @@ export function checkBraceOpen(
   var lineNum = position.line
 
   while (lineNum !== 0) {
-    const wholeLine = document
-      .lineAt(lineNum)
-      .text.substring(0, document.lineAt(lineNum).range.end.character)
+    const wholeLine = document.lineAt(lineNum).text
+    //.text.substring(0, document.lineAt(lineNum).range.end.character)
 
     if (
       wholeLine.includes('"{') &&
diff --git a/src/tests/suite/language/items.test.ts 
b/src/tests/suite/language/items.test.ts
index 5198439..55de964 100644
--- a/src/tests/suite/language/items.test.ts
+++ b/src/tests/suite/language/items.test.ts
@@ -85,7 +85,7 @@ suite('Items Test Suite', () => {
   })
 
   test('all elementItems available', async () => {
-    elementCompletion('', '').items.forEach((item) => {
+    elementCompletion('', '', '').items.forEach((item) => {
       assert.strictEqual(expectedElementItems.includes(item.item), true)
     })
   })

Reply via email to