Repository navigation
Conversation
milamberspace
left a comment
There was a problem hiding this comment.
Thanks for this, Ctrl+Space completion in the JSR223 editors will be welcome, and keeping it out of the BSF editors and off auto-activation is a good call. The dependency side also looks right: autocomplete is BSD-3-Clause (Category A), and the com.fifesoft signing key is already trusted in gradle/verification-metadata.xml.
A few things need to change before this can be merged:
- Rebase needed.
src/dist/src/dist/expected_release_jars.csvwas removed on master by #6846. It is replaced bysrc/dist/src/dist/expected_release_artifacts.txt, which listsgroup:artifactcoordinates without versions. After the rebase, please drop the.csvchange and addcom.fifesoft:autocompleteto the new file (./gradlew -PupdateExpectedJars ...rewrites it).verifyReleaseDependenciesnow fails on -SNAPSHOT builds too. - Bindings per element. The
hasSampleResultBindingflag only coversSampleResult, but other elements expose bindings that are missing (see the inline comment). - Documentation. The checklist says the docs were updated, but only
changes.xmlchanged. Please mention Ctrl+Space incomponent_reference.xml, e.g. in the common JSR223 description or at the Script field, and add<pr>6860</pr>to the changes entry.
Smaller, optional points are in the inline comments. Two more:
- On macOS, Ctrl+Space often switches the keyboard input source. Could you check which trigger key AutoComplete uses there by default, and whether it works in JMeter?
- A short comment in
JSR223TestElement.populateBindingspointing toJSR223Completionwould help keep the two lists in sync when a binding is added.
fa50752 to
264827b
Compare
|
The current Ctrl+Space completion is intentionally limited to the known JMeter bindings and the methods explicitly registered for them. It does not infer types for variables created in scripts or resolve chained expressions, so examples such as macOS GUI behavior has not been tested. AutoComplete uses Ctrl+Space by default, but macOS input-source switching may capture that shortcut before JMeter receives it. |
milamberspace
left a comment
There was a problem hiding this comment.
Thanks for the thorough update. Everything from my previous review is addressed: rebased onto expected_release_artifacts.txt, per-element bindings via JSR223Completion.Binding (Sampler: SampleResult; Assertion: SampleResult + AssertionResult; Listener: sampleEvent + sampleResult), vars.remove returning Object, the new TypeEditor constant at the end, the sync comment in populateBindings, and <pr>6860</pr> in changes.xml. I checked the completion list against JSR223TestElement.populateBindings and the element-specific bindings, and they match. The descriptor copy to keep binding metadata isolated between elements is a good catch, and nicely covered by elementBindingMetadataIsIsolated.
One thing to fix in the docs before merging, plus two nits inline.
vlsi
left a comment
There was a problem hiding this comment.
- F19 remains open. The shortcut paragraph still interrupts the compilation introduction and list.
- F20 remains open. The descriptor field can be initialized during superclass construction and still relies on having no initializer.
- F21 remains open. The enum field still uses
namefor the text of the script binding.
Ctrl+Space can corrupt an existing expression (F1). BeanInfos compiled against JMeter 5.6.3 lose constructor linkage (F2), plugins lose their explicit script editors after recompilation (F3), and JavaBeans metadata loses indexed accessors (F4).
Recognize the full Groovy receiver and member selector when matching and inserting completions to address F7 and F8 together.
Reviewed at b6e8dd28.
db96ad7 to
908141c
Compare
Generated-by: GitHub Copilot
db7cec1 to
0ccf458
Compare
Description
Adds explicitly triggered code completion (Ctrl+Space) to JSR223 script editors, including common JMeter bindings, methods, and element-specific bindings. Completion is limited to JSR223 editors and does not affect BSF editors. Adds the AutoComplete dependency and its license metadata.
Motivation and Context
Makes JMeter-provided bindings and common script methods easier to discover while editing JSR223 scripts. Closes #4540.
How Has This Been Tested?
.\gradlew.bat --quiet :src:core:test --tests org.apache.jmeter.gui.util.JSR223CompletionTest- passed (15 tests).\gradlew.bat --quiet classes style- passedgit diff --check- passedKnown issue from GUI testing: Switching between JSR223 components in same hierarchy under sampler (i.e assertion and timer) can leave the entire editor panel displaying the previously selected component's values, even though the destination element retains its distinct saved script. This refresh regression is not fixed in this PR; verify/fix before merging. The isolated
TestBeanGUI.configure()regression test passes but does not reproduce the full GUI selection behavior.Screenshots (if appropriate):
Not applicable.
Types of changes
Checklist: