aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ssr/src/search.rs
Commit message (Collapse)AuthorAgeFilesLines
* Rename UseItem -> UseAleksey Kladov2020-07-301-1/+1
|
* SSR: Restrict to current selection if anyDavid Lattimore2020-07-291-23/+64
| | | | | The selection is also used to avoid unnecessary work, but only to the file level. Further restricting unnecessary work is left for later.
* SSR: Allow function calls to match method callsDavid Lattimore2020-07-241-21/+44
| | | | | | | | | | | This differs from how this used to work before I removed it in that: a) It's only one direction. Function calls in the pattern can match method calls in the code, but not the other way around. b) We now check that the function call in the pattern resolves to the same function as the method call in the code. The lack of (b) was the reason I felt the need to remove the feature before.
* SSR: Disable matching within use declarationsDavid Lattimore2020-07-241-1/+28
| | | | | It currently does the wrong thing when the use declaration contains braces.
* SSR: Use Definition::find_usages to speed up matching.David Lattimore2020-07-241-5/+126
| | | | When the search pattern contains a path, this substantially speeds up finding matches, especially if the path references a private item.
* SSR: Match paths based on what they resolve toDavid Lattimore2020-07-241-4/+4
| | | | Also render template paths appropriately for their context.
* SSR: Refactor to not rely on recursive search for nesting of matchesDavid Lattimore2020-07-241-25/+13
| | | | | | | | | Previously, submatches were handled simply by searching in placeholders for more matches. That only works if we search all nodes in the tree recursively. In a subsequent commit, I intend to make search not always be recursive recursive. This commit prepares for that by finding all matches, even if they overlap, then nesting them and removing overlapping matches.
* Move iteration over all files into the SSR crateDavid Lattimore2020-07-241-1/+20
| | | | The methods `edits_for_file` and `find_matches_in_file` are replaced with just `edits` and `matches`. This simplifies the API a bit, but more importantly it makes it possible in a subsequent commit for SSR to decide to not search all files.
* SSR: Move search code into a submoduleDavid Lattimore2020-07-241-0/+54
Also renamed find_matches to slow_scan_node to reflect that it's a slow way to do things. Actually the name came from a later commit and probably makes more sense once there's an alternative.