Skip to content

Commit

Permalink
fix: add seprator in doc and remove visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
marufrasully committed Aug 8, 2023
1 parent 342e554 commit 0f41b5d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 71 deletions.
2 changes: 1 addition & 1 deletion packages/binding/src/definition/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "../types";
import { ui5NodeToFQN } from "@ui5-language-assistant/logic-utils";
import { forOwn } from "lodash";
import { getDocumentation } from "../services/completion/providers/documentation";
import { getDocumentation } from "../utils";
import { fallBackElements } from "./fall-back-definition";

const isBindingInfoName = (name: string): name is BindingInfoName => {
Expand Down
4 changes: 2 additions & 2 deletions packages/binding/src/services/hover/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { Position } from "vscode-languageserver-types";
import { BindContext } from "../../types";
import { PROPERTY_BINDING_INFO } from "../../constant";
import { getDocumentation } from "../completion/providers/documentation";
import { getDocumentation } from "../../utils";
import { UI5Typedef } from "@ui5-language-assistant/semantic-model-types";

const getHoverFromBinding = (
Expand Down Expand Up @@ -46,7 +46,7 @@ const getHoverFromBinding = (
(prop) => prop.name === element.key?.originalText
);
if (property) {
return { contents: getDocumentation(context, property) };
return { contents: getDocumentation(context, property, true) };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
UI5Type,
UI5TypedefProp,
} from "@ui5-language-assistant/semantic-model-types";
import { BindContext } from "../../../types";
import { BindContext } from "../types";
import { MarkupKind } from "vscode-languageserver-types";
import { ui5NodeToFQN, getLink } from "@ui5-language-assistant/logic-utils";
import { PROPERTY_BINDING_INFO } from "../../../constant";
import { PROPERTY_BINDING_INFO } from "../constant";

const getType = (type: UI5Type | undefined): string[] => {
const result: string[] = [];
Expand Down Expand Up @@ -37,7 +37,8 @@ const getType = (type: UI5Type | undefined): string[] => {

export const getDocumentation = (
context: BindContext,
prop: UI5TypedefProp
prop: UI5TypedefProp,
forHover = false
): {
kind: MarkupKind;
value: string;
Expand All @@ -47,10 +48,12 @@ export const getDocumentation = (
`\`typedef ${PROPERTY_BINDING_INFO}\``,
`**Type:** ${getType(prop.type)}`,
`**Description:** ${prop.description}`,
`**Visibility:** ${prop.visibility}`,
`**Optional:** ${prop.optional}`,
`[More information](${link})`,
];
if (forHover) {
values.splice(1, 0, `---`);
}
return {
kind: MarkupKind.Markdown,
value: values.join("\n\n"),
Expand Down
2 changes: 2 additions & 0 deletions packages/binding/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ export {
export { getCursorContext } from "./cursor";

export { getLogger } from "./logger";

export { getDocumentation } from "./documentation";
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Array [
**Description:** Path in the model to bind to, either an absolute path or relative to the binding context for the corresponding model; when the path contains a '&gt;' sign, the string preceding it will override the <code>model</code> property and the remainder after the '&gt;' will be used as binding path
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -43,8 +41,6 @@ Array [
**Description:** Since 1.61, defines a static binding with the given value.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -75,8 +71,6 @@ Array [
**Description:** Name of the model to bind against; when <code>undefined</code> or omitted, the default model is used
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -104,8 +98,6 @@ Array [
**Description:** Whether the binding should be suspended initially
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -136,8 +128,6 @@ Array [
**Description:** Function to convert model data into a property value
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -167,8 +157,6 @@ Array [
<b>Note</b>: use this flag only when using multiple bindings. If you use only one binding and want raw values then simply don't specify a type for that binding.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -201,8 +189,6 @@ Array [
<b>Note</b>: use this flag only when using multiple bindings.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -233,8 +219,6 @@ Array [
**Description:** A type object or the name of a type class to create such a type object; the type will be used for converting model data to a property value (aka \\"formatting\\") and vice versa (in binding mode <code>TwoWay</code>, aka \\"parsing\\")
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -311,8 +295,6 @@ Array [
**Description:** Target type to be used by the type when formatting model data, for example \\"boolean\\" or \\"string\\" or \\"any\\"; defaults to the property's type
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -340,8 +322,6 @@ Array [
**Description:** Format options to be used for the type; only taken into account when the type is specified by its name - a given type object won't be modified
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -380,8 +360,6 @@ Array [
**Description:** Additional constraints to be used when constructing a type object from a type name, ignored when a type object is given
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -420,8 +398,6 @@ Array [
**Description:** Binding mode to be used for this property binding (e.g. one way)
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -454,8 +430,6 @@ Array [
**Description:** Map of additional parameters for this binding; the names and value ranges of the supported parameters depend on the model implementation, they should be documented with the <code>bindProperty</code> method of the corresponding model class or with the model specific subclass of <code>sap.ui.model.PropertyBinding</code>
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -483,8 +457,6 @@ Array [
**Description:** Map of event handler functions keyed by the name of the binding events that they should be attached to
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down Expand Up @@ -516,8 +488,6 @@ If a part is not specified as a binding info object but as a simple string, a bi
<b>Note</b>: recursive composite bindings are currently not supported. Therefore, a part must not contain a <code>parts</code> property.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Array [
**Description:** Path in the model to bind to, either an absolute path or relative to the binding context for the corresponding model; when the path contains a '&gt;' sign, the string preceding it will override the <code>model</code> property and the remainder after the '&gt;' will be used as binding path
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -19,8 +17,6 @@ Array [
**Description:** Since 1.61, defines a static binding with the given value.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -30,8 +26,6 @@ Array [
**Description:** Name of the model to bind against; when <code>undefined</code> or omitted, the default model is used
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -41,8 +35,6 @@ Array [
**Description:** Whether the binding should be suspended initially
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -52,8 +44,6 @@ Array [
**Description:** Function to convert model data into a property value
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -65,8 +55,6 @@ Array [
<b>Note</b>: use this flag only when using multiple bindings. If you use only one binding and want raw values then simply don't specify a type for that binding.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -78,8 +66,6 @@ Array [
<b>Note</b>: use this flag only when using multiple bindings.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -89,8 +75,6 @@ Array [
**Description:** A type object or the name of a type class to create such a type object; the type will be used for converting model data to a property value (aka \\"formatting\\") and vice versa (in binding mode <code>TwoWay</code>, aka \\"parsing\\")
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -100,8 +84,6 @@ Array [
**Description:** Target type to be used by the type when formatting model data, for example \\"boolean\\" or \\"string\\" or \\"any\\"; defaults to the property's type
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -111,8 +93,6 @@ Array [
**Description:** Format options to be used for the type; only taken into account when the type is specified by its name - a given type object won't be modified
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -122,8 +102,6 @@ Array [
**Description:** Additional constraints to be used when constructing a type object from a type name, ignored when a type object is given
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -133,8 +111,6 @@ Array [
**Description:** Binding mode to be used for this property binding (e.g. one way)
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -144,8 +120,6 @@ Array [
**Description:** Map of additional parameters for this binding; the names and value ranges of the supported parameters depend on the model implementation, they should be documented with the <code>bindProperty</code> method of the corresponding model class or with the model specific subclass of <code>sap.ui.model.PropertyBinding</code>
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -155,8 +129,6 @@ Array [
**Description:** Map of event handler functions keyed by the name of the binding events that they should be attached to
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -170,8 +142,6 @@ If a part is not specified as a binding info object but as a simple string, a bi
<b>Note</b>: recursive composite bindings are currently not supported. Therefore, a part must not contain a <code>parts</code> property.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Object {
"kind": "markdown",
"value": "\`typedef sap.ui.base.ManagedObject.PropertyBindingInfo\`
---
**Type:** Array<(String | sap.ui.base.ManagedObject.PropertyBindingInfo>)
**Description:** Array of binding info objects for the parts of a composite binding; the structure of each binding info is the same as described for the <code>oBindingInfo</code> as a whole.
Expand All @@ -14,8 +16,6 @@ If a part is not specified as a binding info object but as a simple string, a bi
<b>Note</b>: recursive composite bindings are currently not supported. Therefore, a part must not contain a <code>parts</code> property.
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand All @@ -29,12 +29,12 @@ Object {
"kind": "markdown",
"value": "\`typedef sap.ui.base.ManagedObject.PropertyBindingInfo\`
---
**Type:** String
**Description:** Path in the model to bind to, either an absolute path or relative to the binding context for the corresponding model; when the path contains a '&gt;' sign, the string preceding it will override the <code>model</code> property and the remainder after the '&gt;' will be used as binding path
**Visibility:** public
**Optional:** true
[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)",
Expand Down

0 comments on commit 0f41b5d

Please sign in to comment.