aboutsummaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
* Merge #5518bors[bot]2020-07-2416-389/+1411
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5518: Use resolved paths in SSR rules r=matklad a=davidlattimore The main user-visible changes are: * SSR now matches paths based on whether they resolve to the same thing instead of whether they're written the same. * So `foo()` won't match `foo()` if it's a different function `foo()`, but will match `bar::foo()` if it's the same `foo`. * Paths in the replacement will now be rendered with appropriate qualification for their context. * For example `foo::Bar` will render as just `Bar` inside the module `foo`, but might render as `baz::foo::Bar` from elsewhere. * This means that all paths in the search pattern and replacement template must be able to be resolved. * It now also matters where you invoke SSR from, since paths are resolved relative to wherever that is. * Search now uses find-uses on paths to locate places to try matching. This means that when a path is present in the pattern, search will generally be pretty fast. * Function calls can now match method calls again, but this time only if they resolve to the same function. Co-authored-by: David Lattimore <[email protected]>
| * SSR: Allow function calls to match method callsDavid Lattimore2020-07-246-25/+169
| | | | | | | | | | | | | | | | | | | | | | 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-242-1/+51
| | | | | | | | | | It currently does the wrong thing when the use declaration contains braces.
| * SSR: Use Definition::find_usages to speed up matching.David Lattimore2020-07-245-24/+157
| | | | | | | | 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-249-61/+482
| | | | | | | | Also render template paths appropriately for their context.
| * SSR: Pass current file position through to SSR code.David Lattimore2020-07-248-28/+69
| | | | | | | | In a subsequent commit, it will be used for resolving paths.
| * SSR: Refactor to not rely on recursive search for nesting of matchesDavid Lattimore2020-07-244-27/+120
| | | | | | | | | | | | | | | | | | 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.
| * SSR: Add a couple of tests for non-recursive searchDavid Lattimore2020-07-241-0/+33
| | | | | | | | | | These tests already pass, however once we switch to non-recursive search, it'd be easy for these tests to not pass.
| * SSR tests: Define all paths needed for templatesDavid Lattimore2020-07-241-26/+76
| | | | | | | | | | | | | | In a later commit, paths in templates will be resolved. This allows us to render the path with appropriate qualifiers for its context. Here we prepare for that change by updating existing tests where I'd previously not bothered to define the items that the template referred to.
| * Move iteration over all files into the SSR crateDavid Lattimore2020-07-246-89/+92
| | | | | | | | 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-242-48/+56
| | | | | | | | | | | | 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.
| * SSR: Parse template as Rust code.David Lattimore2020-07-245-82/+112
| | | | | | | | | | | | 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-244-107/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Use expect! in testsDavid Lattimore2020-07-242-37/+37
| |
* | Cache macro expansion in semanticsAleksey Kladov2020-07-241-2/+14
| | | | | | | | | | #5497 accidentally made syntax highlighting quadratic, due to repeated tokentreeizing of macros.
* | Add missing cancellation pointAleksey Kladov2020-07-241-0/+1
|/
* Merge #5515bors[bot]2020-07-241-0/+1
|\ | | | | | | | | | | | | | | | | | | | | 5515: Add profiling call r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Add profiling callAleksey Kladov2020-07-241-0/+1
| |
* | Merge #5511bors[bot]2020-07-231-3/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | 5511: Set the document version after changes are applied but before vfs r=kjeremy a=kjeremy Co-authored-by: kjeremy <[email protected]>
| * | Set the document version after changes are applied but before vfskjeremy2020-07-231-3/+6
| |/
* / Lighter weight tempdirAleksey Kladov2020-07-234-10/+75
|/
* Require quotes around key-value cfg flags in rust-project.jsonAleksey Kladov2020-07-236-71/+107
| | | | This matches rustc command-line flags, as well as the build.rs format.
* Merge #5506bors[bot]2020-07-234-8/+9
|\ | | | | | | | | | | | | | | | | | | | | 5506: Rename modules r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Rename modulesAleksey Kladov2020-07-234-8/+9
| |
* | Merge #5505bors[bot]2020-07-236-67/+44
|\| | | | | | | | | | | | | | | | | | | | | 5505: Cleanup CFG API r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Cleanup CFG APIAleksey Kladov2020-07-236-63/+44
| |
| * Remove dead codeAleksey Kladov2020-07-231-4/+0
| |
* | Merge #5473bors[bot]2020-07-237-106/+89
|\ \ | |/ |/| | | | | | | | | | | 5473: Changes to rust-project.json r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
| * More Rustic API for EnvAleksey Kladov2020-07-214-20/+8
| |
| * Replace OUT_DIR in project.json with general envAleksey Kladov2020-07-212-9/+7
| | | | | | | | OUT_DIR doesn't make sense here, as this is a cargo-specific concept
| * Replace roots with include/exclude directoriesAleksey Kladov2020-07-212-31/+32
| |
| * Expose package roots more directlyAleksey Kladov2020-07-213-54/+50
| |
* | Merge #5504bors[bot]2020-07-231-3/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5504: Reduce visibility r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Reduce visibilityAleksey Kladov2020-07-231-3/+3
| | |
* | | Merge #5498bors[bot]2020-07-231-1/+1
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | 5498: assists: change_return_type_to_result: clarify assist description r=matklad a=matthiaskrgr I had a -> Option<PathBuf> fn, which I wanted to change to Result<PathBuf, _>, but despite advertising to do so, the assist did not change the result type to Result<PathBuf, _> but instead just wrapped it in a Result: <Result<Option<PathBuf>, _>. I changed the assist description to "Wrap return type in Result" to clarify that the assist only wraps the preexisting type and does not do any actual Option-to-Result refactoring. Co-authored-by: Matthias Krüger <[email protected]>
| * | assists: change_return_type_to_result: clarify assist descriptionMatthias Krüger2020-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | I had a -> Option<PathBuf> fn, which I wanted to change to Result<PathBuf, _>, but despite advertising to do so, the assist did not change the result type to Result<PathBuf, _> but instead just wrapped it in a Result: <Result<Option<PathBuf>, _>. I changed the assist description to "Wrap return type in Result" to clarify that the assist only wraps the preexisting type and does not do any deep Option-to-Result refactoring.
* | | Merge #5503bors[bot]2020-07-233-5/+36
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5503: Replace superslice with API on path to stabilization r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Replace superslice with API on path to stabilizationAleksey Kladov2020-07-233-5/+36
| | | |
* | | | Merge #5497bors[bot]2020-07-235-13/+20
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | 5497: Store macro invocation parameters as text instead of tt r=jonas-schievink a=lnicola We don't want to expand macros on every source change because it can be arbitrarily slow, but the token trees can be rather large. So instead we can cache the invocation parameters (as text). Co-authored-by: Laurențiu Nicola <[email protected]>
| * | | Store macro invocation parameters as text instead of ttLaurențiu Nicola2020-07-225-13/+20
| | | |
* | | | minorAleksey Kladov2020-07-231-16/+16
| |/ / |/| |
* | | Move deprecated attribute to where it is neededkjeremy2020-07-221-2/+6
| | |
* | | Use symbol tagskjeremy2020-07-222-2/+18
| | |
* | | Merge #5481bors[bot]2020-07-223-15/+40
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | 5481: Track document versions in the server r=kjeremy a=kjeremy This also pushes diagnostics for the correct file version on close so that when it is reopened stale diagnostics are not shown. Closes #5452 Co-authored-by: kjeremy <[email protected]> Co-authored-by: Jeremy Kolb <[email protected]>
| * | Update crates/rust-analyzer/src/main_loop.rsJeremy Kolb2020-07-221-1/+1
| | | | | | | | | Co-authored-by: Aleksey Kladov <[email protected]>
| * | Clear diagnostics for known file version on closekjeremy2020-07-211-3/+10
| | |
| * | Store document version and pass back to the clientkjeremy2020-07-213-13/+31
| | |
* | | Merge #5475bors[bot]2020-07-226-26/+270
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5475: Support `Trait as _` imports r=matklad a=jonas-schievink Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2736 Co-authored-by: Jonas Schievink <[email protected]>
| * | | Check that visibility upgrade path is hitJonas Schievink2020-07-222-4/+8
| | | |
| * | | Support `Trait as _` importsJonas Schievink2020-07-216-26/+266
| |/ /