Skip to content

Commit

Permalink
Make description from FoldingRangeKind more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
jwortmann committed Aug 13, 2023
1 parent 4f7fba0 commit b573b6b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plugin/folding_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def description(
# Store the relevant folding region, so that we don't need to do the same computation again in
# self.is_visible and self.run
self.folding_region = region
return {
FoldingRangeKind.Comment: "LSP: Fold this comment",
FoldingRangeKind.Imports: "LSP: Fold imports",
FoldingRangeKind.Region: "LSP: Fold this region",
'array': "LSP: Fold this array", # used by LSP-json
'object': "LSP: Fold this object", # used by LSP-json
}.get(folding_range.get('kind', ''), "LSP: Fold")
kind = folding_range.get('kind')
if kind == FoldingRangeKind.Imports:
return "LSP: Fold Imports"
elif kind:
return "LSP: Fold this {}".format(kind.title()) # pyright: ignore # FoldingRangeKind -> StrEnum
else:
return "LSP: Fold"
return "LSP <debug>" # is_visible will return False

def run(
Expand Down

0 comments on commit b573b6b

Please sign in to comment.