Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: file uri for windows #728

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading