Commit Graph

131 Commits

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