Commit graph

382 commits

Author SHA1 Message Date
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
Aleksey Kladov
07a77ffb35 Migrate to eslint 2020-02-17 23:42:25 +01:00
Aleksey Kladov
94fb9ad6b3 Fix extension name 2020-02-17 15:35:06 +01:00
bors[bot]
334f53465f
Merge #3187
3187: ⬆️ npm deps r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-17 10:13:45 +00:00
Aleksey Kladov
48dd1d7053 ⬆️ npm deps 2020-02-17 11:13:16 +01:00
bors[bot]
93d28fb50c
Merge #3099
3099: Init implementation of structural search replace r=matklad a=mikhail-m1

next steps:
* ignore space and other minor difference
* add support to ra_cli
* call rust parser to check pattern
* documentation

original issue #2267 

Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2020-02-17 10:02:54 +00:00
Ilya Titkov
a2b0bdcc24 Add arguments to rustfmt 2020-02-17 11:44:58 +03:00
Veetaha
56b64cac9c vscode: added minimum bound for lruCapacity option 2020-02-16 18:00:49 +02:00
Veetaha
0565657ed1 vscode: fix all integer -> number and add nullablitiy to maxInlayHintLength 2020-02-16 17:55:15 +02:00
Veetaha
53b5f4ba98 vscode: update exclusiveMinimum validation according to JSONSchemaV4 specs 2020-02-16 16:48:17 +02:00
Veetaha
8533fc437b vscode: add version and storage parameters to github binary source 2020-02-16 03:41:39 +02:00
Mikhail Modin
f8f454ab5c Init implementation of structural search replace 2020-02-14 21:45:42 +00:00
bors[bot]
ab42174653
Merge #3131
3131: vscode: simplified config and to removed one source of truth of default values r=matklad a=Veetaha

