DragonKnightOfBreeze / Paradox-Language-Support

IDEA Plugin: Paradox Language Support.
https://windea.icu/Paradox-Language-Support
MIT License
36 stars 4 forks source link

Parameters in cwt configs do not get auto completed if they cannot be inferred or are not present in the inline/scripted_effect etc #66

Closed adriangaro closed 4 months ago

adriangaro commented 4 months ago

While this seems initially as not necessarily as a bug, and to be frank it is not, it can have some usecases for the purpose of creating some dummy inlines for easy type hinting for example, where the parameters can be passed to an inline with a cwt config declared for its parameters, but said parameters are never used, the game does not mind and considers as valid.

For example i have the following

inline_scripts = {
    ## context_configs_type = multiple
    tec_type_hint = {
    }
}

parameters = {
    ## context_key = inline_script@tec_type_hint
    bool = bool
    ## context_key = inline_script@tec_type_hint
    int = int
    ## context_key = inline_script@tec_type_hint
    float = float
    ## context_key = inline_script@tec_type_hint
    number_or_value = value_field
    ## context_key = inline_script@tec_type_hint
    variable = value_set[variable]
    ## context_key = inline_script@tec_type_hint
    script_value = <script_value>
    ## context_key = inline_script@tec_type_hint
    scope = <scope>
    ## context_key = inline_script@tec_type_hint
    country_scope = scope[country]
    ## context_key = inline_script@tec_type_hint
    planet_scope = scope[planet]
    ## context_key = inline_script@tec_type_hint
    pop_scope = scope[pop]
    ## context_key = inline_script@tec_type_hint
    species_scope = scope[species]
    ## context_key = inline_script@tec_type_hint
    job = <job>
    ## context_key = inline_script@tec_type_hint
    district = <district>
    ## context_key = inline_script@tec_type_hint
    building = <building>
    ## context_key = inline_script@tec_type_hint
    resource = <resource>
    ## context_key = inline_script@tec_type_hint
    trait = <trait>
    ## context_key = inline_script@tec_type_hint
    species_trait = <trait.species_trait>
    ## context_key = inline_script@tec_type_hint
    leader_trait = <trait.leader_trait>
    ## context_key = inline_script@tec_type_hint
    pop_category = <pop_category>
    ## context_key = inline_script@tec_type_hint
    job_category = <job_category>
    ## context_key = inline_script@tec_type_hint
    economic_category = <economic_category>
    ## context_key = inline_script@tec_type_hint
    technology_category = <technology_category>
    ## context_key = inline_script@tec_type_hint
    planet_flag = value_set[planet_flag]
    ## context_key = inline_script@tec_type_hint
    country_flag = value_set[country_flag]
    ## context_key = inline_script@tec_type_hint
    pop_flag = value_set[pop_flag]
    ## context_key = inline_script@tec_type_hint
    species_flag = value_set[species_flag]
    ## context_key = inline_script@tec_type_hint
    trimmed_ethic = enum[tec_trimmed_ethic]
    ## context_key = inline_script@tec_type_hint
    ethic = <ethic>
    ## context_key = inline_script@tec_type_hint
    trigger = alias_keys_field[trigger]
    ## context_key = inline_script@tec_type_hint
    scripted_trigger = <scripted_trigger>
    ## context_key = inline_script@tec_type_hint
    effect = alias_keys_field[effect]
    ## context_key = inline_script@tec_type_hint
    scripted_effect = <scripted_effect>
    ## context_key = inline_script@tec_type_hint
    modifier = alias_keys_field[modifier]
    ## context_key = inline_script@tec_type_hint
    static_modifier = <static_modifier>

    ## context_key = inline_script@tec_type_hint
    leader_trait_tier = int[1..3]
    ## context_key = inline_script@tec_type_hint
    ## context_configs_type = multiple
    trigger_block = {
        alias_name[trigger] = alias_match_left[trigger]
    }
    ## context_key = inline_script@tec_type_hint
    ## context_configs_type = multiple
    effect_block = {
        alias_name[effect] = alias_match_left[effect]
    }
}

The purpose of this empty inline with cwt config is to be able provide essentially preconfigured type inference/hints for parameters of an inline/scripted effect etc.

I use the above as following

inline_script = {
        script = tec_type_hint
        float = $BASE$
        [[BASE_VALUE] script_value = $BASE_VALUE$ ]
        economic_category = $ECO_CAT$
        resource = $RESOURCE$
        [[REQUISITION] planet_flag = $REQUISITION$ ]
        [[REQUISITION_AMOUNT] float = $REQUISITION_AMOUNT$ ]
}

This works and it correctly makes the parameters of that type declared in the cwt config i made, but autocomplete is never provided since the fake parameters declared in the cwt config are never used. image image image

adriangaro commented 4 months ago

Most of these types for parameters normally could never be inferred since the ECO_CAT for example is used as part of this syntax, which would be nigh impossible to deduce

complex_trigger_modifier = {
        trigger = check_modifier_value
        parameters = {
            modifier = $ECO_CAT$_$RESOURCE$_produces_add
        }
        mode = add
}
adriangaro commented 4 months ago

Yes you could technically go and declare configs manually for all these parameters for inlines/script values etc, but it would be cumbersome and detached from the definition of the inline/script value etc.

Yet again this all already works (which shows how great your work for the custom cwt configs is), the main thing would be just auto complete for the parameters defined explicitly in cwt config

DragonKnightOfBreeze commented 4 months ago

Will be checked in 1.3.5

DragonKnightOfBreeze commented 4 months ago

image

image

DragonKnightOfBreeze commented 4 months ago

Will still be unresolved after completion if it's not already defined in actual.

DragonKnightOfBreeze commented 4 months ago

Will be implemented in 1.3.5