Open erlethor opened 4 years ago
Thanks for the feedback @erlethor 👍
Navigation / go to definition (most helpful)
This seems very useful, it is also fairly complex as we currently do not yet any representation of the user's workspace in the extension, also some of this representation would require parsing JavaScript files while we (currently) only "understand" UI5 api.json files.
I am not saying this cannot be done, just noting the technical gaps.
Type ahead / suggest (awesome)
Similar to above the suggestions here seem to require expending the model we are working on, basically what we know of the user's workspace (custom libraries / JS files / other...).
Syntax validation Parenthesis / Brackets / Curly Braces highlighting for
The first step to adding any feature on for the "binding expressions" would be to parse these expressions.
For XML we build our own parser which has advanced features to support editor scenarios, e.g error recovery:
Questions;
Thank you @bd82
The UI5 documentation is the only reference I know about bindings:
About the contribution. Although it would be very interesting I am afraid I won't find the time to actively contribute here.
BindingParser: https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/base/BindingParser.js ExpressionParser: https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
Can this somehow be ported to the language assistant? With some guidance I might try this myself @bd82
Hello @mschleeweiss
It will likely be require more than a porting of said parser.
I am not familiar with the specific ExpressionParser
in UI5.
However, in general a parser meant to enable language service capabilities if often more complex than one that is only used to "compile" (transform) some input. The additional capabilities needed often include:
Basically if you want to implement advance capabilities such as content assist, tooltips, advanced highlights you often need to work on more low level (CST) and possibly incomplete data structures. In a compiler scenario it is much more simple, as you can stop on the first error, but in an editor scenario the features should (mostly) work even while the user is typing and the input in incomplete and invalid.
I don't know which of these capabilities the existing ExpressionParser
has, but I suspect not all of them.
For reference, to implement the XML related capabilities in the manifest.json we first had to implement
a "smart" parser for XML capable of being using in a language server and related utilities.
As this issue contains multiple feature requests, we should have smaller ones for each individual enhancement and link them to this one.
PropertyBindingInfo
: https://github.com/SAP/ui5-language-assistant/issues/563 and https://github.com/SAP/ui5-language-assistant/issues/614
Hi Colleagues,
Working for years with UI5 XML Views in the Fiori Elements library I would like to share my ideas about what would really be helpful in a UI5 XMLView assistant.
Navigation / go to definition (most helpful)
In general: Any of the targets (js code, fragments) may be in the local repository (app as well as library repo), in a different cloned repository on the local machine, or is only in the "remote" ui5 distribution. It would be very helpful that the navigation would always try to find a local version and if not available locally go to the sapui5 documentation instead.
Fragments. Ctrl/Cmd Click on a
fragmentName
reference should open the fragment in the editor.<core:Fragment fragmentName="sap.fe.templates.ObjectPage.view.fragments.HeaderImage" type="XML" />
template:require
/core:require
should open the corresponding file if locally available or the sapui5 documentation if not.Navigate to controller (if it function starts with
.
) or static function defined by template:require / core:require. E.g.idPrefix="{= ID.generate([${this>id}, 'FilterFieldValueHelp']) }"
should allow navigation to the function definition of generate() insap/fe/core/helpers/StableIdHelper.js
as defined in thetemplate:require
above. This should work no matter if it is about formatter, expression binding or event handler.Type ahead / suggest (awesome)
It would be very helpful if auto suggest would work when typing all of the navigation examples.
1.
<core:Fragment fragmentName="
would give a list of locally available fragmentstemplate:require: '
would give a list of classes defined locally or in ui5. Ideally path segment wise (first suggest of sap/, then sap/{second segement} and so on.
would suggest functions from the controller. If it starts with a word defined intemplate:require
orcore:require
it would suggest functions from that javascript file.Syntax validation
A minimal syntax check for the following notations would help
{path: 'entitySet>$Type', formatter: 'FIELD.getBindingForDraftAdminBlockInline'}
visible="{= !${IsActiveEntity} || ${HasDraftEntity}}"
In the example 1. above, in case
FIELD
is not defined in eithertemplate:require
or core:require` it should be marked as an error.Parenthesis / Brackets / Curly Braces highlighting for
Thanks, Thorsten