Skip to content

Commit

Permalink
fix: file uri for windows (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayhospete authored Aug 23, 2024
1 parent b41ed5f commit f6680ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .changeset/thick-trains-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@ui5-language-assistant/xml-views-validation": patch
"@ui5-language-assistant/language-server": patch
"vscode-ui5-language-assistant": patch
"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch
---

fix: file uri for windows
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const url = require("url");
const vscodeUri = require("vscode-uri");

const controlIds = new Map();

controlIds.set("OOPS", [
{
uri: url.pathToFileURL("").toString(),
uri: vscodeUri.URI.file("").toString(),
range: {
start: { line: 3, character: 11 },
end: { line: 3, character: 17 },
},
offsetRange: { start: 79, end: 84 },
},
{
uri: url.pathToFileURL("").toString(),
uri: vscodeUri.URI.file("").toString(),
range: {
start: { line: 5, character: 13 },
end: { line: 5, character: 19 },
Expand Down
3 changes: 2 additions & 1 deletion packages/xml-views-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"@xml-tools/ast": "5.0.0",
"@xml-tools/common": "0.1.2",
"deep-freeze-strict": "1.1.1",
"lodash": "4.17.21"
"lodash": "4.17.21",
"vscode-uri": "2.1.2"
},
"devDependencies": {
"@ui5-language-assistant/semantic-model": "4.0.18",
Expand Down
4 changes: 2 additions & 2 deletions packages/xml-views-validation/src/validators/non-unique-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
} from "@ui5-language-assistant/user-facing-text";
import { NonUniqueIDIssue } from "../../api";
import { Context } from "@ui5-language-assistant/context";
import { pathToFileURL } from "url";
import { URI } from "vscode-uri";

const { NON_UNIQUE_ID } = validations;

export function validateNonUniqueID(context: Context): NonUniqueIDIssue[] {
const allIDsIssues: NonUniqueIDIssue[] = [];
const uri = pathToFileURL(context.documentPath).toString();
const uri = URI.file(context.documentPath).toString();
for (const [key, value] of context.controlIds) {
if (value.length > 1) {
const currentDocIssues = value.filter((i) => i.uri === uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
OffsetRange,
} from "@ui5-language-assistant/logic-utils";
import { Range } from "vscode-languageserver-types";
import { pathToFileURL } from "url";
import { URI } from "vscode-uri";

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

0 comments on commit f6680ca

Please sign in to comment.