Skip to content

Commit

Permalink
Merge branch 'master' into fix/ai-contirbution
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayhospete authored Nov 27, 2024
2 parents 8499980 + cb055b0 commit d072fe8
Show file tree
Hide file tree
Showing 67 changed files with 1,100 additions and 85 deletions.
22 changes: 22 additions & 0 deletions packages/binding/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# @ui5-language-assistant/binding

## 1.0.36

### Patch Changes

- 3abf9a6: feat: User settings to control diagnostics reporting cross view files
- Updated dependencies [3abf9a6]
- @ui5-language-assistant/xml-views-completion@4.0.31
- @ui5-language-assistant/settings@4.0.10
- @ui5-language-assistant/context@4.0.31
- @ui5-language-assistant/logger@0.0.2
- @ui5-language-assistant/logic-utils@4.0.21
- @ui5-language-assistant/xml-views-validation@4.0.25

## 1.0.35

### Patch Changes

- Updated dependencies [6fe3662]
- @ui5-language-assistant/context@4.0.30
- @ui5-language-assistant/xml-views-validation@4.0.24
- @ui5-language-assistant/xml-views-completion@4.0.30

## 1.0.34

### Patch Changes
Expand Down
16 changes: 8 additions & 8 deletions packages/binding/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5-language-assistant/binding",
"version": "1.0.34",
"version": "1.0.36",
"private": true,
"description": "UI5 LSP server extension for binding",
"keywords": [],
Expand All @@ -16,20 +16,20 @@
"license": "Apache-2.0",
"dependencies": {
"@ui5-language-assistant/binding-parser": "1.0.7",
"@ui5-language-assistant/logger": "0.0.1",
"@ui5-language-assistant/context": "4.0.29",
"@ui5-language-assistant/logic-utils": "4.0.20",
"@ui5-language-assistant/xml-views-completion": "4.0.29",
"@ui5-language-assistant/xml-views-validation": "4.0.23",
"@ui5-language-assistant/settings": "4.0.9",
"@ui5-language-assistant/logger": "0.0.2",
"@ui5-language-assistant/context": "4.0.31",
"@ui5-language-assistant/logic-utils": "4.0.21",
"@ui5-language-assistant/xml-views-completion": "4.0.31",
"@ui5-language-assistant/xml-views-validation": "4.0.25",
"@ui5-language-assistant/settings": "4.0.10",
"deep-freeze-strict": "1.1.1",
"lodash": "4.17.21"
},
"devDependencies": {
"@sap-ux/vocabularies-types": "0.10.14",
"@types/lodash": "4.14.168",
"@ui5-language-assistant/semantic-model-types": "4.0.11",
"@ui5-language-assistant/test-framework": "4.0.12",
"@ui5-language-assistant/test-framework": "4.0.13",
"@ui5-language-assistant/test-utils": "4.0.16",
"@xml-tools/ast": "5.0.0",
"@xml-tools/parser": "1.0.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe("aggregation binding", () => {
server: "off",
},
SplitAttributesOnFormat: true,
LimitUniqueIdDiagnostics: false,
};

