Commit graph

317 commits

Author SHA1 Message Date
vsrs
eb6f9c23e1 pass Cargo errors to the Debug output channel 2020-04-30 15:25:04 +03:00
vsrs
9153e96e88 better configuration enum items 2020-04-29 14:13:57 +03:00
vsrs
042917e6e3 Configuration settings and source maps support 2020-04-29 13:10:42 +03:00
Jonas Schievink
61c28c2b22 Build extension too 2020-04-28 22:32:23 +02:00
Christophe MASSOLIN
ed5af989f4 [config] rename cargo.defaultTarget 2020-04-28 00:15:54 +02:00
Christophe MASSOLIN
b7edffe244 Started rust-analyzer.cargo.defaultTarget implementation 2020-04-27 00:11:04 +02:00
Aleksey Kladov
919015ce8a Disable onEnter command by default
We are transitioning from experimental to production-ready stance, so
it makes sense to disable potentially disruptive features by default.
2020-04-23 21:01:17 +02:00
bors[bot]
3f1f3a835a
Merge #4090
4090: Fix config naming r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-22 15:26:47 +00:00
Aleksey Kladov
9e16e2b279 Align the name of proc-macro enabling flag
We use `enable`, not `enabled` elsewhere
2020-04-22 17:22:59 +02:00
kjeremy
c6a50aead7 npm update 2020-04-22 10:58:50 -04:00
Aleksey Kladov
ca61356b01 Add semantic tag for unresolved references
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.
2020-04-18 21:28:51 +02:00
Edwin Cheng
177becea98 Add proc-macro cli command for rust-analyzer 2020-04-16 21:13:57 +08:00
Edwin Cheng
a4b0ce07f8 Add config for proc_macro 2020-04-16 19:28:06 +08:00
bors[bot]
f1a07dbf55
Merge #3962
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 <igor.zuk@protonmail.com>
2020-04-15 10:11:20 +00:00
kjeremy
d7efe54515 Bump @types/vscode and vscode-languageclient 2020-04-14 10:20:16 -04:00
Igor Żuk
f8fb009cad
Fix parentModule shortcut conflict
The default parentModule shortcut conflicts with VSCode's built-in undo selection
2020-04-13 12:13:55 +02:00
kjeremy
6f0f86d2c5 Enable the SemanticTokensFeature by default
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
2020-04-08 15:45:39 -04:00
kjeremy
b8426f426a Update some packages 2020-04-07 11:17:54 -04:00
Aleksey Kladov
501c5b45ac Better config scheme & defaults 2020-04-07 08:51:52 +02:00
Aleksey Kladov
ec3fb1cdb4
Merge pull request #3853 from matklad/cf
Make control token modifier less ambiguous
2020-04-06 11:53:56 +02:00
Aleksey Kladov
48bc0ca745 Make control token modifier less ambiguous
In textmate, keyword.control is used for all kinds of things; in fact,
the default scope mapping for keyword is keyword.control!

So let's add a less ambiguous controlFlow modifier

See Microsoft/vscode#94367
2020-04-06 09:57:50 +02:00
veetaha
486cb5b79a vscode: restore removed default values
After refactoring the config we forgot to set defaults for
some properties like workspaceLoaded, callInfo.full, etc.
This commit restored them to being turned on by defult,
as well added defaults for other props to be more explicit
on their defualt value.
2020-04-04 15:57:23 +03:00
Aleksey Kladov
2a968d4554 Set semantic tokens supertypes 2020-04-03 14:09:12 +02:00
kjeremy
db102c4766 Bumps vsce to 1.75
Fixes a security vulnerability
2020-04-02 12:03:30 -04:00
Aleksey Kladov
9ca69994af Fix semantic coloring 2020-04-02 15:52:25 +02:00
Aleksey Kladov
407ab946ab better wording 2020-04-02 14:39:37 +02:00
Aleksey Kladov
8a788c764f Allow fully overriding check and fmt commands 2020-04-02 14:35:51 +02:00
Aleksey Kladov
48c58309cc Lean onto default implementation of configs 2020-04-02 12:47:58 +02:00
Aleksey Kladov
e4cf40a152 New config in package.json 2020-04-02 12:27:09 +02:00
bors[bot]
98f7842e40
Merge #3820
3820: Remove old syntax highlighting r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-02 07:55:11 +00:00
Aleksey Kladov
309fc70155 Remove old syntax highlighting 2020-04-02 09:52:27 +02:00
bors[bot]
f0ba01cd43
Merge #3817
3817: vscode: highlight syntax tree ro editor r=matklad a=Veetaha

Small textmate grammar declaration to make rust-analyzer syntax tree more easily inspectable:
Btw, if we change the file extension of our `ra_syntax/test_data/**` files to `.rast` they should be highlighted in vscode too.

