-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 js completions #15521
Fix js completions #15521
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
2205223
to
eb1e591
Compare
@@ -53,7 +53,7 @@ | |||
"@budibase/shared-core": "*", | |||
"@budibase/string-templates": "*", | |||
"@budibase/types": "*", | |||
"@codemirror/autocomplete": "^6.7.1", | |||
"@codemirror/autocomplete": "6.9.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing the version, as while trying to get newer ones I got conflicts with the other packages
83f42c8
to
4d56783
Compare
9ded385
to
7c91ce8
Compare
@@ -0,0 +1,8 @@ | |||
import { CompletionContext, Completion } from "@codemirror/autocomplete" | |||
|
|||
export type BindingCompletion = (context: CompletionContext) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These types are only used in the builder, and they have dependencies that are not used anywhere else. It makes more sense to live in here that in the types
package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge value for a reasonably small change! Feels much better to use now. 🚀
I couldn't find any issues other than 1 small one - when you're writing snippets you now get suggestions for helpers, but you can't actually use helpers inside snippets. So we just need to remove those suggestions.
I did try to get it working, as they are not half supported, they need some extra work on the client. To be clear, helpers in snippets currently work for backend bindings (such as formula columns) but don't work for bindings on the design section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Fixing the way we handle autocomplete for javascript. The current behaviour works fine for
fields
, but it does not forhelpers
andsnippers
. Also, updating the autocomplete package to make use ofdisplayLabel
, that will simplify the filter selection.Helpers
Before, they were displaying as autocomplete options with

$("")
. This generates outputs such as$("random")
, that are not valid. The result should behelpers.random()
.Screen.Recording.2025-02-11.at.16.33.41.mov
There is no autocomplete for the right
helpers.whatever()
After:
helpers.whatever()
$("")
Snippets
The same issues we got for autocomplete will occur here. After the changes, we the snippets will be formatted and it will behave as the helpers
Screen.Recording.2025-02-12.at.16.07.57.mov
Final result
Screen.Recording.2025-02-12.at.16.14.00.mov
Helpers
It will filter any part of the helper name

Snippets
They will be formatted to be aligned with the helpers formats

Launchcontrol
Improve javascript bindings autocomplete