Skip to content
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

Small boolean widget tweaks #8994

Merged
merged 3 commits into from
Feb 12, 2024
Merged

Conversation

farmaazon
Copy link
Contributor

@farmaazon farmaazon commented Feb 7, 2024

Pull Request Description

Fixes #8962

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@farmaazon farmaazon added CI: No changelog needed Do not require a changelog entry for this PR. -gui labels Feb 7, 2024
@farmaazon farmaazon self-assigned this Feb 7, 2024
return entry.reexportedIn
? unqualifiedImport(entry.reexportedIn)
: entry.memberOf
? unqualifiedImport(entry.memberOf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure this particular line is correct. IIRC, memberOf would be the module in which the type is defined, so from Module import Constructor will probably be invalid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, memberOf is type on which it's defined. The module where the entity is defined is actually definedIn field.

@@ -136,11 +139,21 @@ watch(selectedIndex, (_index) => {
</script>

<script lang="ts">
function hasBooleanTagValues(parameter: SuggestionEntryArgument): boolean {
if (parameter.tagValues == null) return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole function could be made simpler by creating some sorts of arrayEquals utility and using it here.

export const widgetDefinition = defineWidget(WidgetInput.isAstOrPlaceholder, {
priority: 50,
score: (props) => {
if (props.input.dynamicConfig?.kind === 'Single_Choice') return Score.Perfect
if (props.input[ArgumentInfoKey]?.info?.tagValues != null) return Score.Perfect
// Boolean arguments also have tag values, but the checkbox widget should handle them.
if (props.input[ArgumentInfoKey]?.info?.tagValues != null && !hasBooleanTagValues)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the hasBooleanTagValues function is not actually called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we enable some lint for checking it?

@farmaazon farmaazon added the CI: Ready to merge This PR is eligible for automatic merge label Feb 12, 2024
@mergify mergify bot merged commit a0029f2 into develop Feb 12, 2024
27 checks passed
@mergify mergify bot deleted the wip/farmaazon/boolean-widget-tweaks branch February 12, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-gui CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Boolean widget small fixes
3 participants