Commit graph

10071 commits

Author SHA1 Message Date
bors[bot]
848aa56df5
Merge #4397
4397: Textmate cooperation r=matklad a=georgewfraser

This PR tweaks the fallback TextMate scopes to make them more consistent with the existing grammar and other languages, and edits the builtin TextMate grammar to align with semantic coloring. Before is on the left, after is on the right:

<img width="855" alt="Screen Shot 2020-05-10 at 1 45 51 PM" src="https://user-images.githubusercontent.com/1369240/81512320-a8be7e80-92d4-11ea-8940-2c03f6769015.png">

**Use keyword.other for regular keywords instead of keyword**. This is a really peculiar quirk of TextMate conventions, but virtually *all* TextMate grammars use `keyword.other` (colored blue in VSCode Dark+) for regular keywords and `keyword.control` (colored purple in VSCode Dark+) for control keywords. The TextMate scope `keyword` is colored like control keywords, not regular keywords. It may seem strange that the `keyword` scope is not the right fallback for the `keyword` semantic token, but TextMate has a long and weird history. Note how keywords change from purple back to blue (what they were before semantic coloring was added):

**(1) Use punctuation.section.embedded for format specifiers**. This aligns with how Typescript colors formatting directives:

<img width="238" alt="Screen Shot 2020-05-09 at 10 54 01 AM" src="https://user-images.githubusercontent.com/1369240/81481258-93b5f280-91e3-11ea-99c2-c6d258c5bcad.png">

**(2) Consistently use `entity.name.type.*` scopes for type names**. Avoid using `entity.name.*` which gets colored like a keyword.

**(3) Use Property instead of Member for fields**. Property and Member are very similar, but if you look at the TextMate fallback scopes, it's clear that Member is intended for function-like-things (methods?) and Property is intended for variable-like-things.

**(4) Color `for` as a regular keyword when it's part of `impl Trait for Struct`**. 

**(5) Use `variable.other.constant` for constants instead of `entity.name.constant`**. In the latest VSCode insiders, variable.other.constant has a subtly different color that differentiates constants from ordinary variables. It looks close to the green of types but it's not the same---it's a new color recently added to take advantage of semantic coloring.

I also made some minor changes that make the TextMate scopes better match the semantic scopes. The effect of this for the user is you observe less of a change when semantic coloring "activates". You can see the changes I made relative to the built-in TextMate grammar here:

a91d15c80c..97428b6d52 (diff-6966c729b862f79f79bf7258eb3e0885)


Co-authored-by: George Fraser <george@fivetran.com>
2020-05-11 17:33:38 +00:00
bors[bot]
de1fe23c1e
Merge #4403
4403: Check client capabilities before sending progress notifications r=kjeremy a=kjeremy

Fixes #4384

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-05-11 17:25:34 +00:00
Jeremy Kolb
d4471dccfe Check client capabilities before sending progress notifications
Fixes #4384
2020-05-11 13:16:46 -04:00
bors[bot]
115347a9c6
Merge #4424
4424: Use RA_LOG instead of RUST_LOG for logging r=matklad a=matklad

RUST_LOG might be set up for debugging the user's problem, slowing
down rust-analyzer considerably. That's the same reason why rustc uses
RUSTC_LOG.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-11 17:16:26 +00:00
Aleksey Kladov
72e229fcb3 Use RA_LOG instead of RUST_LOG for logging
RUST_LOG might be set up for debugging the user's problem, slowing
down rust-analyzer considerably. That's the same reason why rustc uses
RUSTC_LOG.
2020-05-11 19:16:00 +02:00
Benjamin Coenen
4e54b1ca46 add tests module snippet
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-11 18:11:23 +02:00
vsrs
e914d622ec DebugConfiguration simplification.
${workspaceRoot} substitution in generated DebugConfiguration.
2020-05-11 18:49:45 +03:00
vsrs
fee0a9fa5a "rust-analyzer.newDebugConfig" command 2020-05-11 18:04:49 +03:00
vsrs
155f060142 "rust-analyzer.debug" command 2020-05-11 16:06:57 +03:00
bors[bot]
05399250d4
Merge #4421
4421: Find references to a function outside module r=flodiebold a=montekki

Fixes #4188 

Yet again, it looks like although the code in 
da1f316b02/crates/ra_ide_db/src/search.rs (L128-L132)

may be wrong, it is not hit since the `vis` is `None` at this point. The fix is similar to the #4237 case: just add another special case to `Definition::visibility()`.

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2020-05-11 12:21:08 +00:00
Fedor Sakharov
3d66aa0542
New definition_visibility method 2020-05-11 14:28:14 +03:00
Fedor Sakharov
753e1e679c
Also for consts and type aliases 2020-05-11 13:52:20 +03:00
Fedor Sakharov
762ec9581a
Find references to a function outside module 2020-05-11 12:25:18 +03:00
bors[bot]
eb892d707c
Merge #4419
4419: ⬆️ ra_vfs r=matklad a=matklad

