Closed cqliu1 closed 1 year ago
Pinging @elastic/kibana-canvas (Team:Canvas)
Adding a line item to fix the proper sorting issue that Wylie found. Functions are sorted by the autocomplete lib to display functions that expect the previous functions return type. Args and arg values also have some sorting logic from autocomplete lib. By default, Monaco will sort results alphabetically by the suggestion label unless you pass in a value to sortText
(https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.completionitem.html#sorttext)
I found some other issues that I am hacking on a solution for:
font={
fail to autocomplete because of a parsing error. Auto-closing the {
bracket on type, and also changing to {
as an autocomplete character, helpcontext
, but not based on their return type. So for example if the user is typing filters | essql | POTENTIAL_FUNCTION | render
we could sort functions higher that accept table
and return render
contexts.font={
creates a sub-expression that needs to return a font
function, so we should sort that function to the top.{font color=
is expecting a string, but a string can be the output of a series of conditionals. Is there a way to filter out impossible options?@cqliu1 Interested in your perspective on Wylie's last point regarding the filtering. Obviously there can be a ton of results returned for suggestions but would filtering and hiding functions/args hamper someone's expression dev flow?
Example of the autocomplete being used due to whitelist issue: https://discuss.elastic.co/t/visualizations-functions-in-canvas/214909/2
Closing this for now. If we prioritize the usability of expressions in the Canvas editing capabilities in the future we can re-open.
Switching to using the Monaco editor has vastly improvement the UX around editing expressions in the Canvas. There are a few additional improvements I'd like for us to consider/implement.
Expression editor
ctrl
/alt
+backspace
to allow deleting entire words or lines for quicker editingAutocomplete
Syntax highlighting
[ ] function calls are case-insensitive, but when the casing doesn't match the name defined in the function definition, the function is highlighted as a
string
instead of afunction
Example