about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-02-06Pass required features to cargo when using run actionMaybe Waffle-4/+21
When using `F1`->`Rust Analyzer: Run` action on an `example`, pass its `required-features` to `cargo run`. This allows to run examples that were otherwise impossible to run with RA.
2022-02-06Merge #11416bors[bot]-1/+13
11416: Fix eslint language server not working r=Veykril a=jackos Allows the language server for eslint to work inside VS Code. Before change: ![image](https://user-images.githubusercontent.com/77730378/152661637-c5d90678-39dc-4018-b884-fc4b6135368e.png) After change: ![image](https://user-images.githubusercontent.com/77730378/152661647-164c0655-aa6a-4c50-b49d-49cda112d149.png) Co-authored-by: Jack Clayton <jackclayto@gmail.com>
2022-02-06Merge #11420bors[bot]-69/+42
11420: fix two vulneabilities (moderate: 1, high: 1) by running npm audit r=lnicola a=HansAuger Again me getting familiar with the code base :D I noticed npm warning about two vulnerabilities ``` markdown-it <12.3.2 Severity: moderate Uncontrolled Resource Consumption in markdown-it - https://github.com/advisories/GHSA-6vfc-qv3f-vr6c fix available via `npm audit fix` node_modules/markdown-it vsce 1.26.0 - 2.6.3 Depends on vulnerable versions of markdown-it node_modules/vsce simple-get 3.0.0 - 3.1.0 Severity: high Exposure of Sensitive Information in simple-get - https://github.com/advisories/GHSA-wpg7-2c88-r8xv fix available via `npm audit fix` node_modules/simple-get ``` So I thought why not run `npm audit fix` Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2022-02-06fix two vulneabilities (moderate: 1, high: 1) by running npm auditMoritz Vetter-69/+42
2022-02-06Merge #11418bors[bot]-11/+7
11418: fix: Update dependency, fix Markdown references r=Veykril a=HansAuger Stumbled across this accidentally while familiarizing myself with the code base. Update `pulldown-cmark-to-cmark` Fix for #11008 Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2022-02-06Bump pulldown-cmark-to-cmark, adjust usages and fix testMoritz Vetter-11/+7
2022-02-06Fix eslint errorsJack Clayton-1/+13
2022-02-05Merge #11415bors[bot]-74/+54
11415: Downgrade `dashmap` and bump `thread_local` r=lnicola a=lnicola Closes #11341 bors r+ Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-05Bump thread_localLaurențiu Nicola-2/+2
2022-02-05Update lockfileLaurențiu Nicola-2/+2
2022-02-05Revert "Bump dashmap"Laurențiu Nicola-74/+54
This reverts commit 485f318b70bdc40bd71fa46748cc7053a5b8fd8a.
2022-02-05Merge #11412bors[bot]-4/+4
11412: fix: Include `fn`/`type`/`const` keyword in trait impl completion item source ranges r=Veykril a=The0x539 Fixes #11301 If the user has typed, say, `fn de` while implementing `Default`, or `type Ta` when implementing `Deref`, then the resulting completion suggestion will replace the entire "line", which, on its own, is fine. However, the use of `ctx.source_range()` in this code was meant that `source_range` field of the `CompletionItem` covers only the identifier and not the preceding keyword. Over in `rust_analyzer::to_proto::completion_item`, this caused the LSP completion response to be broken up into a text edit that replaces `de` with `fn default() -> Self {` and then an entry in `additional_text_edits` to remove the extra `fn`. I'm pretty sure that using the field like that is (slightly) out of [spec](https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#completionItem): > Edits must not overlap [...] with the main edit > Additional text edits should be used to change text **unrelated to the current cursor position** VS Code supports `additionalTextEdits` in such a way that this doesn't seem like a problem, so has gone largely unnoticed. The various LSP clients I've tried, however, do not, and as a result this bug has been haunting me for ages. Co-authored-by: The0x539 <the0x539@gmail.com>
2022-02-04Fix trait impl completion rangesThe0x539-4/+4
2022-02-04Merge #11411bors[bot]-24/+14
11411: minor: Simplify r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-04SimplifyLukas Wirth-24/+14
2022-02-03Merge #11406bors[bot]-27/+13
11406: Update install notes for bundled servers r=stanciuadrian a=lnicola r? `@stanciuadrian` Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-03Update install notesLaurențiu Nicola-27/+13
2022-02-03Merge #11403bors[bot]-92/+78
11403: internal: Shrink `mbe::ExpandError` and `mbe::ParseError` r=Veykril a=Veykril Also fixes https://github.com/rust-analyzer/rust-analyzer/issues/10051, as we no longer emit an empty diagnostic in some expansion cases which seems to trip up vscode for some reason. Using `compile_error!("")` will still trigger the vscode bug. bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-03Shrink `mbe::ExpandError` and `mbe::ParseError`Lukas Wirth-92/+78
2022-02-03Merge #11402bors[bot]-1/+17
11402: fix: Fix vis restriction path completions always using the parent module r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-03fix: Fix vis restriction path completions always using the parent moduleLukas Wirth-1/+17
2022-02-03Merge #11401bors[bot]-24/+130
11401: Sort completion calls lexicographically r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-03Add abi string completionsLukas Wirth-0/+106
2022-02-03Sort completion calls lexicographicallyLukas Wirth-24/+24
2022-02-03Merge #11397bors[bot]-356/+700
11397: internal: Refactor completion module split r=Veykril a=Veykril Currently our completion infra is split into several modules, each trying to do completions for something specific. This "something" is rather unstructured as it stands now, we have a module for `flyimporting path` completions, `unqualified` and `qualified path` completions, modules for `pattern position` completions that only try to complete extra things for patterns that aren't done in the path modules, `attribute` completions that again only try to add builtin attribute completions without adding the normal path completions and a bunch of other special "entity" completions like lifetimes, method call/field access, function param cloning, ... which serve a more specific purpose than the previous listed ones. As is evident, the former mentioned ones have some decent overlap which requires extra filtering in them so that they don't collide with each other duplicating a bunch of completions(which we had happen in the past at times). Now this overlap mostly happens with path completions(and keyword completions as well in some sense) which gives me the feeling that having `qualified` and `unqualified` path completions be separate from the rest gives us more troubles than benefits in the long run. So this is an attempt at changing this structure to instead still go by rough entity for special cases, but when it comes to paths we instead do the module split on the "path kinds"/"locations"(think pattern, type, expr position etc) that exist. This goes hand in hand with the test refactoring I have done that moved tests to "location oriented" modules as well as the `CompletionContext` refactoring that actually already started splitting the context up for path kinds. This PR moves some path completions out of the `qualified` and `unqualified` path modules namely attribute, visibility, use and pattern paths. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-03SimplifyLukas Wirth-37/+25
2022-02-03Move path completions for patterns into pattern moduleLukas Wirth-51/+215
2022-02-03Cleanup PathCompletionContext qualifier handlingLukas Wirth-91/+89
2022-02-03Add missing test for use completionsLukas Wirth-0/+19
2022-02-03Add completion module tailored towards visibility modifiersLukas Wirth-38/+76
2022-02-03Add completion module tailored towards use treesLukas Wirth-164/+269
2022-02-03Move attribute path completions into attribute completion moduleLukas Wirth-107/+139
2022-02-03Merge #11399bors[bot]-67/+107
11399: Fix assoc type shorthand from method bounds r=flodiebold a=flodiebold In code like this: ```rust impl<T> Option<T> { fn as_deref(&self) -> T::Target where T: Deref {} } ``` when trying to resolve the associated type `T::Target`, we were only looking at the bounds on the impl (where the type parameter is defined), but the method can add additional bounds that can also be used to refer to associated types. Hence, when resolving such an associated type, it's not enough to just know the type parameter T, we also need to know exactly where we are currently. This fixes #11364 (beta apparently switched some bounds around). Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-02-03Fix assoc type shorthand from method boundsFlorian Diebold-67/+107
In code like this: ```rust impl<T> Option<T> { fn as_deref(&self) -> T::Target where T: Deref {} } ``` when trying to resolve the associated type `T::Target`, we were only looking at the bounds on the impl (where the type parameter is defined), but the method can add additional bounds that can also be used to refer to associated types. Hence, when resolving such an associated type, it's not enough to just know the type parameter T, we also need to know exactly where we are currently. This fixes #11364 (beta apparently switched some bounds around).
2022-02-02Merge #11394bors[bot]-135/+199
11394: feat: Deprioritize completions of private but editable definitions r=Veykril a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-02Fix test fixtureLukas Wirth-1/+1
2022-02-02Merge #11395bors[bot]-55/+74
11395: fix: Fix and re-enable format string completions r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-02fix: Fix and re-enable format string completionsLukas Wirth-55/+74
2022-02-02Cleanup `Completions` api a bitLukas Wirth-77/+70
2022-02-02Fix generate_function assist trying to use name-ref like keywords for namesLukas Wirth-1/+10
2022-02-02feat: Deprioritize completions of private but editable definitionsLukas Wirth-58/+120
2022-02-01Merge #11322bors[bot]-29/+254
11322: Extract function also extracts comments r=Vannevelj a=Vannevelj Fixes #9011 The difficulty I came across is that the original assist works from the concept of a `ast::StmtList`, a node, but that does not allow me to (easily) represent comments, which are tokens. To combat this, I do a whole bunch of roundtrips: from the `ast::StmtList` I retrieve the `NodeOrToken`s it encompasses. I then cast all `Node` ones back to a `Stmt` so I can apply indentation to it, after which it is again parsed as a `NodeOrToken`. Lastly, I add a new `make::` api that accepts `NodeOrToken` rather than `StmtList` so we can write the comment tokens. Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-02-01Merge #11393bors[bot]-72/+160
11393: fix: Complete functions and methods from block level impls r=Veykril a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11372 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-01rollup matchJeroen Vannevel-6/+3
2022-02-01fix: Complete functions and methods from block level implsLukas Wirth-72/+160
2022-02-01Merge #11391bors[bot]-26/+43
11391: minor: Add some debug traces for cfg fetching r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-01minor: Add some debug traces for cfg fetchingLukas Wirth-26/+43
2022-02-01Merge #11390bors[bot]-9/+30
11390: fix: Deprioritize ops function completions for non-method calls r=Veykril a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10593 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-01Deprioritize ops function completions for non-method callsLukas Wirth-9/+30
2022-02-01better comparisonJeroen Vannevel-3/+1