-
Notifications
You must be signed in to change notification settings - Fork 323
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
Annotation based dropdowns not working for static methods on built-ins. #6715
Comments
Looks to be a GUI issue - the widget data is not requested for static methods. If the metadata is queried manually, it is reported correctly. |
Dug a little deeper and discovered the root cause. The expression call is properly parsed and recognized. Span tree looks like this:
The call and its target is properly recognized:
Then, the IDE asks for the expression info of this call ID and receives one: {
"expressionId": "1b02c13f-939a-4207-aecb-3ea15227ad3a",
"type": "Standard.Base.Function.Function",
"methodPointer": {
"module": "Standard.Base.Data.Text.Extensions",
"definedOnType": "Standard.Base.Data.Text.Text.type",
"name": "from_bytes"
},
...
}, The {
"type": "Add",
"id": 93,
"suggestion": {
"type": "method",
"module": "Standard.Base.Data.Text.Extensions",
"name": "from_bytes",
"selfType": "Standard.Base.Data.Text.Text",
...
}
}, Note that I'm not sure if this is the IDE issue and we should treat the |
It turns out in some parts of IDE we already strip that postfix, and in fact rely on it to inform us about how to interpret that method call's arguments. Removing it on the language server side would break that logic. enso/app/gui/src/controller/graph/executed.rs Lines 415 to 425 in 3e739a7
In order to fix this, we have to use the same resolution strategy for widget related method queries to the suggestion database. |
There are more places to fix, unfortunately, as - apparently - only you, @Frizi, have been aware of the And another problem is that Language Server seems to be not consistent in adding Of course, we can apply a set of patches, but I think those inconsistencies should be resolved in the long run. |
Our suggestion database reflects exactly what language server send us, it only removes unnecessary The MethodPointer responsibility is to point to method definition. Its primary use is to tell as where is the definition of the node if we would want to enter it. Now you see (I hope) the problem here: the definition pointer should not depend on the call syntax! This is why the field is called (The last two paragraph cc @JaroslavTulach @4e6) In your case, I think you're taking the information from the wrong place. If you want to know what is the type of self argument, you should just read the type of the proper expression ID (in the last case on your screenshot, it could be type of |
Looking from Enso language perspective:
e.g. the
If you are interested in "static information" - e.g. where a source code is - then we may want to modify the |
The discussion continues https://github.com/orgs/enso-org/discussions/6762 For now, we will make another place where we just check type for |
Implements #6792 Fixes #6715 Fixes #6052 Fixes #5689 The dynamic dropdown widgets entries now can specify additional widget configuration as a list of `parameters` of the inner method call. That allows for creating smarter widgets within nested constructors, taking the outer widget's context into account. <img width="772" alt="image" src="https://github.com/enso-org/enso/assets/919491/97c70654-9170-4cf0-ae4d-2c25c74caa96"> With the changes to the serialization logic, I have also adressed issues related to automatic label generation for both static and dynamic dropdown entries. For access chains (e.g. `Foo.Bar.Baz_Qux`), the label will now always contain only the last segment, and all underscores will be removed (e.g. `Baz Qux`). This also applies to dynamic entries where the label is not explicitly specified in method annotation. <img width="265" alt="image" src="https://github.com/enso-org/enso/assets/919491/1abe6c77-010b-4622-b252-97cd1543cb48"> Additionaly, now the dynamic entries containing constructors will also be resolved within suggestion database, allowing us to automatically insert relevant import, shorten the actually used expression and wrap it with parentheses if required. That was required for nested widgets to show up, as we depend on properly resolved argument names to show them. The widget definitions in annotations no longer need to wrap the expressions manually. Instead, the constructors used in dropdown entries should be specified using fully qualified names, similarly to how we do it in tag values. CC @jdunkerley - The dropdown entries containing just a constructor will no longer need added parentheses around them. Instead, the constructors should be specified using fully qualified names, similarly to how we do it in tag values. <img width="389" alt="image" src="https://github.com/enso-org/enso/assets/919491/19944b5b-d0c7-43ac-bf17-ca1556e0b3f0"> Note that currently the import resolution is attempted even if the used constructor is is not specified using a fully qualified name. To accomplish that, the IDE is performing a more expensive search through whole suggestion database for matching type and module (e.g. in example above, we are searching for a match for `Aggregate_Column.First`). If there are multiple potential matches due to a name collision, it is undefined which one would be preferred. Effectively one will be picked at random. To avoid that, the libraries should over time transition to using fully qualified names wherever possible. # Important Notes I have removed the `payload` field from the span tree, and with it the generic argument on its nodes. This was already partially done on the branch with new design, on which I also had a few changes that turned out to be useful for this PR. So I pulled it in as well. It is a nice simplification that will ease our further work on removing the span-tree altogether. The biggest impact it had was on the node output port, where I had to store the port data outside of the span tree. This is the approach we would be taking when transitioning to AST anyway.
Both
encoding
parameters should have the same dropdown (correctly shown for"Hello World"
).The parameters are listed correctly and the type based dropdown is shown but for the static method on the built-in the
get_widget_json
is not called.The text was updated successfully, but these errors were encountered: