@@ -31,17 +31,19 @@ import com.intellij.psi.PsiElement
31
31
import com.intellij.psi.PsiElementFactory
32
32
33
33
/* *
34
- * List of statements from [PsiCodeBlock] without surrounding braces ,
35
- * but with the preserved formatting elements .
34
+ * A list of statements extracted from the given [PsiCodeBlock],
35
+ * excluding the surrounding braces .
36
36
*
37
- * This type resolves two problems :
37
+ * This type addresses several challenges :
38
38
*
39
- * 1. In PSI, the code block cannot be created without curly braces, making it
40
- * difficult to insert a code block into a method body.
41
- * 2. A list of statements can be [retrieved][PsiCodeBlock.getStatements] from the block.
42
- * Though, formatting-related elements like whitespaces and new lines are filtered out.
43
- * An attempt to add these statements one-by-one to a method block often leads to
44
- * non-compilable Java code.
39
+ * 1. In PSI, a code block cannot be created without curly braces. As a result, even if
40
+ * you only need a list of statements, you must create a full block with braces.
41
+ * 2. Inserting such a block into another code block requires range copying
42
+ * to skip the braces.
43
+ * 3. While a list of statements can be [retrieved][PsiCodeBlock.getStatements] directly from
44
+ * the code block, formatting elements like whitespace and newlines are omitted, leaving
45
+ * only the raw statements. Adding these statements individually to a method body often
46
+ * results in invalid or non-compilable Java code.
45
47
*/
46
48
public class PsiStatements (codeBlock : PsiCodeBlock ) {
47
49
@@ -66,7 +68,7 @@ public class PsiStatements(codeBlock: PsiCodeBlock) {
66
68
* Creates a new [PsiStatements] from the given [text].
67
69
*
68
70
* @param text The text of the statements to create.
69
- * @param context The PSI element used as context for resolving references from the statements .
71
+ * @param context The PSI element used as context for resolving references.
70
72
*/
71
73
public fun PsiElementFactory.createStatementsFromText (
72
74
text : String ,
0 commit comments