Skip to content

Commit 596677e

Browse files
committed
doc: add document about folding range feature
1 parent 28ec6f8 commit 596677e

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ and [Emacs](https://fortls.fortran-lang.org/editor_integration.html#emacs).
6161
- Code actions
6262
- Generate type-bound procedures and implementation templates for
6363
deferred procedures
64+
- Folding ranges
65+
- Detect folding ranges based on Fortran syntax or indent as well as
66+
consecutive comment lines
6467

6568
### Notes/Limitations
6669

@@ -150,6 +153,7 @@ An example for a Configuration file is given below
150153
| `textDocument/didClose` | Document synchronisation upon closing |
151154
| `textDocument/didChange` | Document synchronisation upon changes to the document |
152155
| `textDocument/codeAction` | **Experimental** Generate code |
156+
| `textDocument/foldingRange | Get folding ranges based on Fortran syntax and indent |
153157

154158
## Future plans
155159

docs/options.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ All the ``fortls`` settings with their default arguments can be found below
7676
7777
"symbol_skip_mem": false,
7878
79-
"enable_code_actions": false
79+
"enable_code_actions": false,
80+
81+
"folding_range_mode": "indent",
82+
"folding_range_comment_lines": 3
8083
}
8184
8285
Sources file parsing

fortls/folding_ranges.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class FoldingRange(TypedDict, total=False):
2222

2323
def get_folding_ranges_by_block_comment(file_obj: FortranFile, min_block_size: int):
2424
"""
25-
Get the folding ranges in this file based on the block comment
25+
Get the folding ranges in the given file based on the block comment
2626
2727
Returns
2828
-------
@@ -82,7 +82,7 @@ def finalize(self, max_line_index: int):
8282

8383
def get_folding_ranges_by_indent(file_obj: FortranFile) -> list[FoldingRange]:
8484
"""
85-
Get the folding ranges in this file based on the indent
85+
Get the folding ranges in the given file based on the indent
8686
8787
Returns
8888
-------
@@ -174,7 +174,7 @@ def finalize(self, num_lines: int):
174174

175175
def get_folding_ranges_by_syntax(file_obj: FortranFile) -> list[FoldingRange]:
176176
"""
177-
Get the folding ranges in this file based on the syntax
177+
Get the folding ranges in the given file based on the syntax
178178
179179
Returns
180180
-------

0 commit comments

Comments
 (0)