Fix a critical bug where \r\n line endings would accidentally sneak in
after in-memory overlay removal.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-10 23:09:27 +00:00
Aleksey Kladov
ded460146b ⬆️ ra_vfs
Fix a critical bug where \r\n line endings would accidentally sneak in
after in-memory overlay removal.
2020-05-11 00:52:11 +02:00
George Fraser
97428b6d52 Put sigil back to keyword.operator 2020-05-10 15:36:47 -07:00
George Fraser
2d2b32abe5 Change lifetimes back to keyword-ish, tweak builtins for consistency between TextMate and semantic 2020-05-10 13:32:42 -07:00
George Fraser
63b75a40c8 Color for as a regular keyword when it's part of impl _ for _ 2020-05-10 13:11:14 -07:00
George Fraser
3f1c73633e Color in as a control keyword 2020-05-10 13:07:28 -07:00
George Fraser
46566d7a79 Color as as a keyword 2020-05-10 13:07:28 -07:00
George Fraser
e86379ad15 No longer true 2020-05-10 13:07:28 -07:00
George Fraser
60e8e56dfa Color core types as types, not keywords 2020-05-10 13:07:28 -07:00
George Fraser
0881c889bf Color sigil like keyword 2020-05-10 13:07:28 -07:00
George Fraser
d5d154ba3f Color lifetimes like types 2020-05-10 13:07:28 -07:00
George Fraser
a91d15c80c Import built-in textmate grammar, with no changes 2020-05-10 13:07:28 -07:00
George Fraser
cff0d6b6e6 Use Property instead of Member for fields 2020-05-10 13:07:28 -07:00
George Fraser
da0c8d96d4 Tweak the textmate fallback scopes to be consistent with builtin TextMate grammar and other languages 2020-05-10 13:04:55 -07:00
veetaha
2a5ab9f5dd Resolve TODO about macro 2.0 def 2020-05-10 22:08:06 +03:00
veetaha
73c6bc4dbd Fix typo 2020-05-10 21:59:15 +03:00
veetaha
33f240960d Carify on a semicolon in macro call 2020-05-10 21:57:49 +03:00
veetaha
a1dc28f236 Resolve TODO about curly-braced constructions in expression statement 2020-05-10 21:51:53 +03:00
veetaha
1677f35ef1 Remove TODO about Block since it was removed 2020-05-10 21:46:26 +03:00
veetaha
8a298eed7a Resolve todos about refs and empty statements 2020-05-10 21:44:14 +03:00
veetaha
f5e2e02aa9 Converted TODO about MacroItems to FIXME as per edwin0cheng 2020-05-10 21:06:12 +03:00
veetaha
71f2be968b Verified ConstArg example, waiting for response on what = sign pertains to 2020-05-10 21:02:21 +03:00
bors[bot]
bfb40a698d
Merge #4396
4396: Improve panic message for ast_from_text r=jonas-schievink a=edwin0cheng

Related: #4368

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-10 18:01:20 +00:00
veetaha
f6fd4c4a74 Correcy use tree and type args docs 2020-05-10 20:52:25 +03:00
bors[bot]
74e72e9afa
Merge #4394 #4414
4394: Simplify r=matklad a=Veetaha



4414: Highlighting improvements r=matklad a=matthewjasper

- `static mut`s are highlighted as `mutable`.
- The name of the macro declared by `macro_rules!` is now highlighted.

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
2020-05-10 17:47:27 +00:00
veetaha
9a82ee0de2 Fix "show syntax tree" command
@matlkad please don't forget to keep it up-to-date!
2020-05-10 20:43:48 +03:00
bors[bot]
a3dbd272e0
Merge #4406 #4410 #4411 #4417
4406: Update cargo-metadata r=matklad a=edwin0cheng

This PR update `cargo-metadata` to  0.10.0 and it also relax the` serde-derive` deps to 1.0 for tests in `proc-macro-srv`.

cc @robojumper 

r= @matklad  , I think you would have something to say related to https://github.com/serde-rs/json/issues/647#issue-593788429 ?





4410: Improve wording in comment r=matklad a=edwin0cheng



4411: do not remove then block when you unwrap else block #4361 r=matklad a=bnjjj

close #4361 

4417: Omit default types in HirDisplay SourceCode mode r=matklad a=TimoFreiberg

Closes #4390

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-05-10 17:37:07 +00:00
bors[bot]
348cbc054c
Merge #4418
4418: Refactor protocol handling r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-10 17:28:59 +00:00
Aleksey Kladov
3bec2be9de req -> lsp_ext 2020-05-10 19:27:12 +02:00
Aleksey Kladov
bec3bf701c Don't re-export lsp_types 2020-05-10 19:24:02 +02:00
veetaha
2af6b4b67e Correct use cannot have type args as per flodiebold 2020-05-10 20:23:29 +03:00
veetaha
a19b164661 Correct path docs and add colon2 token to Path ast node 2020-05-10 20:21:46 +03:00
Aleksey Kladov
a78e1573b1 Better fn signature 2020-05-10 19:14:02 +02:00
Aleksey Kladov
bd8422643a to_proto::semantic_tokens 2020-05-10 19:09:22 +02:00
Aleksey Kladov
1586bab0b9 Simplify proto conversion
Trait based infra in conv.rs is significantly more complicated than
what we actually need here.
2020-05-10 19:01:26 +02:00
veetaha
eedf11ae88 Add example with const in TypeBound as per flodiebold 2020-05-10 19:24:06 +03:00
veetaha
5707c2d7a6 Remove todo comment about arg vs param difference as per clarification from flodiebold 2020-05-10 19:19:56 +03:00