Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion en/clice/features/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Language Server Protocol features available when using clice as an editor backen
| [Document Links](./document-links.md) | 7 supported · 1 partial |
| [Document Symbols](./document-symbols.md) | 29 supported |
| [Folding Ranges](./folding-ranges.md) | 19 supported |
| [Selection Ranges](./selection-ranges.md) | 10 supported |
| [Selection Ranges](./selection-ranges.md) | 14 supported |
| [Formatting](./formatting.md) | 4 supported |
| [C++20 Modules](./modules.md) | 7 supported |
| [Header Contexts](./header-contexts.md) | 5 supported |
Expand Down
67 changes: 67 additions & 0 deletions en/clice/features/selection-ranges.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,50 @@ tests/selection_range/syntax_ranges/07_blocks

<!-- END CAPABILITY -->

<!-- BEGIN CAPABILITY: supported -->

**Function signatures**

A function's name is selected with its signature before the whole declaration

The signature runs from the return type, or from the name of a
constructor, through the parameters and what the declaration adds after
them, such as `const noexcept`, a trailing return type, `override` or a
`requires` clause.

```case
tests/selection_range/syntax_ranges/11_function_signatures
```

<!-- END CAPABILITY -->

<!-- BEGIN CAPABILITY: supported -->

**Switch cases**

A `case` label is selected with the statements it leads before the whole switch body

```case
tests/selection_range/syntax_ranges/15_switch_cases
```

<!-- END CAPABILITY -->

<!-- BEGIN CAPABILITY: supported -->

**Documented declarations**

A declaration is selected with the comment documenting it, from inside either one

Inside a block comment over several lines, the line under the cursor
comes first, without the `*` it begins with.

```case
tests/selection_range/syntax_ranges/19_documented_declarations
```

<!-- END CAPABILITY -->

<!-- END GENERATED ITEMS -->

## Text Ranges
Expand Down Expand Up @@ -157,3 +201,26 @@ tests/selection_range/text_ranges/03_directives
<!-- END CAPABILITY -->

<!-- END GENERATED ITEMS -->

## Conditional Compilation

Steps through the code of `#if` blocks, the branches the preprocessor skipped included.

<!-- BEGIN GENERATED ITEMS: selection_range/conditionals -->

<!-- BEGIN CAPABILITY: supported -->

**Conditional blocks**

The lines of a conditional's branch and the whole `#if` through `#endif` are selected after the code inside them

A branch the preprocessor skipped gets the same steps, so its code can
be selected as a whole.

```case
tests/selection_range/conditionals/03_conditional_blocks
```

<!-- END CAPABILITY -->

<!-- END GENERATED ITEMS -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
{
"id": "selection_range/conditionals/03_conditional_blocks",
"topic": "selection_range",
"subtopic": "conditionals",
"title": "Conditional blocks",
"summary": "The lines of a conditional's branch and the whole `#if` through `#endif` are selected after the code inside them",
"prose": "A branch the preprocessor skipped gets the same steps, so its code can\nbe selected as a whole.",
"status": "supported",
"issues": [],
"files": [
{
"path": "main.cpp",
"text": "#define FAST 1\n\nint pick(int value) {\n#if FAST\n value *= 2;\n return value;\n#else\n return value + 1;\n#endif\n}\n\n#ifdef FAST\nint fast_enabled = 1;\n#endif\n",
"markers": [
{
"name": "active",
"begin": 74,
"end": 74,
"range": false
},
{
"name": "skipped",
"begin": 98,
"end": 98,
"range": false
},
{
"name": "directive",
"begin": 126,
"end": 126,
"range": false
}
]
}
],
"tests": [
{
"name": "answers",
"blocks": [
{
"label": "active",
"marker": "active",
"value": {
"selection_ranges": [
{
"$place": "return ⟦value⟧;",
"path": "main.cpp",
"range": {
"start": {
"line": 5,
"character": 11
},
"end": {
"line": 5,
"character": 16
}
}
},
{
"$place": "⟦return value⟧;",
"path": "main.cpp",
"range": {
"start": {
"line": 5,
"character": 4
},
"end": {
"line": 5,
"character": 16
}
}
},
{
"$place": "⟦return value;⟧",
"path": "main.cpp",
"range": {
"start": {
"line": 5,
"character": 4
},
"end": {
"line": 5,
"character": 17
}
}
},
{
"$place": "⟦value *= 2; … return value;⟧ (2 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 4,
"character": 4
},
"end": {
"line": 5,
"character": 17
}
}
},
{
"$place": "⟦#if FAST … #endif⟧ (6 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 3,
"character": 0
},
"end": {
"line": 8,
"character": 6
}
}
},
{
"$place": "int pick(int value) ⟦{ … }⟧ (8 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 2,
"character": 20
},
"end": {
"line": 9,
"character": 1
}
}
},
{
"$place": "⟦int pick(int value) { … }⟧ (8 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 2,
"character": 0
},
"end": {
"line": 9,
"character": 1
}
}
}
]
}
},
{
"label": "skipped",
"marker": "skipped",
"value": {
"selection_ranges": [
{
"$place": "return ⟦value⟧ + 1;",
"path": "main.cpp",
"range": {
"start": {
"line": 7,
"character": 11
},
"end": {
"line": 7,
"character": 16
}
}
},
{
"$place": "⟦return value + 1;⟧",
"path": "main.cpp",
"range": {
"start": {
"line": 7,
"character": 4
},
"end": {
"line": 7,
"character": 21
}
}
},
{
"$place": "⟦#if FAST … #endif⟧ (6 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 3,
"character": 0
},
"end": {
"line": 8,
"character": 6
}
}
},
{
"$place": "int pick(int value) ⟦{ … }⟧ (8 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 2,
"character": 20
},
"end": {
"line": 9,
"character": 1
}
}
},
{
"$place": "⟦int pick(int value) { … }⟧ (8 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 2,
"character": 0
},
"end": {
"line": 9,
"character": 1
}
}
}
]
}
},
{
"label": "directive",
"marker": "directive",
"value": {
"selection_ranges": [
{
"$place": "#ifdef ⟦FAST⟧",
"path": "main.cpp",
"range": {
"start": {
"line": 11,
"character": 7
},
"end": {
"line": 11,
"character": 11
}
}
},
{
"$place": "⟦#ifdef FAST⟧",
"path": "main.cpp",
"range": {
"start": {
"line": 11,
"character": 0
},
"end": {
"line": 11,
"character": 11
}
}
},
{
"$place": "⟦#ifdef FAST … #endif⟧ (3 lines)",
"path": "main.cpp",
"range": {
"start": {
"line": 11,
"character": 0
},
"end": {
"line": 13,
"character": 6
}
}
}
]
}
}
]
}
]
}
Loading
Loading