Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Move rust-analyzer extension into this repository #816

Merged
merged 1,092 commits into from
Jul 13, 2020

Conversation

matklad
Copy link
Member

@matklad matklad commented Jul 13, 2020

r? @Xanewok

This just copy-pastes (with history) rust-analyzer plugin into ./rust-analyzer directory, so that it's easier to move functionality into the merged plugin. That is, I expect us to drain this ./rust-analyzer directory after this RP

bors bot and others added 30 commits April 8, 2020 20:39
3899: Enable the SemanticTokensFeature by default r=matklad a=kjeremy

This is covered under vscode's "editor.semanticHighlighting.enabled"
setting plus the user has to have a theme that has opted into highlighting.

Bumps required vscode stable to 1.44

Closes #3773 

Co-authored-by: kjeremy <[email protected]>
3942: vscode: fix typing bug in config r=matklad a=Veetaha

I noticed that the type of nullable properties in config is actually non-nullable
![Screenshot from 2020-04-11 15-29-45](https://user-images.githubusercontent.com/36276403/79043702-6a686d80-7c09-11ea-9ae8-f1a777c7d0f2.png)


Co-authored-by: veetaha <[email protected]>
The default parentModule shortcut conflicts with VSCode's built-in undo selection
3962: Fix parentModule shortcut conflict r=matklad a=CodeSandwich

The default parentModule shortcut conflicts with VSCode's built-in undo selection

Co-authored-by: Igor Żuk <[email protected]>
3948: fix: inlay hints config desyncronization between the frontend and the backend r=matklad a=Veetaha

See the explanation in the issue comment:
rust-lang/rust-analyzer#3924 (comment)

Workaround-ly fixes: #3924

Co-authored-by: veetaha <[email protected]>
This is a quick way to implement unresolved reference diagnostics.
For example, adding to VS Code config

    "editor.tokenColorCustomizationsExperimental": {
        "unresolvedReference": "#FF0000"
    },

will highlight all unresolved refs in red.
4081: Work around crlf in syntax tree r=matklad a=Veetaha

Workarounds fixes #4067 

Co-authored-by: veetaha <[email protected]>
We use `enable`, not `enabled` elsewhere
4090: Fix config naming r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <[email protected]>
Move the task provider anonymous class into a real class, as this seems
to be how Microsoft do this in their documentation.

resolveTask is now implemented, which is used by VSCode to determine how
to execute tasks that the user has defined in tasks.json.
We are transitioning from experimental to production-ready stance, so
it makes sense to disable potentially disruptive features by default.
4107: Disable onEnter command by default r=matklad a=matklad

We are transitioning from experimental to production-ready stance, so
it makes sense to disable potentially disruptive features by default.



bors r+
🤖

Co-authored-by: Aleksey Kladov <[email protected]>
3998: Make add_function generate functions in other modules via qualified path r=matklad a=TimoFreiberg

Additional feature for #3639 

- [x] Add tests for paths with more segments
- [x] Make generating the function in another file work
- [x] Add `pub` or `pub(crate)` to the generated function if it's generated in a different module
- [x] Make the assist jump to the edited file
- [x] Enable file support in the `check_assist` helper

4006: Syntax highlighting for format strings r=matklad a=ltentrup

I have an implementation for syntax highlighting for format string modifiers `{}`.
The first commit refactors the changes in #3826 into a separate struct.
The second commit implements the highlighting: first we check in a macro call whether the macro is a format macro from `std`. In this case, we remember the format string node. If we encounter this node during syntax highlighting, we check for the format modifiers `{}` using regular expressions.

There are a few places which I am not quite sure:
- Is the way I extract the macro names correct?
- Is the `HighlightTag::Attribute` suitable for highlighting the `{}`?

Let me know what you think, any feedback is welcome!

Co-authored-by: Timo Freiberg <[email protected]>
Co-authored-by: Leander Tentrup <[email protected]>
Co-authored-by: Leander Tentrup <[email protected]>
4145: Remove dead code r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <[email protected]>
bors bot and others added 25 commits July 2, 2020 09:12
5089: Disable auto-complete on comments r=matklad a=BGluth

Resolves #4907 by disabling any auto-completion on comments.

As flodiebold [pointed out](rust-lang/rust-analyzer#4907 (comment)), in the future we may want to support some form of auto-completion within doc comments, but for now it was suggested to just disable auto-completion on them entirely.

The implementation involves adding a new field `is_comment` to `CompletionContext` and checking if the immediate token we auto-completed on is a comment. I couldn't see a case where we need to check any of the ancestors, but let me know if this is not sufficient. I also wasn't sure if it was necessary to add a new field to this struct, but I decided it's probably the best option if we want to potentially do auto-completion on doc comments in the future.

Finally, the three tests I added should I think ideally not filter results by `CompletionKind::Keyword`, but if I want to get unfiltered results, I need access to a non-public function [get_all_completion_items](https://github.com/rust-analyzer/rust-analyzer/blob/9a4d02faf9c47f401b8756c3f7fcab2198f5f9cd/crates/ra_ide/src/completion/test_utils.rs#L32-L39) which I don't know if I should make public just for this.



5161: SSR: Add initial support for placeholder constraints r=matklad a=davidlattimore



5184: Always install required nightly extension if current one is not nightly r=matklad a=Veetaha

This is weird, but having switched back to stable by uninstalling the extension appears that vscode doesn't destroy the `PersistentState` and thus changing to `nightly` channel doesn't work because the last check for nightly extension was less than 1 hour ago. The simple solution is to skip this check if we know that the current extension version is not nightly.

5185: Force showing extension activation error pop-up notification r=matklad a=Veetaha

Fixes rust-lang/rust-analyzer#5091

5186: fix: correct pd/ppd/tfn/tmod completion doc r=matklad a=fannheyward

https://github.com/rust-analyzer/rust-analyzer/blob/a33eefa3b26000b3018e6bb873f18dbe15ab4ab7/crates/ra_ide/src/completion/complete_snippet.rs#L23-L24

Co-authored-by: BGluth <[email protected]>
Co-authored-by: David Lattimore <[email protected]>
Co-authored-by: Veetaha <[email protected]>
Co-authored-by: Heyward Fann <[email protected]>
5188: Implement StatusBar r=matklad a=matklad



Co-authored-by: Aleksey Kladov <[email protected]>
5202: Runnable env r=matklad a=vsrs

This PR adds on option to specify (in the settings.json) environment variables passed to the runnable.
The simplest way for all runnables in a bunch:
```jsonc
    "rust-analyzer.runnableEnv": {
        "RUN_SLOW_TESTS": "1"
    }
```

Or it is possible to specify vars more granularly:
```jsonc
    "rust-analyzer.runnableEnv": [
        {
            // "mask": null, // null mask means that this rule will be applied for all runnables
            env: {
                 "APP_ID": "1",
                 "APP_DATA": "asdf"
            }
        },
        {
            "mask": "test_name",
            "env": {
                 "APP_ID": "2", // overwrites only APP_ID
            }
        }
    ]
```

You can use any valid RegExp as a mask. Also note that a full runnable name is something like *run bin_or_example_name*, *test some::mod::test_name* or *test-mod some::mod*, so it is possible to distinguish binaries, single tests, and test modules with this masks: `"^run"`, `"^test "` (the trailing space matters!), and `"^test-mod"` respectively.

Fixes #4450

I suppose this info should be somewhere in the docs, but unsure where is the best place.

Co-authored-by: vsrs <[email protected]>
5203: Fix typo in description of vscode setting r=matklad a=Nashenas88



Co-authored-by: Paul Daniel Faria <[email protected]>
This reverts commit 2c88563.
That commit was wrong because we use-after-free the logger
5235: Don't ping people in PRs r=matklad a=lnicola



5236: Disable ES module interop r=matklad a=lnicola



5241: Clippy perf warnings r=matklad a=kjeremy

Removes redundant clones

Co-authored-by: Laurențiu Nicola <[email protected]>
Co-authored-by: Aleksey Kladov <[email protected]>
Co-authored-by: kjeremy <[email protected]>
Co-authored-by: bjorn3 <[email protected]>

Override miniz_oxide to build it with optimizations

Building this crate with optimizations decreases the gzipping
part of `cargo xtask dist` from `30-40s` down to `3s`,
the overhead for `rustc` to apply optimizations is miserable on this background
4972: Gzip artifacts r=Veetaha a=Veetaha

[Here is the test release](https://github.com/Veetaha/rust-analyzer/releases/tag/2020-06-21)

Change in size:  `~ 25 MB -> ~ 8 MB (gzipped)`

The time to gzip during the dist build takes a somewhat considerable amount of time tho.
Having already compiled artifacts this takes in debug mode:
```
~/dev/rust-analyzer (feat/gzip-binaries) $ time cargo xtask dist
    Finished dev [unoptimized] target(s) in 0.06s
     Running `target/debug/xtask dist`
> cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release
    Finished release [optimized] target(s) in 0.05s
> strip ./target/release/rust-analyzer

real    0m34.331s
user    0m34.245s
sys     0m0.078s
```
In release mode this is much faster:
```
~/dev/rust-analyzer (feat/gzip-binaries) $ time cargo run -p xtask --release -- dist
    Finished release [optimized] target(s) in 0.04s
     Running `target/release/xtask dist`
> cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release
    Finished release [optimized] target(s) in 0.06s
> strip ./target/release/rust-analyzer

real    0m2.401s
```

**[UPD]** adding a profile override for `miniz_oxide` does the thing to ensure good performrance

We might need to notify all other ra plugins' maintainers about the change in our GH releases if we merge this PR, or we could leave uncompressed files along with gzipped for a while until everyone migrates.

Co-authored-by: Veetaha <[email protected]>
5262: Workaround rollup messing up default imports r=matklad a=Veetaha

Tackles rust-lang/rust-analyzer#5257 (comment)
Related: rollup/plugins#491

Co-authored-by: Veetaha <[email protected]>
@lnicola
Copy link
Member

lnicola commented Jul 13, 2020

I guess lodash was finally fixed? CI fails because of npm audit.

@Xanewok
Copy link
Member

Xanewok commented Jul 13, 2020

@matklad awesome, thanks! let's merge this now and sort out lodash dep separately

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.