Temporarily cancel the click event and set `Unfold` to default status, because being folded will cause a scrolling problem. (#3572)

This commit is contained in:
ifengqi 2024-10-18 16:11:46 +08:00 committed by GitHub
parent 10c17453c2
commit 02ed2fe2cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 21 deletions

View File

@ -311,21 +311,10 @@ pub fn from_lsp(value: lsp_types::FoldingRange) -> Self {
start_character,
end_line,
end_character,
kind,
collapsed_text,
..
} = value;
let status = if kind
.as_ref()
.map(|x| {
x == &lsp_types::FoldingRangeKind::Imports
// || x == &lsp_types::FoldingRangeKind::Comment
})
.unwrap_or_default()
{
FoldingRangeStatus::Fold
} else {
FoldingRangeStatus::Unfold
};
let status = FoldingRangeStatus::Unfold;
Self {
start: FoldingPosition {
line: start_line,
@ -359,14 +348,14 @@ pub enum FoldingRangeStatus {
impl FoldingRangeStatus {
pub fn click(&mut self) {
match self {
FoldingRangeStatus::Fold => {
*self = FoldingRangeStatus::Unfold;
}
FoldingRangeStatus::Unfold => {
*self = FoldingRangeStatus::Fold;
}
}
// match self {
// FoldingRangeStatus::Fold => {
// *self = FoldingRangeStatus::Unfold;
// }
// FoldingRangeStatus::Unfold => {
// *self = FoldingRangeStatus::Fold;
// }
// }
}
pub fn is_folded(&self) -> bool {
*self == Self::Fold