stevedlawrence commented on code in PR #294:
URL: https://github.com/apache/daffodil-vscode/pull/294#discussion_r973151524
##########
src/language/providers/utils.ts:
##########
@@ -283,6 +293,31 @@ 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.substr(0, document.lineAt(lineNum).range.end.character)
+ // returns either empty prefix value or a prefix plus a colon
+ if (lineText.includes('schema')) {
Review Comment:
That shouldn't match the regex and should return null and so not return.
Running a small test, this outputs `null` for me:
```js
const regex = new RegExp('</?(|[^ ]+:)schema');
const str = '<?xml version="1.0" encoding="UTF-8"?>';
console.log(str.match(regex))
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]