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: use json api #626

Merged
merged 13 commits into from
Jul 11, 2023
Merged

fix: use json api #626

merged 13 commits into from
Jul 11, 2023

Conversation

marufrasully
Copy link
Contributor

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Jun 26, 2023

🦋 Changeset detected

Latest commit: dd60fd6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext Patch
vscode-ui5-language-assistant Patch
@ui5-language-assistant/semantic-model-types Patch
@ui5-language-assistant/test-utils Patch
@ui5-language-assistant/binding-parser Patch
@ui5-language-assistant/binding Patch
@ui5-language-assistant/semantic-model Patch
@ui5-language-assistant/context Patch
@ui5-language-assistant/fe Patch
@ui5-language-assistant/language-server Patch
@ui5-language-assistant/logic-utils Patch
@ui5-language-assistant/xml-views-tooltip Patch
@ui5-language-assistant/xml-views-validation Patch
@ui5-language-assistant/xml-views-quick-fix Patch
@ui5-language-assistant/xml-views-completion Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@marufrasully marufrasully marked this pull request as ready for review June 26, 2023 15:43
@marufrasully marufrasully changed the title Fix/25141/semantic model fix: use json api Jun 26, 2023
packages/binding-parser/src/lexer/token.ts Show resolved Hide resolved
kind: "string",
default: {
values: [
"sap.ui.model.BindingMode.Default",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this information in the semantic model, I don't think we should hard code it here.

export interface Dependents {
name: BindingInfoName;
type: PropertyType[];
}
export interface PropertyType {
kind: TypeKind;
kind: string;
default?: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default seems a bit misleading here. It's a list of "all" possible values, not the one that would be used in case there is no other value.

PropertyType,
TypeKind,
} from "../types";
const buildType = (property: UI5TypedefProp): PropertyType[] => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part seems to be essentially the same - It's still is hardcoded against a specific list of properties.

@@ -41,6 +41,7 @@ export function generate({
model.version = version;
model.isFallback = isFallback;
model.isIncorrectVersion = isIncorrectVersion;
addTypedefType(model);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why couldn't we use similar logic to class properties?

@@ -298,3 +298,88 @@ const typesToIgnore: Record<string, undefined> = {
function ignoreType(typeName: string): boolean {
return has(typesToIgnore, typeName);
}

export function resolveTypeDefPropertyType(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very similar to resolveType. We should have only one function for resolving types unless there is a good reason to have multiple. As far as I know all type strings should have the same structure and should be processed the same way.

@@ -78,6 +78,7 @@ export interface UI5Namespace extends BaseUI5Node {
export interface UI5Typedef extends BaseUI5Node {
kind: "UI5Typedef";
properties: UI5TypedefProp[];
symbolProperties: (Ui5Property | ObjProperty)[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid adding temporary data into the model, because it adds additional clutter and confusion which of the similar properties should be used.

@sonarcloud
Copy link

sonarcloud bot commented Jul 11, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 13 Code Smells

92.9% 92.9% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@marufrasully marufrasully merged commit 9df89eb into master Jul 11, 2023
8 of 9 checks passed
@marufrasully marufrasully deleted the fix/25141/semantic-model branch July 11, 2023 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants