-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sqlite/ folder children appear/behave like Java packages #40
Comments
I'm talking about the folder in your source tree with the |
gotchya 👍 |
Looks like the will require a sqldelight facet type and all the stuff around that. It's probably the right thing to do but later. |
so in vanilla intellij the solution is val contentEntry = ModuleRootManager.getInstance(module).getModifiableModel().addContentEntry("src");
contentEntry.addSourceFolder("/path-to-module/src/main/sqldelight") and this works fine. Unfortunately in the android plugin they drop all the existing ContentEntries and hardcode their own, which are essentially generatedJava, generatedRes, java, and res directories with some others. So if you call the above code before the wipe it looks proper for a fraction of a second before the android plugin code runs and wipes it. If you call it after the wipe the source folder (sqldelight) is blue but the packages dont collapse. Not sure whats going on there. All this is to say I'm going to take the ridiculously easy route and just add the sqldelight directory as a source directory from gradle instead of using the IDE. IDE is the right way to go but Android Studio is making it difficult/impossible. |
@AlecStrong I've tried to make this work, but as you mentioned it's unavoidable that the android plugin will rewrite all content entries after a gradle sync.. Even if you mark a dir manually as a sources root, it still will be overwritten. I tried to look for workarounds (like listening for gradle sync to finish?) but no luck. Do you have an idea/refs on how to do it properly with facets? |
yea there isn't a whole lot of information regarding facets: https://www.jetbrains.org/intellij/sdk/docs/reference_guide/project_model/facet.html it's a lot to look through, and I can't find anything specifically about directory UI so it might also be a dead end which would suck. It's likely that adding it as a kotlin source set in gradle is the only way to get the working. It kinda sucks because then you could also put kotlin files there and they would be compiled, but it's probably worth it because right now the directory structure kinda sucks there might be other intellij platform APIs to facilitate this but I haven't found them. It might be worth asking in the intellij platform slack to see if one of the JB team has a good idea for it |
Currently it's like:
Should be like:
The text was updated successfully, but these errors were encountered: