Closed eglekaz closed 1 month ago
Tree-sitter does not correctly recognize that classBody and body can start and end with an include. Instead, it only considers include statements as part of the body after the define statement. For example:
class Class final:
{include/ttSomething.i}
define public property prop as decimal initial 3.0 no-undo
get.
private set.
{include/ttSomething.i}
constructor private Class( ):
m_NumCusts = 0.
end.
{include/ttSomething.i}
end class.
First include:
Second include:
Last include:
Adding description from #122: Tree-sitter does not correctly recognize that classBody and body can start and end with a comment. Instead, it only considers comment statements as part of the body after the define statement. For example:
class Class final:
///Comment
define public property prop as decimal initial 3.0 no-undo
get.
private set.
///Comment
constructor private Class( ):
m_NumCusts = 0.
end.
///Comment
end class.
First comment:
Second comment:
Last comment:
I see it's fixed, so moving to to test
TESTING This:
class myUtility:
// some comment
method public static int toInt(pcValue as char):
// some comment
DEFINE var iNumber as int no-undo initial ?.
// some comment
iNumber = int(pcValue) no-error.
// some comment
return iNumber.
// some comment
end.
// some comment
end class.
Becomes this:
class myUtility:
// some comment
method public static int toInt(pcValue as char):
// some comment
DEFINE var iNumber as int no-undo initial ?.
// some comment
iNumber = int(pcValue) no-error.
// some comment
return iNumber.
// some comment
end.
// some comment
end class.
First comment inside of the METHOD is not fully formatted, but seems to be recognized by tree-sitter. INCLUDES were formatted correctly with similar example.
I think @gustason can check this issue further and create a solution. I will assign lower priority as I see that the issue appear only with some comments.
This issue has been fixed after the recent tree-sitter update.
Closing the ticket
Tree-sitter does not correctly recognize that classBody and body can start and end with an INCLUDE or COMMENT. Instead, it only considers include statements/comments as part of the body after the define statement.