Path-Check / intellij-cql

Clinical Quality Language Plugin for IntelliJ Idea and Android Studio
Apache License 2.0
5 stars 0 forks source link

Feature Request - include statements working with .cql files in a different directory #11

Open Benjamin-Kuzava opened 6 months ago

Benjamin-Kuzava commented 6 months ago

Was wondering how feasible it might be to allow a cql library to include another library a directory up. For example, in our project, we have a large amount of helper libraries we'd like to keep separate for organizational purposes, and although our rules would compile and run, the syntax highlighting gives an error that the include library cannot be found, and therefore we would miss out on a lot of the functionality of the plugin. Here's an example:

cql
  |- helperlibraries
  | |- SomeHelperLibrary-0.0.1.cql
  |- MainLibrary-0.0.1.cql

We'd like MainLibrary-0.0.1.cql to be able to include SomeHelperLibrary-0.0.1.cql and use its functions.

vitorpamplona commented 6 months ago

Yeah, I didn't know how to proceed with that. The question is should the plugin import every single .cql file in all directories to make it all available? Because CQL does not have an import structure where the user can specify directories. The environment must load everything. However, I have a feeling that loading everything might be quite heavy on some machines.

So, in the end, we ended up just loading what's in each directory. :(

But I am open to any ideas there.

TsilenT commented 6 months ago

What if it just loaded current directory + subdirectories? Without any structure from CQL itself, it feels like the two ways to get the plugin to behave would be either to load the world (which I agree feels expensive), or specify some sort of "library/PATH" directories to the plugin. Barring those, loading subdirectories only feels like a fairly safe compromise to "load the world", and could even have a configuration toggle if we want to be on the safer side.

It'd have the minor side product of mildly forcing convention on the users (since there would be no upwards visibility), but in reality it would be no different than the way the plugin behaves today for upwards visibility.