beforeAll(async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe("index", () => {
server: "off",
},
SplitAttributesOnFormat: true,
LimitUniqueIdDiagnostics: false,
};

beforeAll(async function () {
Expand Down
16 changes: 16 additions & 0 deletions packages/context/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## 4.0.31

### Patch Changes

- 3abf9a6: feat: User settings to control diagnostics reporting cross view files
- Updated dependencies [3abf9a6]
- @ui5-language-assistant/settings@4.0.10
- @ui5-language-assistant/logger@0.0.2
- @ui5-language-assistant/logic-utils@4.0.21

## 4.0.30

### Patch Changes

- 6fe3662: fix: lsp for adaption project - first iteration

## 4.0.29

### Patch Changes
Expand Down
1 change: 1 addition & 0 deletions packages/context/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export type {
ManifestDetails,
YamlDetails,
ProjectKind,
ControlIdLocation,
} from "./src/types";
export type { Manifest } from "@sap-ux/project-access";
10 changes: 5 additions & 5 deletions packages/context/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5-language-assistant/context",
"version": "4.0.29",
"version": "4.0.31",
"private": true,
"description": "A context for an xml file",
"keywords": [],
Expand All @@ -19,9 +19,9 @@
"@sap-ux/annotation-converter": "0.5.20",
"@sap-ux/edmx-parser": "0.5.13",
"@sap-ux/project-access": "1.25.5",
"@ui5-language-assistant/logger": "0.0.1",
"@ui5-language-assistant/logic-utils": "4.0.20",
"@ui5-language-assistant/settings": "4.0.9",
"@ui5-language-assistant/logger": "0.0.2",
"@ui5-language-assistant/logic-utils": "4.0.21",
"@ui5-language-assistant/settings": "4.0.10",
"@ui5-language-assistant/constant": "0.0.1",
"fs-extra": "10.1.0",
"globby": "11.1.0",
Expand All @@ -40,7 +40,7 @@
"@types/node-fetch": "2.5.10",
"@types/semver": "7.3.12",
"@ui5-language-assistant/semantic-model-types": "4.0.11",
"@ui5-language-assistant/test-framework": "4.0.12",
"@ui5-language-assistant/test-framework": "4.0.13",
"@ui5-language-assistant/test-utils": "4.0.16",
"rimraf": "3.0.2",
"tmp-promise": "3.0.2",
Expand Down
11 changes: 11 additions & 0 deletions packages/context/src/adp-manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import findUp from "find-up";
import { FileName } from "@sap-ux/project-access";
/**
* Get path of a manifest.appdescr_variant file for adaption project.
* @param documentPath path to a file e.g. absolute/path/webapp/ext/main/Main.view.xml
*/
export async function finAdpdManifestPath(
documentPath: string
): Promise<string | undefined> {
return findUp(FileName.ManifestAppDescrVar, { cwd: documentPath });
}
11 changes: 9 additions & 2 deletions packages/context/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
getManifestDetails,
getUI5Manifest,
} from "./manifest";
import { finAdpdManifestPath } from "./adp-manifest";
import { getServices } from "./services";
import { Context } from "./types";
import { getSemanticModel } from "./ui5-model";
Expand Down Expand Up @@ -47,7 +48,8 @@ export async function getContext(
): Promise<Context | Error> {
try {
const manifestDetails = await getManifestDetails(documentPath);
const manifest = await getUI5Manifest(manifestDetails.manifestPath);
let manifestPath = manifestDetails.manifestPath;
const manifest = await getUI5Manifest(manifestPath);
let minUI5Version = manifestDetails.minUI5Version;
if (manifest) {
minUI5Version = getMinimumUI5Version(manifest);
Expand All @@ -61,7 +63,12 @@ export async function getContext(
);
const services = await getServices(documentPath);
const customViewId = await getCustomViewId(documentPath);
const manifestPath = manifestDetails.manifestPath;
if (!manifestPath) {
const adpManifestPath = await finAdpdManifestPath(documentPath);
if (adpManifestPath) {
manifestPath = adpManifestPath;
}
}
const viewFiles = await getViewFiles({
manifestPath,
documentPath,
Expand Down
10 changes: 9 additions & 1 deletion packages/context/src/utils/view-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ export async function getViewFiles(param: {
}

const files = {};
await processViewFiles(join(manifestPath, ".."), files);
if (!manifestPath) {
// a project without manifest.json or manifest.appdescr_variant file. Only support for current view file
const ast = await createDocumentAst(documentPath);
files[documentPath] = ast;
} else {
// find all view files
await processViewFiles(join(manifestPath, ".."), files);
}

cache.setViewFiles(manifestPath, files);
return files;
}
55 changes: 55 additions & 0 deletions packages/context/test/unit/adp-manifest.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { join } from "path";
import {
Config,
ProjectName,
ProjectType,
TestFramework,
} from "@ui5-language-assistant/test-framework";
import { finAdpdManifestPath } from "../../src/adp-manifest";

describe("adp-manifest", () => {
let framework: TestFramework;
beforeAll(function () {
const useConfig: Config = {
projectInfo: {
name: ProjectName.cap,
type: ProjectType.CAP,
npmInstall: true,
},
};
framework = new TestFramework(useConfig);
});

afterEach(() => {
jest.restoreAllMocks();
});
describe("finAdpdManifestPath", () => {
beforeAll(function () {
const useConfig: Config = {
projectInfo: {
name: ProjectName.adp,
type: ProjectType.ADP,
npmInstall: false,
},
};
framework = new TestFramework(useConfig);
});
it("undefined", async () => {
const root = framework.getProjectRoot();
const result = await finAdpdManifestPath(root);
expect(result).toBeUndefined();
});
it("path to manifest.appdescr_variant file", async () => {
const root = framework.getProjectRoot();
const pathSegments = [
"webapp",
"changes",
"fragments",
"actionToolbar.fragment.xml",
];
const docPath = join(root, ...pathSegments);
const result = await finAdpdManifestPath(docPath);
expect(result).toEqual(join(root, "webapp", "manifest.appdescr_variant"));
});
});
});
5 changes: 5 additions & 0 deletions packages/context/test/unit/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as manifest from "../../src/manifest";
import * as adpManifest from "../../src/adp-manifest";
import * as ui5Yaml from "../../src/ui5-yaml";
import * as ui5Model from "../../src/ui5-model";
import * as services from "../../src/services";
Expand Down Expand Up @@ -51,6 +52,9 @@ describe("context", () => {
const getServicesStub = jest
.spyOn(services, "getServices")
.mockResolvedValue({});
const finAdpdManifestPathStub = jest
.spyOn(adpManifest, "finAdpdManifestPath")
.mockResolvedValue("/path/to/app/variant");
const getViewFilesStub = jest
.spyOn(viewFiles, "getViewFiles")
.mockResolvedValue({});
Expand All @@ -67,6 +71,7 @@ describe("context", () => {
expect(getYamlDetailsStub).toHaveBeenCalled();
expect(getSemanticModelStub).toHaveBeenCalled();
expect(getServicesStub).toHaveBeenCalled();
expect(finAdpdManifestPathStub).toHaveBeenCalled();
expect(getViewFilesStub).toHaveBeenCalled();
expect(getControlIdsStub).toHaveBeenCalled();
expect(result).toContainAllKeys([
Expand Down
8 changes: 6 additions & 2 deletions packages/context/test/unit/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import * as manifest from "../../src/manifest";
import * as projectUtils from "../../src/utils/project";
import { cache } from "../../src/cache";
import { Manifest } from "@sap-ux/project-access";
import { ProjectKind, UI5_PROJECT_TYPE } from "../../src/types";
import {
ProjectKind,
UI5_PROJECT_TYPE,
ProjectType as ProjType,
} from "../../src/types";
import { getProjectData } from "./utils";
import { getManifestDetails, getUI5Manifest } from "../../src/manifest";
import { getApp } from "../../src/loader";
Expand Down Expand Up @@ -156,7 +160,7 @@ describe("loader", () => {
projectRoot
);
const projectInfo = { kind: "Java", type: "CAP" } as {
type: ProjectType;
type: ProjType;
kind: ProjectKind;
};
const capProject = await loader.getCAPProject(
Expand Down
19 changes: 19 additions & 0 deletions packages/context/test/unit/utils/view-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,23 @@ describe("view-files", () => {
expect(Object.keys(viewFiles).length).toBeGreaterThan(1);
expect(viewFiles[documentPath]).toBeDefined();
});
it("get view files - no manifest path", async () => {
// arrange
cache.reset();
const getViewFilesStub = jest
.spyOn(cache, "getViewFiles")
.mockReturnValue({});
const projectRoot = testFramework.getProjectRoot();
const documentPath = getDocumentPath(projectRoot);
const manifestPath = "";
// act
const viewFiles = await getViewFiles({
manifestPath,
documentPath,
});
// assert
expect(getViewFilesStub).toHaveBeenCalledTimes(1);
expect(Object.keys(viewFiles).length).toEqual(1);
expect(viewFiles[documentPath]).toBeDefined();
});
});
20 changes: 20 additions & 0 deletions packages/fe/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## 4.0.35

### Patch Changes

- 3abf9a6: feat: User settings to control diagnostics reporting cross view files
- Updated dependencies [3abf9a6]
- @ui5-language-assistant/xml-views-completion@4.0.31
- @ui5-language-assistant/context@4.0.31
- @ui5-language-assistant/logic-utils@4.0.21
- @ui5-language-assistant/xml-views-validation@4.0.25

## 4.0.34

### Patch Changes

- Updated dependencies [6fe3662]
- @ui5-language-assistant/context@4.0.30
- @ui5-language-assistant/xml-views-validation@4.0.24
- @ui5-language-assistant/xml-views-completion@4.0.30

## 4.0.33

### Patch Changes
Expand Down
12 changes: 6 additions & 6 deletions packages/fe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5-language-assistant/fe",
"version": "4.0.33",
"version": "4.0.35",
"private": true,
"description": "UI5 LSP server extension for annotation relevant building blocks",
"keywords": [],
Expand All @@ -16,18 +16,18 @@
"license": "Apache-2.0",
"typings": "./api.d.ts",
"dependencies": {
"@ui5-language-assistant/context": "4.0.29",
"@ui5-language-assistant/logic-utils": "4.0.20",
"@ui5-language-assistant/xml-views-completion": "4.0.29",
"@ui5-language-assistant/xml-views-validation": "4.0.23",
"@ui5-language-assistant/context": "4.0.31",
"@ui5-language-assistant/logic-utils": "4.0.21",
"@ui5-language-assistant/xml-views-completion": "4.0.31",
"@ui5-language-assistant/xml-views-validation": "4.0.25",
"deep-freeze-strict": "1.1.1",
"lodash": "4.17.21"
},
"devDependencies": {
"@sap-ux/vocabularies-types": "0.10.14",
"@types/lodash": "4.14.168",
"@ui5-language-assistant/semantic-model-types": "4.0.11",
"@ui5-language-assistant/test-framework": "4.0.12",
"@ui5-language-assistant/test-framework": "4.0.13",
"@ui5-language-assistant/test-utils": "4.0.16",
"@xml-tools/ast": "5.0.0",
"@xml-tools/parser": "1.0.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe("contextPath attribute value completion", () => {
server: "off",
},
SplitAttributesOnFormat: true,
LimitUniqueIdDiagnostics: false,
};

const annotationSnippetCDS = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe("filterBar id attribute value completion", () => {
server: "off",
},
SplitAttributesOnFormat: true,
LimitUniqueIdDiagnostics: false,
};

const annotationSnippetCDS = `
Expand Down
Loading

0 comments on commit d072fe8

Please sign in to comment.