Commit graph

3962 commits

Author SHA1 Message Date
Laurențiu Nicola
9146a64386 Highlight type names correctly 2019-05-29 08:30:53 +03:00
Aleksey Kladov
80a1725147 fix todo 2019-05-28 18:50:53 +03:00
Aleksey Kladov
61e1474ab3 fix typos in mbe tests 2019-05-28 18:46:11 +03:00
Aleksey Kladov
c8bcfe6a05 fix syntax errors in tests 2019-05-28 18:07:39 +03:00
Aleksey Kladov
2e3f5af9d4 move mbe to the new API 2019-05-28 17:39:01 +03:00
Aleksey Kladov
0efbcdf435 remove old parsing methods 2019-05-28 17:34:28 +03:00
Aleksey Kladov
310bfe57bd update test data 2019-05-28 17:09:45 +03:00
Aleksey Kladov
bc2550b196 update tests 2019-05-28 16:59:22 +03:00
Aleksey Kladov
afeaea7051 drop error from SOurceFile constructor 2019-05-28 16:34:23 +03:00
Aleksey Kladov
1cece9f219 return errors from tree builder 2019-05-28 16:26:14 +03:00
Aleksey Kladov
90926b9479 drop errors from SyntaxNode 2019-05-28 16:15:17 +03:00
Aleksey Kladov
f52eda675e add Parse 2019-05-28 16:15:17 +03:00
bors[bot]
0545e4781d Merge #1336
1336: Refactor SubtreeSource r=matklad a=edwin0cheng

This PR simplify `SubtreeSource` by removing `SubtreeWalk` and `Querier` and only walk through the top level `TokenTree` when collecting token from source, by comparing two cursors directly.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-05-28 06:03:47 +00:00
Edwin Cheng
464a00814c Use cfg(test) instead of allow(unused) 2019-05-28 10:55:08 +08:00
Edwin Cheng
a3b9aecc9b Minor use module 2019-05-28 00:54:32 +08:00
Edwin Cheng
98aac6b751 Simpliy how collecting token from src 2019-05-28 00:38:55 +08:00
Edwin Cheng
c8c9230dd2 Add more helper func in Cursor 2019-05-27 23:51:52 +08:00
Edwin Cheng
d833ded3b4 Remove Queier and SubtreeWalk 2019-05-27 23:20:43 +08:00
bors[bot]
b2bf41b2ba Merge #1334
1334: check for cancellation during macro expansion r=matklad a=matklad

closes #1331

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-27 11:45:41 +00:00
Aleksey Kladov
a2845bb1f5 check cancellation when expanding macros 2019-05-27 14:41:14 +03:00
Aleksey Kladov
0d2f97e83e specifically profile cancellation 2019-05-27 14:27:05 +03:00
Aleksey Kladov
cf214ac4e7 enable profiling in tests 2019-05-27 14:20:11 +03:00
bors[bot]
0d1c607607 Merge #1319
1319: Rainbow highlighting spike 🌈 r=killercup a=killercup

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?

Co-authored-by: Pascal Hertleif <pascal@technocreatives.com>
2019-05-27 09:56:06 +00:00
Pascal Hertleif
1e6ba19015 Make rainbows optional 2019-05-27 11:44:46 +02:00
Pascal Hertleif
4ac338b608
rename stray id field 2019-05-27 11:26:35 +02:00
Pascal Hertleif
5abcca516d
make it build again 2019-05-27 11:26:35 +02:00
Pascal Hertleif
2b200f6e1a
Disable broken struct field rainbowing 2019-05-27 11:26:35 +02:00
Pascal Hertleif
43d5a49653
More clever highlighting, incl draft for structs 2019-05-27 11:26:35 +02:00
Pascal Hertleif
ed89b0638b
Hash based on binding name and shadow counter 2019-05-27 11:26:35 +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
bors[bot]
4b48cff022 Merge #1333
1333: add profile calls to real-time requests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-27 08:48:50 +00:00
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
bors[bot]
4f4e50db90 Merge #1330
1330: Add Vim and NeoVim setup section r=oblitum a=oblitum



Co-authored-by: Francisco Lopes <francisco@oblita.com>
2019-05-26 05:34:02 +00:00
Francisco Lopes
da28dccf62 Add Vim and NeoVim setup section 2019-05-25 18:55:59 -03: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
bors[bot]
91bd783273 Merge #1327
1327: Colorize Rust code as HTML r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-25 10:48:47 +00:00
Aleksey Kladov
c6e905a79f Colorize Rust code as HTML 2019-05-25 13:42:34 +03:00
bors[bot]
9800699bab Merge #1318
1318: cargo update r=matklad a=kjeremy

Nothing interesting

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-05-23 23:06:16 +00:00
bors[bot]
8a9cc67421 Merge #1321
1321: Rustc r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-23 22:50:34 +00: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