What would be the best way execute the quote syste...
# arrow-meta
j
What would be the best way execute the quote system on a KtFile? This is to transform the KtFile using the configured plugins. I already have an instance of
MetaPlugin
, and a
KtFile
in context
Quote.processFiles()
seemed useful to me, but was unsure which transformations to apply
If you have a file there and run it through that code that normally would happen on analysts you can mutate the file
So you would need to create first a dummy file
Or something similar so it does not apply the changes directly to the editor buffer document
You can create those with the ktpsifactory or add a new function to ElementScope
You can extract code you need form the Quote file and take it to a place to the IDE where you are able to run a transformation of a quote over a file
j
the linked code is calling
processFiles(files, quoteFactory, match, map)
.
map
is passed in. I assume that
map
is equivalent to the transformations defined by the registered compiler plugins. But I couldn't find a way to retrieve this list (i.e. the transformations passed as
map
).
r
The transformations come from the user plugin
whatever quotes they have active, but at the moment running quotes on the IDE returns a ExtensionPhase.Empty
This can be seen in the
quote
function
if in there you run your own code you will have access to
map
or whatever because that code is also running in IDEA when you compile
To be honest I’m not sure how the best way to wire this is
j
thanks, I''ll investigate and should find a way to handle this
(@raulraja sorry for the delay - daughter was born 🙂 I've found a way to use the registered quotes to transform a KtFile of the IDE. Still a bit hacky, but it enabled me to proceed. Next is • providing the `@synthetic`elements to the IDE and make sure that resolving is working in the IDE • see what we can do with the new IndicesHelperExtension • profile this thing to learn if it's fast enough • Then someone else has to decide if it's fast and good enough to be used.
r
Congratulations!!!!! 👶
And thanks so much for the progress report
j
@raulraja Here's an update: I've finally managed to get resolving working with PSI elements generated by the quote system. I should be be able to create a PR with the first set of changes later today. The tricky part will be to make this fast and not consume a lot of memory, but optimizing a bit later when unit tests are in place is probably best. I'll post a few questions on the channel which will help me to proceed
r
that is awesome, thank you so much @Joachim Ansorg looking forward to it!