-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract tags from test fixtures during parsing
Summary: The goal of this change is to ensure we can extract "tags" (used to specify ranges for folding, highlighting or other) from multi-file test fixtures. The original implementation of `extract_tags` was ported directly from Rust Analyzer, but it only supported extracting tags from a single-file fixture. Adding multi-file support is non trivial, though. In the current `check` function, we extract the tags from a snippet with no *metadata* lines, then generate a DB with the version of the snippet with the tags removed. The moment we want to support multiple files, we have a problem: we'd need to run the `extract_tags` function on each snippet, without the metadata lines, or the ranges would be off. We therefore move tags extraction to the parsing stage. In a test fixture, the user can specify an optional `tag` attribute (`fold` or tag` in the tests below), that can be used to extract tags from the snippet. The tags are stored in the `ChangeFixture`, so they can be later retrieved by `FileId`. In the test fixture used for the actual test, the tags are actually removed, so that the snippet still contains valid syntax. This is necessary for the ranges calculated from the snippet to coincide with the actual ranges (which would otherwise would be different due to syntax errors in the file). This ultimately allows us to write the test for `test_doc_attributes_with_included_file`, which highlights a current bug: ranges for definitions belonging to included files are reported for the incorrect file. This will be fixed as a follow-up diff. Reviewed By: alanz Differential Revision: D67160534 fbshipit-source-id: 4d61d5766e6fd973035285138eae342fe6d11108
- Loading branch information
1 parent
89a1636
commit e39ef85
Showing
6 changed files
with
128 additions
and
77 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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