The colors of the tokens are actually going to be color-theme dependent, or you can customize them via:
```jsonc
{
    "editor.tokenColorCustomizations": {
        "textMateRules": [ { "scope": "name", "settings": { /* */ } } ] 
    }
}
```
![image](https://user-images.githubusercontent.com/36276403/78204947-99f9d600-74a3-11ea-8315-cb1c87810c7c.png)

Related: #3682

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-02 07:32:14 +00:00
veetaha
62ed01a107 vscode: add highlighting of syntax tree 2020-04-02 05:38:52 +03:00
veetaha
f4f79383b1 vscode: add support for light themes and color customization for syntax tree highlights 2020-04-02 01:20:08 +03:00
kjeremy
e88ee75ffb rollup 2.3.2 2020-04-01 14:44:30 -04:00
Aleksey Kladov
6343ddd009 Revert accidental package.json changes 2020-03-31 17:00:15 +02:00
bors[bot]
fa3c7742af
Merge #3790
3790: Better names for config structs r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-31 14:06:03 +00:00
Aleksey Kladov
f5b01d6544 WIP: uniformalize external tools config 2020-03-31 15:55:05 +02:00
kjeremy
b3b8d31c5e Update node deps 2020-03-31 09:47:53 -04:00
Matt Hooper
6f239a581a Extension types and rendering 2020-03-24 23:22:41 +01:00
veetaha
4cee3e9f22 vscode: more type safety 2020-03-24 01:11:36 +02:00
Aleksey Kladov
8ee7780ca9 ⬆️ npm 2020-03-20 13:07:43 +01:00
Aleksey Kladov
4b5435b52b Make from-source install use cargo installed binary by default 2020-03-20 13:07:12 +01:00
Aleksey Kladov
7adcadd279 Downgrade vscode-langaugeclient
Looks like it broke completion :(
2020-03-19 15:08:10 +01:00
Aleksey Kladov
8f8f6b47de ⬆️ npm 2020-03-19 10:30:41 +01:00
Aleksey Kladov
3d1cb5e20f Simplify extension tag sniffing 2020-03-19 09:37:03 +01:00
bors[bot]
aca3c3086e
Merge #3629
3629: Alternative aproach to plugin auto update r=matklad a=matklad

This is very much WIP (as in, I haven't run this once), but I like the result so far.

cc @Veetaha 

The primary focus here on simplification:

* local simplification of data structures and control-flow: using union of strings instead of an enum, using unwrapped GitHub API responses
* global simplification of control flow: all logic is now in `main.ts`, implemented as linear functions without abstractions. This is stateful side-effective code, so arguments from [Carmack](http://number-none.com/blow/john_carmack_on_inlined_code.html) very much apply. We need all user interractions, all mutations, and all network requests to happen in a single file. 
* as a side-effect of condensing everything to functions, we can get rid of various enums. The enums were basically a reified control flow:

```
enum E { A, B }

fn foo() -> E {
    if cond { E::A } else { E::B }
}

fn bar(e: E) {
    match e {
        E::A => do_a(),
        E::B => do_b(),
    }
}

==>>

fn all() {
    if cond { do_a() } else { do_b() }
}
```

* simplification of model: we don't need to reinstall on settings update, we can just ask the user to reload, we don't need to handle nightly=>stable fallback, we can ask the user to reinstall extension, (todo) we don't need to parse out the date from the version, we can use build id for nightly and for stable we can write the info directly into package.json.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-19 08:06:48 +00:00
Aleksey Kladov
fb6e655de8 Rewrite auto-update
Everything now happens in main.ts, in the bootstrap family of
functions. The current flow is:

* check everything only on extension installation.
* if the user is on nightly channel, try to download the nightly
  extension and reload.
* when we install nightly extension, we persist its release id, so
  that we can check if the current release is different.
* if server binary was not downloaded by the current version of the
  extension, redownload it (we persist the version of ext that
  downloaded the server).
2020-03-19 09:04:59 +01:00
Darin Morrison
482a7c2262 Update deps; regen lock file; fix minimist CVE 2020-03-18 10:36:11 -06:00
Emil Lauridsen
e154132c91 Remove outDirOverrides 2020-03-17 14:55:44 +01:00
Emil Lauridsen
f5a2fcf8f5 Change existing OUT_DIR override config to make use of new infrastructure 2020-03-17 14:47:05 +01:00
Emil Lauridsen
33c6c7abc6 Support loading OUT_DIR from cargo check at launch 2020-03-17 14:47:05 +01:00
Aleksey Kladov
a00bab5781 ⬆️ npm 2020-03-16 14:57:32 +01:00
Veetaha
bc98c02dd0 vscode: prepare package.json for nightlies 2020-03-14 02:01:46 +02:00
bors[bot]
d98a5fab46
Merge #3543
3543: Parameter inlay hint separate from variable type inlay? #2876 r=matklad a=slyngbaek

Add setting to allow enabling either type inlay hints or parameter
inlay hints or both. Group the the max inlay hint length option
into the object.

- Add a new type for the inlayHint options.
- Add tests to ensure the inlays don't happen on the server side

Co-authored-by: Steffen Lyngbaek <steffenlyngbaek@gmail.com>
2020-03-12 16:02:55 +00:00
Steffen Lyngbaek
a153b90875 Make maxLength nullable again 2020-03-12 08:43:07 -07:00
Steffen Lyngbaek
58248e24cd Switch from Vec<InlayKind> to object with props
- Instead of a single object type, use several individual nested types
  to allow toggling from the settings GUI
- Remove unused struct definitions
- Install and test that the toggles work
2020-03-11 20:14:39 -07:00
Matthias Krüger
d48bae6ebb settings: rust-analyzer.cargo-watch.enable: clarify that the setting enables the cargo-watch command and not "cargo check" 2020-03-11 12:32:24 +01:00
bors[bot]
c48dcf7411
Merge #3549
3549: Implement env! macro r=matklad a=edwin0cheng

This PR implements `env!` macro by adding following things:

1. Added `additional_outdirs` settings in vscode. (naming to be bikeshed)
2. Added `ExternSourceId` which is a wrapping for SourceRootId but only used in extern sources. It is because `OUT_DIR` is not belonged to any crate and we have to access it behind an `AstDatabase`.
3. This PR does not implement the `OUT_DIR` parsing from `cargo check`. I don't have general design about this,  @kiljacken could we reuse some cargo watch code for that ?

~~Block on [#3536]~~

PS: After this PR , we (kind of) completed the `include!(concat!(env!('OUT_DIR'),  "foo.rs")` macro call combo. [Exodia Obliterate!](https://www.youtube.com/watch?v=RfqNH3FoGi0)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-11 10:51:07 +00:00
Steffen Lyngbaek
e98aff109a Parameter inlay hint separate from variable type inlay? #2876
Add setting to allow enabling either type inlay hints or parameter
inlay hints or both. Group the the max inlay hint length option
into the object.

- Add a new type for the inlayHint options.
- Add tests to ensure the inlays don't happen on the server side
2020-03-10 14:33:45 -07:00
kjeremy
dda6ce6f13 Force latest stable 2020-03-10 13:31:13 -04:00
Edwin Cheng
c1db5d26a0 Add additional_outdirs in config 2020-03-11 01:06:01 +08:00
bors[bot]
fcaab59451
Merge #3514
3514: vscode: askBeforeDownload option r=matklad a=Veetaha

This is a small step towards #3402, also implements my proposal stated in #3403

Also renamed `BinarySource` to `ArtifactSource` in anticipation of nightlies installation that requires downloading not a binary itself but `.vsix` package, thus generalized to `artifact` term.

@matklad @lnicola 

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-03-09 09:05:45 +00:00
Veetaha
ce65cc949f vscode: groupd updates-related config under updates section as per @matklad 2020-03-09 10:59:36 +02:00
Julien Roncaglia
a231172283 Use markdown description in vscode 2020-03-08 22:46:42 +01:00
Veetaha
6bd1ff16e5 vscode: rename alwaysDownloadServer -> askBeforeDownload
The new name seems much simpler and it doesn't limit
this config value only to downloading the server binary.
Thus we wouldn't need to create another config
properties to handle other downloads whatsoever.
Anyway, I believe (heuristically) that most of the users
would want to set "askBeforeDownload": false once
and never bother clicking on the notification again
(because otherwise there is no big point in installing rust-analyzer if it cannot install the server)
2020-03-08 18:58:02 +02:00
Veetaha
9dae94a78d vscode: contribute "alwaysDownloadServer" option to config 2020-03-07 23:59:33 +02:00
Aleksey Kladov
dd4b001505 ⬆️ npm deps 2020-03-06 23:22:58 +01:00
Aleksey Kladov
80909f7698 Don't creat public APIs with typos 2020-03-06 18:38:56 +01:00
Aleksey Kladov
95a2755aa8 Concise mode for parameter hints
This works around VS Code bug where it tries to cram everything in a
tiny popup, and brings experience closer to Intellij.
2020-03-06 18:35:30 +01:00
Aleksey Kladov
4e7f6c2354 Feature flag for arg snippets 2020-03-06 17:51:10 +01:00
Jeremy Kolb
f51b655fef Update code dependencies 2020-03-03 08:05:59 -05:00
Aleksey Kladov
57d0f238cc Minimal viable meta 2020-03-02 14:27:26 +01:00
Aleksey Kladov
da40149572 Fix union classification 2020-02-28 15:03:09 +01:00
bors[bot]
2995fd2c87
Merge #3363
3363: Cleanup highlighting tags r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-28 13:48:42 +00:00
Jason Williams
8e88db90bc removing ctrl+r key binding fixes #2733 2020-02-28 12:50:11 +00:00
Aleksey Kladov
701cf43606 Cleanup highlighting tags 2020-02-28 12:13:37 +01:00
Aleksey Kladov
996e18846d add more tags 2020-02-28 10:39:31 +01:00
Veetaha
9251cd8440 vscode: added feature flags for better short-term ux 2020-02-27 22:04:57 +02:00
Aleksey Kladov
873156640d Map builtin 2020-02-27 18:37:25 +01:00
Aleksey Kladov
00fc17272d Set attr scope 2020-02-27 18:31:54 +01:00
Aleksey Kladov
4e5c1f5608 Map unsafe keyword 2020-02-27 17:28:59 +01:00
Aleksey Kladov
b8d7c4e1ad Fix style 2020-02-27 11:10:58 +01:00
Aleksey Kladov
356395139c Actually gate CI on eslint 2020-02-27 10:40:53 +01:00
bors[bot]
04b3bd5ee8
Merge #3308
3308: vscode: fix vscode-vim keybindings conflict r=matklad a=Veetaha

Closes #3013 I hope

vscode-vim extension overrides the `type` command so that it prevents
some keypresses to reach the text document editor.
It conflicts with our `onEnter` keybinding
that is used to support automatic doc comments extending and
indentation insertion.

The VSCode-native way to implement this would be
to use regular expressions, but as per matklad it is
considered not acceptable for the language server.

Thus we implement it via a `Enter` keybinding that
invokes our `onEnter` command which does it via the language-server.

At the end of the day we may only apply
ad hoc workarounds for conflicting extensions.
But vscode has another bug for that. You
either cannot use parantheses in `when` condition
of a keybinding or it just malfunctions.

See an issue about that here: https://github.com/microsoft/vscode/issues/91473
To get the ultimate context, follow this [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing)

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-27 09:00:31 +00:00
Aleksey Kladov
a8e68ff814 Color constants 2020-02-27 09:32:00 +01:00
Aleksey Kladov
f7db49bfc6 Better highlightign API 2020-02-27 09:32:00 +01:00
Aleksey Kladov
723e83fb25 wip 2020-02-26 22:08:21 +01:00
Aleksey Kladov
225ef6dea2 Config to switch to semantic tokens 2020-02-26 16:03:30 +01:00
Aleksey Kladov
8c0d0894b6
Merge pull request #3321 from kjeremy/semantic-client
Enable SemanticTokens on the client
2020-02-26 15:59:30 +01:00
Jeremy Kolb
74125d012e Enable SemanticTokens on the client
This will crash the extension on stable and insiders without the "--enable-proposed-api matklad.rust-analyzer" command line switch.
2020-02-26 08:42:26 -05:00
Aleksey Kladov
1f1bda2c5a Remove unnecessary dep 2020-02-26 14:21:23 +01:00
Veetaha
655c8337c0 vscode: fix vscode-vim keybindings conflict
vscode-vim extension overrides the `type` command so that it prevents
some keypresses to reach the text document editor.
It conflicts with our `onEnter` keybinding
that is used to support automatic doc comments extending and
indentation insertion.

The VSCode-native way to implement this would be
to use regular expressions, but as per matklad it is
considered not acceptable for the language server.

Thus we implement it via a `Enter` keybinding that
invokes our `onEnter` command which sends
a request to rust-analyzer process and applies
the appropriate source change recieved from it.

At the end of the day we may only apply
ad hoc workarounds for conflicting extensions.
But vscode has another bug for that. You
either cannot use parantheses in `when` condition
of a keybinding or it just malfunctions.

See an issue about that here: https://github.com/microsoft/vscode/issues/91473
To get the ultimate context, follow this zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing
2020-02-25 23:20:07 +02:00
Veetaha
6d15f89a4b vscode: bump TypeScript version 2020-02-24 21:37:53 +02:00
Aleksey Kladov
49844ab717 Extract client-side logging 2020-02-22 16:03:47 +01:00
Edwin Cheng
4e48a73f9c Improve server version info 2020-02-21 18:33:45 +08:00
Aleksey Kladov
c855e36696 Rename config value for server Path 2020-02-18 12:35:44 +01:00
Aleksey Kladov
c0fa5e2246 Rename the binary to rust-analyzer 2020-02-18 12:33:16 +01:00
Aleksey Kladov
784919aec1
Merge pull request #3209 from matklad/eslint
Eslint
2020-02-18 01:12:29 +01:00
kjeremy
3b57d8eb20 vscode-languageclient 6.1.1 2020-02-17 18:57:19 -05:00