Commit Graph

196 Commits

Author SHA1 Message Date
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