Commit Graph

2670 Commits

Author SHA1 Message Date
Aleksey Kladov
ce040aa907 add profile calls to real-time requests 2019-05-27 11:48:23 +03:00
bors[bot]
bdd779aa44 Merge #1277
1277: Improve macro item resolution r=matklad a=edwin0cheng

~This PR add a new namespace `Macros` in `per_ns.rs` to allow following use case:~
This PR improve macro item resolution to allow following use case:

```rust
//- /main.rs     
use foo::bar;
bar!();

//- /lib.rs  (crate foo)
#[macro_export]
macro_rules! bar{
() => {
    struct Foo { field: u32 } 
}
```


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-27 07:38:21 +00:00
Edwin Cheng
6d68d60d32 Formatting 2019-05-27 15:37:22 +08:00
bors[bot]
ce694ae118 Merge #1328
1328: Change TokenSource to iteration based r=matklad a=edwin0cheng

This PR change the `TokenSource` trait from random access to be an iteration based trait:
```rust

/// `TokenSource` abstracts the source of the tokens parser operates one.
///
/// Hopefully this will allow us to treat text and token trees in the same way!
pub trait TokenSource {
    fn current(&self) -> Token;

    /// Lookahead n token
    fn lookahead_nth(&self, n: usize) -> Token;

    /// bump cursor to next token
    fn bump(&mut self);

    /// Is the current token a specified keyword?
    fn is_keyword(&self, kw: &str) -> bool;
}

/// `TokenCursor` abstracts the cursor of `TokenSource` operates one.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Token {
    /// What is the current token?
    pub kind: SyntaxKind,

    /// Is the current token joined to the next one (`> >` vs `>>`).
    pub is_jointed_to_next: bool,
}
```

Note that the refactoring based on this new trait will be separated to incoming PRs

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-27 07:28:13 +00:00
Edwin Cheng
d6e6a98c03 Add Test for new item resolution 2019-05-26 20:11:18 +08:00
Edwin Cheng
b72074a715 Use ItemOrMacro in item resolution 2019-05-26 20:10:56 +08:00
Edwin Cheng
c0dc14ba5a Add Either dep 2019-05-26 20:10:05 +08:00
Edwin Cheng
d5fbce4458 Put back unexpaned_macros after resolve 2019-05-26 13:38:03 +08:00
Edwin Cheng
90764fc54b Remove duplicated code 2019-05-26 02:41:00 +08:00
Edwin Cheng
816147c4b5 Simplify token_tree_to_xxx 2019-05-25 21:55:46 +08:00
Edwin Cheng
fcb1eef323 Change TokenSource to iteration based 2019-05-25 20:41:03 +08:00
Aleksey Kladov
c6e905a79f Colorize Rust code as HTML 2019-05-25 13:42:34 +03:00
Aleksey Kladov
0270b4bc57 reformat 2019-05-24 01:48:44 +03:00
Aleksey Kladov
53ae63835d ⬆️ rustc 2019-05-24 01:46:23 +03:00
bors[bot]
de87fe293e Merge #1317
1317: profile highlighting r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-23 18:25:35 +00:00
Aleksey Kladov
f6d2c3f9d5 profile highlighting 2019-05-23 21:19:54 +03:00
bors[bot]
afb792acb7 Merge #1316
1316: Simplify code model r=matklad a=matklad

* remove references from types which are now id-based
* remove api/impl separation, as the impl is a tiny fraction of API anyway 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-23 18:16:46 +00:00
Aleksey Kladov
ef3169a33a rename code_model_api -> code_model 2019-05-23 21:14:19 +03:00
Aleksey Kladov
0e57d58dd0 kill code_model_impl 2019-05-23 21:13:22 +03:00
Aleksey Kladov
ce82fbfc44 remove more references 2019-05-23 21:08:10 +03:00
Aleksey Kladov
bde9cab66e remove references 2019-05-23 21:01:31 +03:00
Aleksey Kladov
7f22f90503 kill krate_impl 2019-05-23 20:30:09 +03:00
Aleksey Kladov
dbd02546b9 fix signature 2019-05-23 20:25:55 +03:00
bors[bot]
1dc9adc6e2 Merge #1290
1290: Add Union to code_model r=matklad a=matklad

@flodiebold I am conflicted about two possible implementation approaches:

* we can add a separate `struct Union` to code model
* we can add `fn is_union(&self)` to existing `Struct`

