DragonKnightOfBreeze / Paradox-Language-Support

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

Conflicting scopes for inline scripts disables autocompletion inside. #35

Closed adriangaro closed 4 months ago

adriangaro commented 1 year ago

As the title says, conflicting usage scopes disables auto completion inside inline scripts.

There are some usecases where an inline might be used in multiple scopes (ie. used in buildings and districts and deposits) which is almost similar scopes. Would it be possible to generate the common set of supported features and blocks in such cases instead of disabling fully?

For example, triggered_planet_modifier will work on both districts, buildings or deposits, while if an inline is used in all those 3 scopes, triggered_desc should probably error since it is not supported on deposits.

Or going the opposite and combing the scopes and allowed stuff, in case it would be easier and developer discretion should be used in such cases.

DragonKnightOfBreeze commented 1 year ago

The implemention of infer cwt config context (to get the common possible cwt configs) for expressions in inline script files will be optimized the next version.

DragonKnightOfBreeze commented 1 year ago

The optimized logic is to infer all the possible root configs at inline script file level first, ahd then resolve all the possibe configs at the current position level.

The optimized infer logic is to get all the possible configs from all the inline script usages first, and then recursive merge all the possible configs.

Currently PLS use 'pointerEquals' logic, means must be same configs in cwt files. 'contentEquals' logic should be better but not best. 'recursiveMerge' logic should be perfect so far.

DragonKnightOfBreeze commented 1 year ago

I found it's not very easy to 'merge cwt configs', for there are not only key - values, but also additional options and documents...

DragonKnightOfBreeze commented 1 year ago

Since 1.1.0, cwt configs from same location in cwt files (or after inline, e.g. single_alias_right[trigger_clause]), can be merged, when using Language Injection to provide inferred configs.

Further optimization could be applied in future versions.