Skip to content

Commit f6680ca

Browse files
authored
fix: file uri for windows (#728)
1 parent b41ed5f commit f6680ca

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

.changeset/thick-trains-doubt.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@ui5-language-assistant/xml-views-validation": patch
3+
"@ui5-language-assistant/language-server": patch
4+
"vscode-ui5-language-assistant": patch
5+
"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch
6+
---
7+
8+
fix: file uri for windows

packages/language-server/test/unit/snapshots/xml-view-diagnostics/non-unique-id/options.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
const url = require("url");
1+
const vscodeUri = require("vscode-uri");
22

33
const controlIds = new Map();
44

55
controlIds.set("OOPS", [
66
{
7-
uri: url.pathToFileURL("").toString(),
7+
uri: vscodeUri.URI.file("").toString(),
88
range: {
99
start: { line: 3, character: 11 },
1010
end: { line: 3, character: 17 },
1111
},
1212
offsetRange: { start: 79, end: 84 },
1313
},
1414
{
15-
uri: url.pathToFileURL("").toString(),
15+
uri: vscodeUri.URI.file("").toString(),
1616
range: {
1717
start: { line: 5, character: 13 },
1818
end: { line: 5, character: 19 },

packages/xml-views-validation/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"@xml-tools/ast": "5.0.0",
3131
"@xml-tools/common": "0.1.2",
3232
"deep-freeze-strict": "1.1.1",
33-
"lodash": "4.17.21"
33+
"lodash": "4.17.21",
34+
"vscode-uri": "2.1.2"
3435
},
3536
"devDependencies": {
3637
"@ui5-language-assistant/semantic-model": "4.0.18",

packages/xml-views-validation/src/validators/non-unique-id.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import {
55
} from "@ui5-language-assistant/user-facing-text";
66
import { NonUniqueIDIssue } from "../../api";
77
import { Context } from "@ui5-language-assistant/context";
8-
import { pathToFileURL } from "url";
8+
import { URI } from "vscode-uri";
99

1010
const { NON_UNIQUE_ID } = validations;
1111

1212
export function validateNonUniqueID(context: Context): NonUniqueIDIssue[] {
1313
const allIDsIssues: NonUniqueIDIssue[] = [];
14-
const uri = pathToFileURL(context.documentPath).toString();
14+
const uri = URI.file(context.documentPath).toString();
1515
for (const [key, value] of context.controlIds) {
1616
if (value.length > 1) {
1717
const currentDocIssues = value.filter((i) => i.uri === uri);

packages/xml-views-validation/test/unit/validators/non-unique-id.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
OffsetRange,
1818
} from "@ui5-language-assistant/logic-utils";
1919
import { Range } from "vscode-languageserver-types";
20-
import { pathToFileURL } from "url";
20+
import { URI } from "vscode-uri";
2121

2222
const { NON_UNIQUE_ID } = validations;
2323
let testFramework: TestFramework;
@@ -293,7 +293,7 @@ describe("the use of non unique id validation", () => {
293293
const ranges = getIdRanges(
294294
context.viewFiles[customSectionPath].rootElement?.subElements ?? []
295295
);
296-
const customSectionUri = pathToFileURL(customSectionPath).toString();
296+
const customSectionUri = URI.file(customSectionPath).toString();
297297
const identicalIDsRanges = ranges.map((range) => ({
298298
uri: customSectionUri,
299299
range,

0 commit comments

Comments
 (0)