Skip to content

Add folding range lsp support#69

Open
ssmifi wants to merge 1 commit into
mainfrom
ssm/folding-range
Open

Add folding range lsp support#69
ssmifi wants to merge 1 commit into
mainfrom
ssm/folding-range

Conversation

@ssmifi
Copy link
Copy Markdown
Collaborator

@ssmifi ssmifi commented May 12, 2026

Closes #26
and implements the folding feature, which is basically a port from Langium.

Customization can be done via the FoldingRangeFilter interface.

@ssmifi ssmifi marked this pull request as ready for review May 12, 2026 12:00
Copy link
Copy Markdown
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I like the filter strategy approach! A few suggestion, see below 👍

IncludeLastFoldingLineForComment() bool
}

type DefaultFoldingRangeFilter struct{}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Add a comment what the default implementation does.

Comment on lines +132 to +135
foldRange = core.TextRange{
Start: segment.Range.Start,
End: core.TextLocation{Line: segment.Range.End.Line - 1, Column: segment.Range.End.Column},
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: I don't think the logic is correct here. It should use the Column value at the end of the line.

}
}
t.Errorf("Should have folding range for marker '%s' (lines %d-%d)", label, markerRange.Start.Line, markerRange.End.Line)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: I would like to see a AssertFoldingRanges in the Doc struct instead of extracting the markers directly. See my other PR for inspiration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Folding feature

2 participants