Skip to content

Commit

Permalink
Merge branch 'master' into fix/readmefile
Browse files Browse the repository at this point in the history
  • Loading branch information
marufrasully authored Apr 10, 2024
2 parents 3b807b7 + a6a6b07 commit 1cd7832
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 48 deletions.
7 changes: 7 additions & 0 deletions packages/language-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 4.0.46

### Patch Changes

- Updated dependencies [5b190da]
- @ui5-language-assistant/xml-views-definition@0.0.3

## 4.0.45

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/language-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5-language-assistant/language-server",
"version": "4.0.45",
"version": "4.0.46",
"private": true,
"description": "UI5 Language Server",
"keywords": [
Expand All @@ -25,7 +25,7 @@
"node": ">=10.0.0"
},
"dependencies": {
"@ui5-language-assistant/xml-views-definition": "0.0.2",
"@ui5-language-assistant/xml-views-definition": "0.0.3",
"@ui5-language-assistant/binding": "1.0.28",
"@sap/swa-for-sapbas-vsx": "1.1.9",
"@ui5-language-assistant/logger": "0.0.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/vscode-ui5-language-assistant-bas-ext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 4.0.58

### Patch Changes

- 5b190da: Fix: Use file uri for definition

## 4.0.57

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode-ui5-language-assistant-bas-ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext",
"description": "A wrapper module for BAS simple extension around Language Support For SAPUI5",
"license": "Apache-2.0",
"version": "4.0.57",
"version": "4.0.58",
"private": false,
"repository": {
"type": "git",
Expand All @@ -13,7 +13,7 @@
},
"devDependencies": {
"fs-extra": "10.1.0",
"vscode-ui5-language-assistant": "4.0.57"
"vscode-ui5-language-assistant": "4.0.58"
},
"files": [
"*.vsix",
Expand Down
7 changes: 7 additions & 0 deletions packages/vscode-ui5-language-assistant/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 4.0.58

### Patch Changes

- 5b190da: Fix: Use file uri for definition
- @ui5-language-assistant/language-server@4.0.46

## 4.0.57

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode-ui5-language-assistant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "UI5 Language Assistant",
"private": true,
"description": "Language Support For SAPUI5",
"version": "4.0.57",
"version": "4.0.58",
"publisher": "SAPOSS",
"icon": "resources/ui5-language-assistant.png",
"keywords": [
Expand Down Expand Up @@ -155,7 +155,7 @@
"update:schema": "ts-node --project tsconfig.cli.json scripts/manifest/run-update.ts"
},
"dependencies": {
"@ui5-language-assistant/language-server": "4.0.45",
"@ui5-language-assistant/language-server": "4.0.46",
"vscode-languageclient": "8.0.2",
"@prettier/plugin-xml": "2.2.0",
"prettier": "2.8.7"
Expand Down
6 changes: 6 additions & 0 deletions packages/xml-views-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ui5-language-assistant/xml-views-definition

## 0.0.3

### Patch Changes

- 5b190da: Fix: Use file uri for definition

## 0.0.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/xml-views-definition/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5-language-assistant/xml-views-definition",
"version": "0.0.2",
"version": "0.0.3",
"private": true,
"description": "Definition logic for UI5 XML-Views",
"keywords": [],
Expand Down
16 changes: 4 additions & 12 deletions packages/xml-views-definition/src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,15 @@ export async function getControllerLocation(
if (!fileUri) {
return [];
}
return [
{
uri: fileUri,
range: { start: position, end: position },
},
];
const loc = Location.create(fileUri, { start: position, end: position });
return [loc];
}

// handle dot notation
const fileUri = await buildFileUri(id, value, manifestPath, exts);
if (!fileUri) {
return [];
}
return [
{
uri: fileUri,
range: { start: position, end: position },
},
];
const loc = Location.create(fileUri, { start: position, end: position });
return [loc];
}
3 changes: 2 additions & 1 deletion packages/xml-views-definition/src/utils/file.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { access, constants } from "fs";
import { join, dirname } from "path";
import { URI } from "vscode-uri";

/**
* Check if path exists on file system.
Expand Down Expand Up @@ -44,7 +45,7 @@ export async function buildFileUri(
for (const ext of exts) {
const filePath = `${absolutePath}${ext}`;
if (await pathExists(filePath)) {
return filePath;
return URI.file(filePath).toString();
}
}
}
29 changes: 17 additions & 12 deletions packages/xml-views-definition/test/unit/controller/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as fs from "fs";
import * as context from "@ui5-language-assistant/context";
import { getControllerLocation } from "../../../src/controller";
import { join } from "path";
import { URI } from "vscode-uri";

describe("index", () => {
let testFramework: TestFramework;
Expand Down Expand Up @@ -173,12 +174,14 @@ describe("index", () => {
// assert
expect(result).toEqual([
{
uri: join(
testFramework.getProjectRoot(),
"src",
"controller",
"App.controller.ts"
),
uri: URI.file(
join(
testFramework.getProjectRoot(),
"src",
"controller",
"App.controller.ts"
)
).toString(),
range: { start: position, end: position },
},
]);
Expand Down Expand Up @@ -281,12 +284,14 @@ describe("index", () => {
// assert
expect(result).toEqual([
{
uri: join(
testFramework.getProjectRoot(),
"src",
"controller",
"App.controller.ts"
),
uri: URI.file(
join(
testFramework.getProjectRoot(),
"src",
"controller",
"App.controller.ts"
)
).toString(),
range: { start: position, end: position },
},
]);
Expand Down
32 changes: 16 additions & 16 deletions packages/xml-views-definition/test/unit/utils/file.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { pathExists, buildFileUri } from "../../../src/utils";
import { join } from "path";
import { URI } from "vscode-uri";
const getExpectedFileUri = (parts: string[]) =>
URI.file(join(__dirname, ...parts)).toString();

describe("file", () => {
describe("pathExists", () => {
Expand Down Expand Up @@ -27,13 +30,12 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.App";
const expectedFileUri = join(
__dirname,
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"App.controller.js"
);
"App.controller.js",
]);
// act
const result = await buildFileUri(
namespace,
Expand All @@ -48,13 +50,12 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.AppHelper";
const expectedFileUri = join(
__dirname,
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"AppHelper.js"
);
"AppHelper.js",
]);
// act
const result = await buildFileUri(
namespace,
Expand All @@ -70,13 +71,12 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.Helper";
const expectedFileUri = join(
__dirname,
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"Helper.controller.ts"
);
"Helper.controller.ts",
]);
// act
const result = await buildFileUri(
namespace,
Expand All @@ -91,13 +91,13 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.Handler";
const expectedFileUri = join(
__dirname,
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"Handler.ts"
);
"Handler.ts",
]);

// act
const result = await buildFileUri(
namespace,
Expand Down

0 comments on commit 1cd7832

Please sign in to comment.