aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ssr/src/parsing.rs
Commit message (Collapse)AuthorAgeFilesLines
* Rename ModuleItem -> ItemAleksey Kladov2020-07-291-4/+1
|
* SSR: Don't mix non-path-based rules with path-basedDavid Lattimore2020-07-291-1/+23
| | | | If any rules contain paths, then we reject any rules that don't contain paths. Allowing a mix leads to strange semantics, since the path-based rules only match things where the path refers to semantically the same thing, whereas the non-path-based rules could match anything. Specifically, if we have a rule like `foo ==>> bar` we only want to match the `foo` that is in the current scope, not any `foo`. However "foo" can be parsed as a pattern (BIND_PAT -> NAME -> IDENT). Allowing such a rule through would result in renaming everything called `foo` to `bar`. It'd also be slow, since without a path, we'd have to use the slow-scan search mechanism.
* SSR: Match paths based on what they resolve toDavid Lattimore2020-07-241-16/+1
| | | | Also render template paths appropriately for their context.
* SSR: Parse template as Rust code.David Lattimore2020-07-241-32/+28
| | | | | | This is in preparation for a subsequent commit where we add special handling for paths in the template, allowing them to be qualified differently in different contexts.
* SSR: Change the way rules are stored internally.David Lattimore2020-07-241-30/+76
| | | | | | | | | | | | | | | | | | | | | | Previously we had: - Multiple rules - Each rule had its pattern parsed as an expression, path etc This meant that there were two levels at which there could be multiple rules. Now we just have multiple rules. If a pattern can parse as more than one kind of thing, then they get stored as multiple separate rules. We also now don't have separate fields for the different kinds of things that a pattern can parse as. This makes adding new kinds of things simpler. Previously, add_search_pattern would construct a rule with a dummy replacement. Now the replacement is an Option. This is slightly cleaner and also opens the way for parsing the replacement template as the same kind of thing as the search pattern.
* SSR: Extract error code out to a separate moduleDavid Lattimore2020-07-031-14/+3
| | | | | This is to make reusing it outside of parsing easier in a subsequent change.
* SSR: Use T! instead of SyntaxKind::* where possibleDavid Lattimore2020-07-021-11/+11
|
* SSR: Add initial support for placeholder constraintsDavid Lattimore2020-07-011-5/+87
|
* Fix some typosDavid Lattimore2020-06-301-1/+1
|
* Use more of FxHash*Laurențiu Nicola2020-06-291-1/+1
|
* Allow SSR to match type references, items, paths and patternsDavid Lattimore2020-06-221-0/+272
Part of #3186