Commit graph

932 commits

Author SHA1 Message Date
Aleksey Kladov
0866b1be89 Align diagnostics config with the rest of rust-analyzer 2020-08-18 16:03:15 +02:00
bors[bot]
b8dfc331ab
Merge #5682
5682: Add an option to disable diagnostics r=matklad a=popzxc

As far as I know, currently it's not possible to disable a selected type of diagnostics provided by `rust-analyzer`.

This causes an inconvenient situation with a false-positive warnings: you either have to disable all the diagnostics, or you have to ignore these warnings.

There are some open issues related to this problem, e.g.: https://github.com/rust-analyzer/rust-analyzer/issues/5412, https://github.com/rust-analyzer/rust-analyzer/issues/5502

This PR attempts to make it possible to selectively disable some diagnostics on per-project basis.

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-08-18 12:04:49 +00:00
bors[bot]
7d95a8447c
Merge #5776 #5780
5776: Fix eslint errors on .eslintrc.js and rollup.config.js r=matklad a=fuafa

Eslint complains if these two files does not include in the `tsconfig.json`.
```
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided.eslint
```
![image](https://user-images.githubusercontent.com/20750310/90338269-176d4f80-e01b-11ea-8710-3ea817b235d2.png)



5780: Fixup whitespace when adding missing impl items r=matklad a=jDomantas

Generate properly formatted whitespace when adding impl items - with an empty line between items and removing extra whitespace that often appears at the end.

This is my first time working on rust analyzer so I'm not very familiar with its internal APIs. If there's a better way to do such syntax tree editing I'd be glad to hear it.

Co-authored-by: xiaofa <xiaofalzx@gmail.com>
Co-authored-by: jDomantas <djadenkus@gmail.com>
2020-08-17 14:30:24 +00:00
bors[bot]
6826dd044a
Merge #5782
5782: Fix StatusNotification r=matklad a=vsrs

This PR fixes the following:

As per specification `params` property in [NotificationMessage ](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage) should be `array | object` while RA uses `"loading" | "ready" | "invalid" | "needsReload"`.

Co-authored-by: vsrs <vit@conrlab.com>
2020-08-17 14:23:03 +00:00
vsrs
1eed036a6e Fix StatusNotification 2020-08-17 14:56:27 +03:00
xiaofa
951fc3f65a Fix eslint errors on .eslintrc.js and rollup.config.js 2020-08-16 23:28:26 +08:00
Igor Aleksanov
c26c911ec1 Merge branch 'master' into add-disable-diagnostics 2020-08-14 07:34:07 +03:00
Igor Aleksanov
3c018bf84d Restore final newline in package.json 2020-08-13 06:58:26 +03:00
Aleksey Kladov
8d34262956 Rename ra_toolchain -> toolchain 2020-08-12 16:52:28 +02:00
Igor Aleksanov
b50bb800a5 Merge branch 'master' into add-disable-diagnostics 2020-08-12 17:26:43 +03:00
Igor Aleksanov
13f736d4a1 Add a configuration option for the vscode extension 2020-08-12 16:06:55 +03:00
bors[bot]
cef39c3efb
Merge #5697
5697: Remove workaround for semantic token flickering r=jonas-schievink a=kjeremy

See: https://github.com/microsoft/vscode-languageserver-node/issues/576#issuecomment-593384479

This has been fixed since vscode 1.44

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-10 14:48:19 +00:00
Jeremy Kolb
58c97bdcbf Remove 'as any' 2020-08-09 18:09:27 -04:00
Jeremy Kolb
7252babc13 Remove workaround for semantic token flickering
See: https://github.com/microsoft/vscode-languageserver-node/issues/576#issuecomment-593384479

This has been fixed since vscode 1.44
2020-08-09 17:57:27 -04:00
Veetaha
e43811c164 Fix no inlay hints / unresolved tokens until manual edit
No we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.
2020-08-08 21:53:38 +03:00
Rüdiger Herrmann
c04b2e39da
Fix typo in settings description
Remove a duplicate word from the description of the `warningsAsHint` setting.
2020-08-08 11:57:54 +02:00
bors[bot]
8c802a3dbb
Merge #5513
5513: Try figure out correct workspace in vscode multi root workspace r=vsrs a=urbandove

the code to replace the root with the `${workspaceRoot}` arg breaks in multi root workspaces as it needs a qualifier `${workspaceRoot:workspaceName}`

This PR attempts to figure out the root workspace - and if it cant find it falls back to the first workspace

Co-authored-by: Urban Dove <urbandove80@gmail.com>
2020-07-31 11:13:19 +00:00
Clemens Wasser
8d9f8ac273 flycheck: Added checkOnSave.noDefaultFeatures
This commit adds the option
`rust-analyzer.checkOnSave.noDefaultFeatures`
and fixes #5550.
2020-07-30 16:04:01 +02:00
David Lattimore
cf55806257 SSR: Restrict to current selection if any
The selection is also used to avoid unnecessary work, but only to the
file level. Further restricting unnecessary work is left for later.
2020-07-29 15:06:58 +10:00
Urban Dove
a85e64770d delete empty line 2020-07-26 13:42:17 -04:00
Urban Dove
b32528659a try select correct workspace in vscode multi workspace 2020-07-25 22:23:13 -04:00
Jonas Schievink
f6f49735e8 Add toggle for experimental diagnostics 2020-07-24 17:39:16 +02:00
David Lattimore
58680cb08e SSR: Fix a typescript lint warning 2020-07-24 22:23:14 +10:00
David Lattimore
3975952601 SSR: Pass current file position through to SSR code.
In a subsequent commit, it will be used for resolving paths.
2020-07-24 21:34:00 +10:00
bors[bot]
85532e2df3
Merge #5480
5480: Fix snippetTextEdits applying to other files r=matklad a=TimoFreiberg

Fixes #4551
`vscode.window.visibleTextEditors` only contains editors whose contents are being displayed at the moment, so the previous logic only worked if the other file for which a snippetTextEdit is being received was visible in a separate split.

I feel that this is a hacky approach, so feel free to reject it for something nicer :)

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-07-23 12:33:24 +00:00
James Leitch
995c624f57 ProblemMatcher auto detects relative/absolute paths and matches VSCode LSP's owner and source. VSCode LSP updated to specify owner. 2020-07-22 22:34:47 -07:00
Timo Freiberg
1b5a74ef18 Fix snippetTextEdits applying to other files
vscode.window.visibleTextEditors only contains editors whose contents
are being displayed at the moment, so the previous logic only worked if
the other file for which a snippetTextEdit is being received was visible
in a separate split.
2020-07-22 17:36:54 +02:00
dependabot[bot]
56f4ccb5f7
Bump lodash from 4.17.15 to 4.17.19 in /editors/code
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-16 10:05:46 +00:00
Aleksey Kladov
d0a8f6a3eb Automatically reload project info on Cargo.toml changes 2020-07-10 15:35:15 +02:00
Veetaha
e2fec10dc1 Workaround rollup messing up default imports 2020-07-08 14:47:34 +03:00
Veetaha
f92bfb5807 Gzip artifacts
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>

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
2020-07-07 23:30:11 +03:00
Jonas Schievink
f44c4b61e1 Add a command to compute memory usage statistics 2020-07-07 12:10:14 +02:00
bors[bot]
0f5d62a3f3
Merge #5235 #5236 #5241
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 <lnicola@dend.ro>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-07 09:29:52 +00:00
Veetaha
fd1487db51 Consider EPERM error as other vscode processes using rust-analyzer 2020-07-07 12:09:37 +03:00
Laurențiu Nicola
9209a992c9 Disable ES module interop 2020-07-06 14:29:19 +03:00
Veetaha
ef223b9e64 Fix: allow for binaries from $PATH to pass validity check 2020-07-06 13:41:38 +03:00
Veetaha
46163acf62 Revert "Dispose logger on extension deactivation"
This reverts commit 13872543e0.
That commit was wrong because we use-after-free the logger
2020-07-05 21:10:31 +03:00
Veetaha
13872543e0 Dispose logger on extension deactivation 2020-07-05 21:05:38 +03:00
Veetaha
3602f07bbe Improve client logging (use output channel and more log levels) 2020-07-05 17:50:29 +03:00
bors[bot]
82bfaef7df
Merge #5203
5203: Fix typo in description of vscode setting r=matklad a=Nashenas88



Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-07-03 16:44:30 +00:00
bors[bot]
8489145583
Merge #5202
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 <vit@conrlab.com>
2020-07-03 13:17:36 +00:00
Paul Daniel Faria
bc11d46230 Fix typo in description of vscode setting 2020-07-03 09:12:20 -04:00
vsrs
bebbfa1a29 Fix workspaceRoot 2020-07-03 14:56:30 +03:00
vsrs
611fad275f code linting 2020-07-03 14:23:51 +03:00
vsrs
271abb7bc4 Add tests 2020-07-03 14:23:51 +03:00
vsrs
7b79d24ad5 Add runnable env support. 2020-07-03 14:23:51 +03:00
Jeremy Kolb
5b9257561f Pass CodeActionKind through our middleware to populate menus 2020-07-02 17:13:03 -04:00
bors[bot]
1a3a7f4237
Merge #5188
5188: Implement StatusBar r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:02:52 +00:00
Aleksey Kladov
3ef7676076 Implement StatusBar 2020-07-02 15:32:14 +02:00
bors[bot]
57ed622ec4
Merge #5089 #5161 #5184 #5185 #5186
5089: Disable auto-complete on comments r=matklad a=BGluth

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

As flodiebold [pointed out](https://github.com/rust-analyzer/rust-analyzer/issues/4907#issuecomment-648439979), 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](9a4d02faf9/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 https://github.com/rust-analyzer/rust-analyzer/issues/5091

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

a33eefa3b2/crates/ra_ide/src/completion/complete_snippet.rs (L23-L24)

Co-authored-by: BGluth <gluthb@gmail.com>
Co-authored-by: David Lattimore <dml@google.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
Co-authored-by: Heyward Fann <fannheyward@gmail.com>
2020-07-02 09:12:46 +00:00