galaxyproject / galaxy-language-server

Galaxy Language Server to help in Galaxy (https://galaxyproject.org/) tool wrappers development.
Apache License 2.0
23 stars 15 forks source link

Feature request: extract command reference and output filter reference from input parameter #262

Closed astrovsky01 closed 2 months ago

astrovsky01 commented 2 months ago

With longer and more complicated tools, nested conditionals and sub-parameters can be annoying to properly reference, necessitating tracing down a nested tag properly, and often times cause errors as one can be easily missed. This is the same with filter steps in outputs, where tracing the lineage of a tag and specific value can cause annoyance. I would like a way to easily extract the method of referencing a tag for both the command and output filers. In an example below, I would like to be able easily reference the param target within the command ($example_conditional.example_conditional_2.example_param_2), as well as generate a filter for when target's value is set for to generate an output (example_conditional_1['example_conditional_2']['example_param_2']) that can be modified easily (adding an in,==, etc.)

        <conditional name="example__conditional_1" label="example_conditional_1">
            <param name="example_param_1" type="select" label="sub_param_1">
                <option value="yes">Yes</option>
                <option value="no">No</option>
            </param>
            <when value="yes">
                <conditional name="example_conditional_2" label="example_conditional_2">
                    <param name="example_param_2" type="select" label="sub_param_2">
                        <option value="yes">Yes</option>
                        <option value="no">No</option>
                    </param>
                    <when value="yes">
                        <param name="target" label="target" type="select" display="checkboxes" multiple="true">
                            <option value="option1">option 1</option>
                            <option value="option2">option 2</option>
                        </param>
                    </when>
                    <when value="no"/>
                </condiitonal>
            </when>
            <when value="no"/>
        </conditional>
davelopez commented 2 months ago

@astrovsky01 would something like this work for you?

ToolInsertParamRef

This is a custom command that you can invoke from the VSCode Command Palette (or directly using the default shortcut ctrl+alt+i+p or cmd+alt+i+p on Mac) and will let you select the desired input to insert at your current cursor position.

Let me know if this would work for you, then I'll do a similar thing for getting the filter like example_conditional_1['example_conditional_2']['example_param_2']

astrovsky01 commented 2 months ago

@davelopez that looks fantastic! Thank you so much for working on this!