Commit Graph

6995 Commits

Author SHA1 Message Date
Aleksey Kladov
68f47a5b10 Cleanup 2019-12-30 19:12:49 +01:00
bors[bot]
7c1634a9c2
Merge #2691
2691: Cleanup imports r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-30 18:08:23 +00:00
Aleksey Kladov
260df66b77 Cleanup imports 2019-12-30 19:07:59 +01:00
Aleksey Kladov
ca5c59507f Refactor show syntax tree action 2019-12-30 19:07:59 +01:00
Aleksey Kladov
ac3d0e8340 Run prettier on all files 2019-12-30 19:07:59 +01:00
Aleksey Kladov
9bfeac708d Move parentModule to the new Ctx 2019-12-30 19:07:59 +01:00
Aleksey Kladov
5aebf1081d Refactor applySourceChange 2019-12-30 19:07:59 +01:00
Aleksey Kladov
83d2527880 Move joinLines to the new Ctx 2019-12-30 19:07:59 +01:00
bors[bot]
b42d3ee3cc
Merge #2690
2690: Fix server config mispell in vscode extension r=matklad a=kiljacken

Fixes #2689

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-30 17:27:21 +00:00
Emil Lauridsen
2d3ebc3406 Fix server config mispell in vscode extension 2019-12-30 18:22:06 +01:00
Vincent Rouillé
dc98930965
Add details about test_repeat_bad_var current state 2019-12-30 17:12:20 +01:00
Vincent Rouillé
c670a15345
Details about macro NestingState hit and at_end fields 2019-12-30 17:09:07 +01:00
bors[bot]
28ef2ea4f9
Merge #2687
2687: Move matching brace to new Ctx r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-30 14:26:07 +00:00
Aleksey Kladov
5dd9edaeaf Move matching brace to new Ctx 2019-12-30 15:23:55 +01:00
Aleksey Kladov
57df9bed70 Run prettier 2019-12-30 15:11:30 +01:00
Aleksey Kladov
a0c0350960 Add prettier 2019-12-30 15:10:59 +01:00
Aleksey Kladov
29e86c0c72 More second command to Ctx 2019-12-30 14:53:43 +01:00
Aleksey Kladov
e53ccb6e99 Start new ctx module 2019-12-30 14:42:59 +01:00
bors[bot]
9cad88dd95
Merge #2685
2685: Simplify r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-30 11:32:34 +00:00
Aleksey Kladov
2008f9e0b9 Simplify 2019-12-30 12:29:33 +01:00
Aleksey Kladov
dc559dbe1c Rename extension.ts -> main.ts 2019-12-30 12:29:33 +01:00
Aleksey Kladov
0c371d2128
Merge pull request #2684 from matklad/refactor-frontend
Refactor frontend
2019-12-30 11:49:04 +01:00
Aleksey Kladov
1f8719ee87 Minimize typescript CI 2019-12-30 11:33:01 +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
Aleksey Kladov
7192ee842d Trim down launch configurations 2019-12-30 00:16:11 +01:00
Aleksey Kladov
b63fbae482 Drop all the debugging tasks
There are too many of them, and they no longer match the set of crates
we have.

This really should be handled in a different way, by having out
"rust-analyzer: Run" generate the appropriate lldb config on the fly.
2019-12-30 00:16:11 +01:00
Aleksey Kladov
936fc522ba Drop obsolete tasks 2019-12-30 00:16:11 +01:00
bors[bot]
be37c3369b
Merge #2681
2681: cargo-watcher: Resolve macro call site in more cases r=matklad a=kiljacken

This resolves the actual macro call site in a few more cases, f.x. when a macro invokes `compile_error!` (I'm looking at you `ra_hir_def::path::__path`).

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 21:40:42 +00:00
Emil Lauridsen
bca8524fa2 Add related information with original error site 2019-12-29 20:10:20 +01:00
Emil Lauridsen
96156b95b5 Resolve macro call site in more cases 2019-12-29 19:14:18 +01:00
bors[bot]
fc77921acc
Merge #2680
2680: Fix cargo-watcher file urls on windows r=matklad a=kiljacken

Fixes #2676 

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 17:53:13 +00:00
Emil Lauridsen
0d69d23d2f Lowercase drive letters when getting paths from cargo check 2019-12-29 18:27:14 +01:00
bors[bot]
b30de4ed49
Merge #2679
2679: Resolve traits for infer using lang item infrastructure r=matklad a=kiljacken

As we already have the infrastructure for collecting lang items, use it to find the right traits when doing type-inference.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 16:58:29 +00: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
8280795a85 Remove unused hard-coded paths 2019-12-29 17:39:44 +01:00
Emil Lauridsen
8fad8e897a Resolve traits in infer using lang item infrastructure 2019-12-29 17:39:31 +01:00
Emil Lauridsen
fc3ab03af7 Add helpers for unpacking lang items 2019-12-29 17:38:37 +01:00
bors[bot]
523b4cbc60
Merge #2650
2650: Add macro call support for SourceAnalyzer::type_of r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-29 15:02:27 +00:00
bors[bot]
ada9e16537
Merge #2674
2674: Reduce visibility r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-29 14:08:37 +00:00
Aleksey Kladov
e1d040a6a4 Reduce visibility 2019-12-29 15:07:53 +01:00
bors[bot]
01136b0234
Merge #2673
2673: Don't add non-impl/trait containers to scope r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-29 13:48:40 +00:00
Aleksey Kladov
8f36f768e1 Don't add non-impl/trait containers to scope 2019-12-29 14:47:47 +01:00
bors[bot]
dc48f89581
Merge #2668
2668: In-server cargo check watching r=matklad a=kiljacken

Opening a draft now so people can follow the progress, and comment if they spot something stupid.

Things that need doing:
- [x] Running cargo check on save
- [x] Pipe through configuration options from client
- [x] Tests for parsing behavior
- [x] Remove existing cargo watch support from VSCode extension
- [x] Progress notification in VSCode extension using LSP 3.15 `$/progress` notification
- [ ] ~~Rework ra-ide diagnostics to support secondary messages~~
- [ ] ~~Make cargo-check watcher use ra-ide diagnostics~~

~~I'd love some input on whether to try to keep the status bar progress thingy for VSCode? It will require some plumbing, and maintaining yet another rust-analyzer specific LSP notification, which I'm not sure we want to.~~

Fixes #1894 

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 12:57:24 +00:00
bors[bot]
cdcb3d3833
Merge #2667
2667: Visibility r=matklad a=flodiebold

This adds the infrastructure for handling visibility (for fields and methods, not in name resolution) in the HIR and code model, and as a first application hides struct fields from completions if they're not visible from the current module. (We might want to relax this again later, but I think it's ok for now?)

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-29 12:24:19 +00:00
Vincent Rouillé
6d84dee4e7
fix #2520: change expand_repeat loop stop condition 2019-12-28 22:48:49 +01:00
Emil Lauridsen
899dbebd02 Fix busy-waiting issue in main cargo watch thread 2019-12-27 17:29:02 +01:00
bors[bot]
c5a48bea12
Merge #2671
2671: anyhow and crossbeam-queue r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-12-27 15:52:19 +00:00
Jeremy Kolb
7c855c8271 anyhow and crossbeam-queue 2019-12-27 10:51:30 -05:00
Emil Lauridsen
c732f215cb Don't finish main cargo watch thread when subprocess finishes. 2019-12-27 12:43:14 +01:00