KSP just came across my radar. At first glance, it...
# ksp
p
KSP just came across my radar. At first glance, it looks like an awesome tool to support the development of Kotlin related LSP clients and servers, for which I am working on both. The answer to this question will be telling: given a hello world program that contains
println("Hello World")
can KSP easily access the declaration of "println"? I.e. can KSP drill into the runtime jar file, extract the definition/declaration of standard language symbols and provide those to an interested tool leveraging KSP?
🚫 1
@jw Dare I ask: why not? My interest is in tagging language level function references (e.g. println) with a special format. I have not yet figured out how to do this. Do you have any insight to offer?
j
KSP only sees structure, like an annotation processor would. For seeing statements you'll need the full IR of a compiler plugin
👍 1
s
If you want to use parts of compiler for LSP, I suggest looking at the existing compiler frontend (basically parts of compiler underneath KSP). They are already using it in the IDEA, albeit with a lot of modifications for performance.
p
@shikasd yes, I've already started that process. It is rather daunting so I had my fingers crossed that KSP would provide a faster fix. I did get a recommendation to start with a "new" front-end that I suspect will be in place for 1.5. What's your recommendation? This is all for some explorations, not for any production code so I have time to ramp up.
s
KSP would be just slower, in my opinion, because it is one more layer on top of whatever PSI already does. IIRC, google and jb promised new frontend to be way faster and more customizable, so it makes sense to look at it. I assume it won't work in many tricky cases though, but should be fine for exploration :)
Also I don't think new frontend is going to be ready for 1.5, because it is just around the corner Maybe early alpha, but not proper update