Though not intended initially, the implementation of config design is alike [dart's one](https://github.com/Dart-Code/Dart-Code/blob/master/src/extension/config.ts) as pointed by @matklad in PM.

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-14 21:08:47 +00:00
kjeremy
de3b0b43f3 Expect vscode 1.42 2020-02-14 12:02:19 -05:00
Aleksey Kladov
bd3a41cc33 Prevent auto-update of dev extension 2020-02-14 15:29:19 +01:00
Veetaha
9b47124e6e vscode: added more type safety to package.json config 2020-02-13 22:47:31 +02:00
Veetaha
a63659badb vscode: replaced unwrapNotNil() with ! as per @matklad 2020-02-09 13:59:27 +02:00
Veetaha
5d88c1db38 vscode: amended config to use binary from globalStoragePath, added ui for downloading 2020-02-08 04:34:11 +02:00
Veetaha
3e0e4e90ae added fetchLatestArtifactMetadata() and downloadFile() functions 2020-02-08 04:34:11 +02:00
Veetaha
8153b60e1d vscode: eliminate floating promises and insane amount of resource handle leaks 2020-02-05 22:39:47 +02:00
Gregoire Geis
7fd661f085 vscode: Only handle enter if the suggest widget is hidden. 2020-02-03 22:26:20 +01:00
Gregoire Geis
b70ad7e5f3 Remove enableEnhancedTyping and type overriding infrastructure. 2020-02-03 20:24:50 +01:00
Gregoire Geis
58c007674b Change default enhanced typing behavior from using type to using keybindings. 2020-02-03 20:18:11 +01:00
Gregoire Geis
23ef22dd48 Add regular onEnter command, allowing onEnter to be called without overriding the type command. 2020-02-03 20:18:10 +01:00
Aleksey Kladov
f0323de7e8 Remove unnecessary flags 2020-02-03 18:05:54 +01:00
Aleksey Kladov
9b8e3b80ee Remove rollup-typescript
It seems like just calling typescript directly is simpler and more reliable?
2020-02-03 17:39:34 +01:00
Aleksey Kladov
0a68dfb491 Update some rollup packages 2020-02-03 16:49:25 +01:00
Aleksey Kladov
ad57726f91 Use simple prng instead of a dependency
closes #2999
2020-02-03 16:37:12 +01:00
Aleksey Kladov
30f7e6590a Remove recent improvements to the build script
tslib as a dev dependency and commonjs modules are definitely *wrong*
in the ideal world, **but** in the real world that's the only
combination that works. See

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Problems.20with.20TypeScript.20build
2020-02-03 15:25:29 +01:00
Veetaha
0ade5cb2b3 vscode: dropped npm-check-updates script 2020-02-03 00:05:49 +02:00
Veetaha
e9800b0023 vscode: updated rollup typescript so it typechecks the bundle 2020-02-03 00:05:49 +02:00
bors[bot]
856e4ba126
Merge #2979
2979: vscode: now we are actually using tslib r=matklad a=Veetaha

We had an incorrect setup where `tslib` was in `devDependencies`.
FYI:
tslib is a runtime dependency, it contains functions that are used by transpiled JavaScript in order not to inline them in each file.
For example:
```ts
// foo.ts (source code)
import * as foo from "foo";
// ---------------------------
// foo.js (compiled output)
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const foo = __importStar(require("foo"));
```
As you see, `tsc` generated that `__importStar` helper function in compiled output. And it generates it per each file if you don't enable `"importHelpers": true`. Now with `importHelpers` enabled we get the following picture:
```ts
// foo.ts (source code)
import * as foo from "foo";
// ---------------------------
// foo.js (compiled output)
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const foo = tslib_1.__importStar(require("foo"));
```
It saves some bundle size, but I am not entirely sure wheter we want that. Discussions are welcome!

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-02 14:05:23 +00:00
Veetaha
3d6d0819cc fix repo link in package.json 2020-02-02 12:16:41 +02:00
Veetaha
f08297983f vscode: moved tslib to runtime dependencies and added \"importHelpers\": true 2020-02-01 23:11:39 +02:00
Aleksey Kladov
c378133185 ⬆️ node 2020-01-28 15:11:44 +01:00
kjeremy
1266810e55 vscode-languageclient 6.1.0
Adds support for proposed semantic highlighting extension
2020-01-27 10:25:22 -05:00
Jeremy Kolb
a0494c7237 vscode-languageclient 6.0.1 2020-01-20 19:48:32 -05:00
bors[bot]
876f92d547
Merge #2843
2843: Add inlay parameter name hints for call expr r=matklad a=imtsuki

This patch adds Intellij-like parameter name hints for literal values in function calls.

<img width="624" alt="Screenshot" src="https://user-images.githubusercontent.com/8423594/72366533-68d7f800-3735-11ea-9279-cf193ca8ca2f.png">

Signed-off-by: imtsuki <me@qjx.app>

Co-authored-by: imtsuki <me@qjx.app>
2020-01-15 10:24:51 +00:00
kjeremy
385c548032 Language Server Protocol 3.15 is now stable
Update the client
2020-01-14 14:53:38 -05:00
imtsuki
c390e92fdd Add inlay parameter name hints for function calls
Signed-off-by: imtsuki <me@qjx.app>
2020-01-15 01:18:52 +08:00
kjeremy
a39fe4f1dc vscode-languageclient 6.0.0-next.10 2020-01-13 16:49:44 -05:00
Aleksey Kladov
bd7aa5db14 Rename VS Code extension to rust-analyzer 2020-01-13 11:13:18 +01:00
Marco Groppo
08fa0151ed Fix lruCapacity config setting type 2020-01-11 13:30:02 +01:00
Aleksey Kladov
ff0ceb30a9 Add semicolons 2019-12-31 18:55:34 +01:00
Aleksey Kladov
0eb254854d Fix color name 2019-12-31 15:42:05 +01:00
Aleksey Kladov
8662a7dfe5 Drop obsolete color configurations 2019-12-31 14:37:23 +01:00
Aleksey Kladov
323ad13c8a Add tsfmt 2019-12-30 23:28:13 +01:00
Aleksey Kladov
9fae4f4b99 Remove prettier 2019-12-30 23:27:13 +01:00
Aleksey Kladov
ac3d0e8340 Run prettier on all files 2019-12-30 19:07:59 +01:00
Aleksey Kladov
a0c0350960 Add prettier 2019-12-30 15:10:59 +01:00
Aleksey Kladov
dc559dbe1c Rename extension.ts -> main.ts 2019-12-30 12:29:33 +01:00
Aleksey Kladov
e0fa096bbb Add rollup 2019-12-30 11:20:45 +01:00
Aleksey Kladov
5846221a39 Minimize TypeScript build 2019-12-30 02:22:52 +01:00
bors[bot]
232785251b
Merge #2061
2061: Theme loading and "editor.tokenColorCustomizations" support. r=matklad a=seivan

Fixes: [Issue#1294](https://github.com/rust-analyzer/rust-analyzer/issues/1294#issuecomment-497450325)

TODO: 
- [x] Load themes
- [x] Load existing `ralsp`-prefixed overrides from `"workbench.colorCustomizations"`.
- [x] Load overrides from `"editor.tokenColorCustomizations.textMateRules"`.
- [x] Use RA tags to load `vscode.DecorationRenderOptions` (colors) from theme & overrides.
- [x] Map RA tags to common TextMate scopes before loading colors.
- [x] Add default scope mappings in extension.
- [x] Cache mappings between settings updates. 
- [x] Add scope mapping configuration manifest in `package.json`
- [x] Load configurable scope mappings from settings.
- [x] Load JSON Scheme for text mate scope rules in settings.
- [x] Update [Readme](https://github.com/seivan/rust-analyzer/blob/feature/themes/docs/user/README.md#settings).

Borrowed the theme loading (`scopes.ts`) from `Tree Sitter` with some modifications to reading `"editor.tokenColorCustomizations"` for merging with loaded themes and had to remove the async portions to be able to load it from settings updates. 

~Just a PoC and an idea I toyed around with a lot of room for improvement.~
For starters, certain keywords aren't part of the standard TextMate grammar, so it still reads colors from the `ralsp` prefixed values in `"workbench.colorCustomizations"`. 

But I think there's more value making the extension work with existing themes by maping some of the decoration tags to existing key or keys. 

<img width="453" alt="Screenshot 2019-11-09 at 17 43 18" src="https://user-images.githubusercontent.com/55424/68531968-71b4e380-0318-11ea-924e-cdbb8d5eae06.png">
<img width="780" alt="Screenshot 2019-11-09 at 17 41 45" src="https://user-images.githubusercontent.com/55424/68531950-4b8f4380-0318-11ea-8f85-24a84efaf23b.png">
<img width="468" alt="Screenshot 2019-11-09 at 17 40 29" src="https://user-images.githubusercontent.com/55424/68531952-51852480-0318-11ea-800a-6ae9215f5368.png">


These will merge with the default ones coming with the extension, so you don't have to implement all of them and works well with overrides defined in settings. 

```jsonc
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "keyword",
                "settings": {
                    "fontStyle": "bold",
                }
            },
        ]
    },
```


Edit: The idea is to work with 90% of the themes out there by working within existing scopes available that are generally styled. It's not to say I want to erase the custom Rust scopes - those should still remain and eventually worked into a custom grammar bundle for Rust specific themes that target those, I just want to make it work with generic themes offered on the market place for now. 

A custom grammar bundle and themes for Rust specific scopes is out of... scope for this PR. 
We'll make another round to tackle those issues. 


Current fallbacks implemented

```typescript
    [
        'comment',
        [
            'comment',
            'comment.block',
            'comment.line',
            'comment.block.documentation'
        ]
    ],
    ['string', ['string']],
    ['keyword', ['keyword']],
    ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']],
    [
        'keyword.unsafe',
        ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']
    ],
    ['function', ['entity.name.function']],
    ['parameter', ['variable.parameter']],
    ['constant', ['constant', 'variable']],
    ['type', ['entity.name.type']],
    ['builtin', ['variable.language', 'support.type', 'support.type']],
    ['text', ['string', 'string.quoted', 'string.regexp']],
    ['attribute', ['keyword']],
    ['literal', ['string', 'string.quoted', 'string.regexp']],
    ['macro', ['support.other']],
    ['variable', ['variable']],
    ['variable.mut', ['variable', 'storage.modifier']],
    [
        'field',
        [
            'variable.object.property',
            'meta.field.declaration',
            'meta.definition.property',
            'variable.other'
        ]
    ],
    ['module', ['entity.name.section', 'entity.other']]
```


Co-authored-by: Seivan Heidari <seivan.heidari@icloud.com>
2019-12-29 16:49:40 +00:00
Emil Lauridsen
0cdbd08149 Keep VSCode config mostly backwards compatible 2019-12-25 20:26:06 +01:00
Emil Lauridsen
6af4bf7a8d Configuration plumbing for cargo watcher 2019-12-25 17:37:40 +01:00
Emil Lauridsen
41a1ec723c Remove cargo-watch from vscode extension.
Still keeps tests around for reference when porting them to rust
2019-12-25 17:37:40 +01:00
Seivan Heidari
b21d9337d9 Merge branch 'master' into feature/themes 2019-12-23 15:35:31 +01:00
kjeremy
be78e3c224 Update to latest packages 2019-12-20 13:52:11 -05:00
bors[bot]
ee93fac776
Merge #2583
2583: Use prettier settings in ts-lint r=matklad a=edwin0cheng

This PR add `tslint-plugin-prettier` extension in ts-lint, which "runs prettier rules as tslint rules." and remove  `quotemark` from ts-lint and let prettier to handle it. 

And also fix #2515

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 21:12:18 +00:00
Edwin Cheng
da29b7fb14 use pretter settings in ts-lint 2019-12-17 23:50:18 +08:00
bors[bot]
a26840d603
Merge #2568
2568: Add option to disable all-targets. r=matklad a=pftbest

Can be useful in embedded.

Co-authored-by: Vadzim Dambrouski <vadzim.dambrouski@promwad.com>
2019-12-17 13:28:37 +00:00
bors[bot]
ba6312a2df
Merge #2571
2571: Fixed a typo in settings r=matklad a=omerbenamram

@lnicola found a typo in the description for one of the settings introduced in #2559.

Co-authored-by: Omer Ben-Amram <omerbenamram@gmail.com>
2019-12-17 13:19:59 +00:00
Aleksey Kladov
2432f278cb Default to client watching on VS Code 2019-12-17 12:41:44 +01:00
Omer Ben-Amram
624abc1db3 Fixed a typo
thanks @lnicola
2019-12-16 17:32:46 +02:00
Vadzim Dambrouski
a85cd6455a Add option to disable all-targets.
Can be useful in embedded.
2019-12-15 23:32:13 +05:30
Oliver Scherer
5166f6e5f2 Properly format json 2019-12-15 17:19:41 +01:00
Oliver Scherer
eed57dcded Add a rudimentary json regex to get at information like endLine 2019-12-15 17:12:52 +01:00
Omer Ben-Amram
5e4e713fc9 Merge branch 'refs/heads/master' into feature/granular-scopes 2019-12-14 17:29:30 +02:00
Omer Ben-Amram
083010f633 removed type.alias 2019-12-14 13:29:42 +02:00
Omer Ben-Amram
67641d3f5f added decorations 2019-12-14 13:24:07 +02:00
oxalica
f56a2a0790
Enable allFeatures by default and fix lints 2019-12-14 00:48:47 +08:00
oxalica
af4eb26645
Support setting cargo features 2019-12-13 18:16:34 +08:00
Laurențiu Nicola
273299693b Code: enable prettier trailing commas 2019-12-09 21:07:19 +02:00
Edwin Cheng
81ce9833a5 Add rollup sourcemap and fix launch.json 2019-12-09 03:58:43 +08:00
Laurențiu Nicola
c7dc067104 Code: bump deps 2019-12-08 20:39:22 +02:00
Laurențiu Nicola
78e8934976 Code: check whether the LSP binary is in PATH 2019-12-08 15:04:37 +02:00
Seivan Heidari
1e2d090ab8 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes 2019-11-20 03:56:43 +01:00
Edwin Cheng
d16cc223e1 Use DocumentProvider instead of Hover 2019-11-20 01:06:10 +08:00
Seivan Heidari
e5bbb47680 Readding jsonc parser because of https://github.com/rust-analyzer/rust-analyzer/pull/2061\#discussion_r344783715 2019-11-18 02:37:18 +01:00
Seivan Heidari
83a33fbbea Vscode wasn't running the linter automatically so ran npm run fix - wonder if it's related to tslint being deprecated. 2019-11-09 17:23:30 +01:00
Seivan Heidari
c60f9bf4c6 * Adding scope mapping configuration manifest in package.json
* Loading configurable scope mappings from settings.
* Updating Readme with `rust-analyzer.scopeMappings`.
`rust-analyzer.scopeMappings` -- a scheme backed JSON object to tweak Rust Analyzer scopes to TextMate scopes.
   ```jsonc
    {
        //Will autocomplete keys to available RA scopes.
        "keyword.unsafe": ["keyword", "keyword.control"],
        //Values are string | TextMateScope | [string | TextMateScope]
        "comments": "comment.block"
    }
   ```
2019-11-04 23:59:11 +01:00
Aleksey Kladov
dc65219ae1 document feature flags 2019-10-25 09:00:30 +03:00
bors[bot]
d2e1f9f6da
Merge #1980
1980: Shorten inline type hints r=matklad a=detrumi

Implements #1946 

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-10-23 11:13:04 +00:00
Wilco Kusee
3b61acb4ae
Make inlay hint length configurable 2019-10-18 13:45:04 +02:00
Roberto Vidal
f4d50de275 Adds config option for cargo-watch --ignore flag 2019-10-17 20:21:07 +02:00
Laurențiu Nicola
3a86a6dfb5 Add rust-analyzer.showWorkspaceLoadedNotification to package.json 2019-10-17 17:27:59 +03:00
bors[bot]
62acb9f233
Merge #1984
1984: Bump rollup and vsce r=matklad a=kjeremy

I got sick of the vsce warning on install and noticed that rollup was also out of date.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-10 14:23:21 +00:00
kjeremy
de32ae75f8 Bump rollup and vsce 2019-10-10 10:19:05 -04:00
kjeremy
86939ce0e3 engine.vscode and @types/vscode should match 2019-10-10 10:10:50 -04:00
JasperDeSutter
2151d4da6a add rollup bundler for vscode extension 2019-09-23 23:25:16 +02:00
Lucas Spits
934d7990fd
Update minimal required vscode version to 1.37 2019-09-10 08:49:23 +02:00
Aleksey Kladov
28df377759 add option to disable notify 2019-09-06 17:21:29 +03:00
Bastian Köcher
b58f84626f Switch to @types/vscode and vscode-test
The old `vscode` package is outdated and it is recommened to switch to
these two new packages. This also solves a problem of a missing `.d.ts`
for `vscode` in Nixos.
2019-08-26 08:22:48 +02:00
Aleksey Kladov
69bbe79c50 implement feature flags 2019-08-22 15:07:31 +03:00
Aleksey Kladov
6ab85cc192 fix default for the exlude key 2019-08-21 17:30:58 +03:00
Aleksey Kladov
deea8f52d9 allow to exclude certain files and directories 2019-08-06 14:28:31 +02:00
bors[bot]
78317383c9 Merge #1614
1614: show prettier diff on CI r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-29 08:55:09 +00:00
Aleksey Kladov
605b2983ef show prettier diff on CI 2019-07-29 11:54:37 +03:00
Aleksey Kladov
c1dcdd4735 ⬆️ npm 2019-07-29 11:22:56 +03:00
Kirill Bulatov
169e69d217 Show type decorators 2019-07-25 15:17:28 +03:00
Aleksey Kladov
51568c1467 try to show exact prettier problem 2019-07-25 13:05:34 +03:00
Aleksey Kladov
38f3b47a00 ⬆️ npm deps 2019-07-25 12:17:27 +03:00
Aleksey Kladov
d690249bc8
Remove obsolete keybinding 2019-07-21 19:08:05 +03:00
Aleksey Kladov
e418889996 underline mutable bindings 2019-07-19 15:07:18 +03:00
Ekaterina Babshukova
4abe03879b highlight mutable variables differently 2019-07-18 18:52:50 +03:00
kjeremy
45d6f47c28 Update vsce to latest 2019-07-03 09:55:48 -04:00
Ryan Cumming
60ba253753 Run VS Code tests on CI
This is actually much faster than I expected; it takes about 13 seconds
to download VS Code and run the unit tests. This means the VS Code tests
are still significantly faster than the Rust ones.

If this ends up being unreliable we can always remove it later or move
it to a separate optional job.

We also need to ignore the `.vscode-test` directory when running
`prettier` or it will get upset about some temporary JSON files VS Code
creates.
2019-06-30 07:12:42 +10:00
Ryan Cumming
f82ceca0bd Initial Visual Studio Code unit tests
As promised in #1439 this is an initial attempt at unit testing the
VSCode extension. There are two separate parts to this: getting the test
framework working and unit testing the code in #1439.

The test framework nearly intact from the VSCode extension generator.
The main thing missing was `test/index.ts` which acts as an entry point
for Mocha. This was simply copied back in. I also needed to open the
test VSCode instance inside a workspace as our file URI generation
depends on a workspace being open.

There are two ways to run the test framework:

1. Opening the extension's source in VSCode, pressing F5 and selecting
   the "Extensions Test" debug target.

2. Closing all copies of VSCode and running `npm test`. This is started
   from the command line but actually opens a temporary VSCode window to
   host the tests.

This doesn't attempt to wire this up to CI. That requires running a
headless X11 server which is a bit daunting. I'll assess the difficulty
of that in a follow-up branch. This PR is at least helpful for local
development without having to induce errors on a Rust project.

For the actual tests this uses snapshots of `rustc` output from a real
Rust project captured from the command line. Except for extracting the
`message` object and reformatting they're copied verbatim into fixture
JSON files.

Only four different types of diagnostics are tested but they represent
the main combinations of code actions and related information possible.
They can be considered the happy path tests; as we encounter
corner-cases we can introduce new tests fixtures.
2019-06-26 20:31:36 +10:00
Aleksei Sidorov
28e9e8d4cf Fix code after "apply suggestions" 2019-06-24 13:50:34 +03:00
Aleksey Sidorov
c40ee089f2
Apply suggestions from code review
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-24 13:35:11 +03:00
Aleksei Sidorov
4722e6d491 Introduce cargo-watch.check-command 2019-06-24 13:02:20 +03:00
Aleksey Kladov
fed52706de make LRU cache configurable 2019-06-12 13:36:24 +03:00
Pascal Hertleif
1e6ba19015 Make rainbows optional 2019-05-27 11:44:46 +02:00
Pascal Hertleif
5bf3e949e8
Semantic highlighting spike
Very simple approach: For each identifier, set the hash of the range
where it's defined as its 'id' and use it in the VSCode extension to
generate unique colors.

Thus, the generated colors are per-file. They are also quite fragile,
and I'm not entirely sure why. Looks like we need to make sure the
same ranges aren't overwritten by a later request?
2019-05-27 11:26:33 +02:00
Laurențiu Nicola
f1ec88cc56 Improve highlighting of name refs 2019-05-23 15:31:35 +03:00
Laurențiu Nicola
b08362f6d2 Address feedback 2019-05-21 16:28:10 +03:00
Laurențiu Nicola
9ade271a67 Use ThemeColor and add support for light themes 2019-05-21 14:19:08 +03:00
Aleksey Kladov
fa12ed2b8f switch to official extend selection API 2019-04-21 12:13:48 +03:00
Aleksey Kladov
bf7cdec9dd ⬆️ code 2019-04-21 11:32:48 +03:00
Bernardo
422f4ac080 start cargo watch if not started interactively 2019-04-19 20:54:36 +02:00
Bernardo
3d3adabbef recover rustc-watch problemMatchers 2019-04-19 20:54:36 +02:00
Bernardo
1ae6571762 cargo watch start and stop commands 2019-04-19 20:54:36 +02:00
Roberto Vidal
12f28f6276 Adds "restart server" command 2019-04-16 22:07:33 +02:00
Edwin Cheng
02e450f354 Add cargo-watch.check-arguments 2019-04-02 15:03:31 +08:00
Edwin Cheng
ee05eafe6c Add config for cargo-watch trace 2019-04-02 15:03:31 +08:00
Edwin Cheng
b84d0fc1a3 Add proper process teminate method 2019-04-02 15:03:31 +08:00
Edwin Cheng
b3683df0cd Improve cargo-watch usage 2019-04-02 15:03:30 +08:00
Ville Penttinen
5c3e9c716e Change enableCargoWatchOnStartup to have three states
This fixes #1005.

Defaults to `ask` which prompts users each time whether to start `cargo watch`
or not. `enabled` always starts `cargo watch` and `disabled` does not.
2019-03-21 13:56:25 +02:00
Igor Matuszewski
7c2595c268 Guard auto cargo watch behind a config option 2019-03-18 22:35:47 +01:00
Aleksey Kladov
6ef614f785 activate extension if Cargo.toml is present 2019-03-13 16:38:49 +03:00
Bernardo
7cf9c34f66 prettier format 2019-03-10 15:20:27 +01:00
Bernardo
536a579f2e simplify watch patterns 2019-03-10 13:35:02 +01:00
Ville Penttinen
0dcb1cb569 Add showWorkspaceLoadedNotification to vscode client
This allows users to control whether or not they want to see the "workspace
loaded" notification.

This is done on the server side using InitializationOptions which are provided
by the client. By default show_workspace_loaded is true, meaning the
notification is sent.
2019-03-06 11:34:38 +02:00
Ville Penttinen
c2d3203d0c Add vscode support for range in SyntaxTreeParams
This enables the client to use a command to either show the live-updating
version of the syntax tree for the current file. Or optionally when a selected
range is provided, we then provide a snapshot of the syntax tree for the range.
2019-03-03 21:43:40 +02:00
Ville Penttinen
5a9a314b10 Change default value of highlightingOn to false 2019-02-26 08:56:11 +02:00