DragonKnightOfBreeze / Paradox-Language-Support

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

Parameters of inlines show as unused if they cannot be inferred correctly even if declared in cwt config. #64

Closed adriangaro closed 4 months ago

adriangaro commented 4 months ago

Parameters of inlines show as unused if they cannot be inferred correctly even if declared in cwt config.

Inline definition

# conditional/tec_bool
inline_script = {
    script = conditional/parts/tec_bool_$value$
    code = '
        $code$
    '
}

Cwt parameter definitions

    ### conditional/tec_bool
    ## context_key = inline_script@conditional/tec_bool
    value = bool
    ## context_key = inline_script@conditional/tec_bool
    ## context_configs_type = multiple
    code = {

    }

Usage

inline_script = {
    script = conditional/tec_bool
    value = yes
    code = '
        inline_script = {
          script = inline_included_if_value_is_true
          trigger = " is_gestalt = yes "
    '
}

image

As it can be seen the value parameter is shown as unused, and when trying to autocomplete it, the IDE does not suggest it. Same with code

This also might be tied to another bug i found that single counted strings are not accepted, while they do work for scripting purposes in general, the main use case is being able to pass double quoted strings as parameters since, escaping the quotes otherwise can cause issue downstream when the mod is loaded. Will create a separate bug for this too.

adriangaro commented 4 months ago

If a parameter is declared in the cwt config, ideally it should be considered used, if it has been intentionally declared there (even maybe if infering from the inline is impossible). It will help with cases where the logic might be too complex/niche and allow modders to overwrite those parameters and correct what cannot be inferred.

DragonKnightOfBreeze commented 4 months ago

Use 1.3.3 or pre-released 1.3.4? The used or not inspection is implemented based on related indices. However in pre-released 1.3.4 parameter index is disabled due to IDE freezing problem. If you use 1.3.3, this shoulf be a index problem or inspection implementation problem.

DragonKnightOfBreeze commented 4 months ago

It's not desired to be based on CWT configs, same for other things. You can instead "Suppress or disable related inspections"

adriangaro commented 4 months ago

1.3.4 is used here, same behaviour was prior in 1.3.3 i think. But can check

DragonKnightOfBreeze commented 4 months ago

So it is, plz ignore it since 1.3.4 is not fully updated.

adriangaro commented 4 months ago

Ok will do, thanks for the note, atm disabled the inspection, so that is a temporary good solution. Should I keep this open till 1.3.4 is fully realeased?

DragonKnightOfBreeze commented 4 months ago

Just let me check, update and then close this issue.