Skip to content

Commit f5afcc6

Browse files
author
yevhenii-nadtochii
committed
Proofread docs to PsiStatements
1 parent e03a6e6 commit f5afcc6

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

java/src/main/kotlin/io/spine/validation/java/psi/PsiStatements.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ import com.intellij.psi.PsiElement
3131
import com.intellij.psi.PsiElementFactory
3232

3333
/**
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.
3636
*
37-
* This type resolves two problems:
37+
* This type addresses several challenges:
3838
*
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.
4547
*/
4648
public class PsiStatements(codeBlock: PsiCodeBlock) {
4749

@@ -66,7 +68,7 @@ public class PsiStatements(codeBlock: PsiCodeBlock) {
6668
* Creates a new [PsiStatements] from the given [text].
6769
*
6870
* @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.
7072
*/
7173
public fun PsiElementFactory.createStatementsFromText(
7274
text: String,

0 commit comments

Comments
 (0)