Repository navigation
feat(tests): generate folding-ranges doc from snapshot fixtures #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fb5469b
feat(tests): generate folding-ranges doc from snapshot fixtures
16bit-ykiko 92a2354
fix(tests): strip fixture spec headers before compiling
16bit-ykiko 81bae73
fix(tests): only strip fixture headers that carry spec keys
16bit-ykiko b4617a6
fix(tests): align spec-header detection with parse_fixture grammar
16bit-ykiko 5e41df3
fix(tests): harden spec-header parsing edge cases
16bit-ykiko c2554d6
fix(tests): mirror key grammar exactly and harden doc code fences
16bit-ykiko 68516c9
fix(tests): match region markers as whole lines only
16bit-ykiko e52e07c
refactor(tests): fixture frontmatter as plain key block
16bit-ykiko 9685e37
fix(tests): reject duplicate generated regions
16bit-ykiko cc41482
refactor(tests): drop reserved-character check in doc fixtures
16bit-ykiko 4e803ce
refactor(tests): pure-markdown fixture headers, directory sections
16bit-ykiko 308f05f
fix(tests): mirror doc-title grammar in fixture helper
16bit-ykiko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
tests/data/folding_range/fold_kinds/access_specifier_folding.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /// # Access-specifier section folding — `public:` / `protected:` / `private:` regions within a class | ||
| /// | ||
| /// - status: supported | ||
| /// - issues: clangd#1455 | ||
| /// - order: 4 | ||
|
|
||
| class Widget { | ||
| public: // ┐ | ||
| void draw(); // │ foldable | ||
| void resize(); // ┘ | ||
| private: // ┐ | ||
| int width; // │ foldable | ||
| int height; // ┘ | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /// # Block folding — functions, classes, structs, unions, enums, namespaces, lambdas | ||
| /// | ||
| /// - status: supported | ||
| /// - order: 1 | ||
|
|
||
| namespace geometry { | ||
|
|
||
| enum class Shape { | ||
| Circle, | ||
| Square, | ||
| Triangle | ||
| }; | ||
|
|
||
| struct Point { | ||
| int x; | ||
| int y; | ||
| }; | ||
|
|
||
| union Value { | ||
| int as_int; | ||
| float as_float; | ||
| }; | ||
|
|
||
| class Canvas { | ||
| Point origin; | ||
|
|
||
| int area() { | ||
| auto scale = [](int factor) { | ||
| return factor * 2; | ||
| }; | ||
| return scale(4); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace geometry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /// # Comment folding — multi-line `/* */` and consecutive `//` line comments | ||
| /// | ||
| /// - status: unsupported | ||
| /// - order: 7 | ||
|
|
||
| // This is a long | ||
| // multi-line comment | ||
| // that should fold as one region | ||
|
|
||
| /* | ||
| * Block comment | ||
| * should also fold | ||
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /// # Include region folding — consecutive `#include` directives | ||
| /// | ||
| /// - status: unsupported | ||
| /// - order: 8 | ||
|
|
||
| #include <vector> // ┐ | ||
| #include <string> // │ foldable region | ||
| #include <algorithm> // ┘ | ||
|
|
||
| #include "app.h" // ┐ separate region | ||
| #include "config.h" // ┘ (blank line separates) | ||
33 changes: 33 additions & 0 deletions
33
tests/data/folding_range/fold_kinds/multiline_list_folding.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /// # Multi-line list folding — function parameters, call arguments, initializer lists, lambda captures | ||
| /// | ||
| /// - status: supported | ||
| /// - order: 3 | ||
|
|
||
| void configure( | ||
| int width, // ┐ | ||
| int height, // │ foldable parameter list | ||
| bool fullscreen // ┘ | ||
| ); | ||
|
|
||
| int compute(int a, int b, int c); | ||
|
|
||
| void demo() { | ||
| int values[] = { | ||
| 1, // ┐ | ||
| 2, // │ foldable initializer list | ||
| 3 // ┘ | ||
| }; | ||
|
|
||
| int result = compute( | ||
| values[0], // ┐ | ||
| values[1], // │ foldable argument list | ||
| values[2] // ┘ | ||
| ); | ||
|
|
||
| auto sum = [ | ||
| first = values[0], // ┐ | ||
| second = values[1] // ┘ foldable lambda capture | ||
| ] { | ||
| return first + second; | ||
| }; | ||
| } |
12 changes: 12 additions & 0 deletions
12
tests/data/folding_range/fold_kinds/nested_compound_statement.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /// # Nested compound-statement folding — `if`/`for`/`while` bodies inside functions | ||
| /// | ||
| /// - status: unsupported | ||
| /// - order: 2 | ||
|
|
||
| void process(int count) { | ||
| if (count > 0) { // ┐ | ||
| for (int i = 0; i < count; ++i) { // │ nested blocks that could | ||
| // ... work ... // │ fold independently of | ||
| } // │ the enclosing function | ||
| } // ┘ | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.