https://kotlinlang.org logo
#ksp
Title
# ksp
m

Meika

11/12/2023, 9:19 AM
hi folks, is there any simpler way to retrieve imports from
KSClassDeclaration
? currently can’t find any better way other than creating a new file from the provided
KSFile::filePath
then read each lines and mark it as an import statement if it starts with
import
.
e

efemoney

11/12/2023, 12:29 PM
Thats the only way. What are you trying to achieve? Or why do you want to read import statements
m

Meika

11/13/2023, 6:23 AM
I want to retrieve imports from given
KSClassDeclaration
and see if its contain any wildcard
*
import since need to do some workaround when dealing it with kotlinpoet
e

efemoney

11/13/2023, 4:59 PM
Doesnt really answer the question of what you are trying to do. Also raises more questions, you should not care if there is a wild card import or not. KSP would give you the exact symbol so why would you need to know if user used a wildcard to import that symbol?
j

Jiaxiang

11/13/2023, 7:30 PM
import statement is not supported, your best option is as you mentioned to read the files.
👍 1
👍🏾 1