This PR goes with the former approach, because it seems like Unions are sufficiently different in semantics to warrant a separate types. Which is in contrast to Syntax Tree, where both structs and unions share the same node kind, because their syntax is the same. 

What would be the right thing to do here?

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-23 17:23:17 +00:00
Aleksey Kladov
5d54aa6781 add union to code_model 2019-05-23 20:18:47 +03:00
bors[bot]
ef00b5af1c Merge #1312
1312: Introduce TokenBuffer r=matklad a=edwin0cheng

As discussed in Zulip, this PR Introduce `TokenBuffer` , a safe version of  `syn` crate `TokenBuffer` which support cursor based traversal of `tt::TokenTree`. This is the basis of incoming refactoring of `TokenSource` iterator based API.

This PR do the following things:

* Add TokenBuffer in `ra_tt` crate.
* Try to use this new API to refactor the `SubtreeSource` to prove it usage.




Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-23 14:31:26 +00:00
Edwin Cheng
63b67134fd Use slice instead of Vec 2019-05-23 21:05:22 +08:00
Laurențiu Nicola
f1ec88cc56 Improve highlighting of name refs 2019-05-23 15:31:35 +03:00
bors[bot]
4466568525 Merge #1311
1311: Move NameRef classification logic out of reference_definition r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-05-23 09:39:22 +00:00
Laurențiu Nicola
444e52e519 Move NameRef classification logic out of reference_definition 2019-05-23 12:32:47 +03:00
Dylan Moonfire
cbd131acbe updated gen_lsp_server examples
- updated the documentation with an example that has no errors with current compiler
- added two example code to test compilation and show in use
2019-05-22 20:35:12 -05:00
Edwin Cheng
27ae626cfb Formatting 2019-05-23 09:31:36 +08:00
Edwin Cheng
dd50ca7c5e Refactor SubtreeSource 2019-05-23 02:23:56 +08:00
Edwin Cheng
4d7a567bc5 Introduce TokenBuffer 2019-05-23 02:09:26 +08:00
Aleksey Kladov
f15bb3c98a add profile calls to parsing/expansion routines 2019-05-22 11:31:07 +03:00
bors[bot]
67d5927b16 Merge #1281
1281: Move arm cond to match guard r=matklad a=unrealhoang

I did split the rename to another commit, yet Github UI still show entirely new file change. Please review using commits.

Co-authored-by: Unreal Hoang <unrealhoang@gmail.com>
2019-05-22 07:39:54 +00:00
Aleksey Kladov
6fed943bd2 better profilig 2019-05-22 00:00:58 +03:00
Florian Diebold
ced971ee9f Fix crash with int vars in canonicalization 2019-05-21 20:40:29 +02:00
Florian Diebold
f613c48d2e Use fuel branch for Chalk
This makes sure we don't take too long in trait solving.
2019-05-21 20:40:29 +02:00
Aleksey Kladov
ed943adb29 re-enable chalk 2019-05-21 20:57:36 +03:00
Aleksey Kladov
26463f189f publish gen_lsp_server 0.2 2019-05-21 18:57:33 +03:00
Unreal Hoang
08e954f0fd
add assist to move arm condition to match guard 2019-05-21 23:31:51 +09:00
bors[bot]
51e82fe6d2 Merge #1299
1299: Use ThemeColor and add support for light themes r=matklad a=lnicola

Part of #1294.

- switch to `ThemeColor`
- add light and high contrast theme definitions
- highlight control flow keywords and `unsafe`


Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-05-21 13:58:42 +00:00
Laurențiu Nicola
b08362f6d2 Address feedback 2019-05-21 16:28:10 +03:00
Aleksey Kladov
f63be06002 profile type inference 2019-05-21 16:26:13 +03:00
Aleksey Kladov
0f3e85002b profile implements query 2019-05-21 16:04:17 +03:00
Aleksey Kladov
908c9589a8 fix odrer-of-iteration bug in tests 2019-05-21 14:51:52 +03:00
Laurențiu Nicola
9ade271a67 Use ThemeColor and add support for light themes 2019-05-21 14:19:08 +03:00
Aleksey Kladov
0efb5364c3 sort hash maps for tests 2019-05-21 14:14:31 +03:00
bors[bot]
c59a3cdb03 Merge #1296
1296: ⬆️ insta r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-21 10:28:55 +00:00