diff options
author | Seivan Heidari <[email protected]> | 2019-11-22 08:20:22 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-11-22 08:20:22 +0000 |
commit | eb7363d167c7a9f7c73cb950b621eb1dce493318 (patch) | |
tree | e20d40e888040bef36d833860af1377106a4144c /crates | |
parent | a63a269ec84192114cc1ac7f079e96144ae877a1 (diff) | |
parent | d59bf33b9e1c20d6ef3fd9b72f3cf4730172b5a8 (diff) |
Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide_api/src/typing.rs | 34 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/lib.rs | 24 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main.rs | 3 |
3 files changed, 54 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs index d51132f73..21e5be9b3 100644 --- a/crates/ra_ide_api/src/typing.rs +++ b/crates/ra_ide_api/src/typing.rs | |||
@@ -40,9 +40,13 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour | |||
40 | } | 40 | } |
41 | 41 | ||
42 | let prefix = comment.prefix(); | 42 | let prefix = comment.prefix(); |
43 | if position.offset | 43 | let comment_range = comment.syntax().text_range(); |
44 | < comment.syntax().text_range().start() + TextUnit::of_str(prefix) + TextUnit::from(1) | 44 | if position.offset < comment_range.start() + TextUnit::of_str(prefix) + TextUnit::from(1) { |
45 | { | 45 | return None; |
46 | } | ||
47 | |||
48 | // Continuing non-doc line comments (like this one :) ) is annoying | ||
49 | if prefix == "//" && comment_range.end() == position.offset { | ||
46 | return None; | 50 | return None; |
47 | } | 51 | } |
48 | 52 | ||
@@ -247,6 +251,30 @@ impl S { | |||
247 | } | 251 | } |
248 | ", | 252 | ", |
249 | ); | 253 | ); |
254 | do_check( | ||
255 | r" | ||
256 | fn main() { | ||
257 | // Fix<|> me | ||
258 | let x = 1 + 1; | ||
259 | } | ||
260 | ", | ||
261 | r" | ||
262 | fn main() { | ||
263 | // Fix | ||
264 | // <|> me | ||
265 | let x = 1 + 1; | ||
266 | } | ||
267 | ", | ||
268 | ); | ||
269 | do_check_noop( | ||
270 | r" | ||
271 | fn main() { | ||
272 | // Fix me<|> | ||
273 | let x = 1 + 1; | ||
274 | } | ||
275 | ", | ||
276 | ); | ||
277 | |||
250 | do_check_noop(r"<|>//! docz"); | 278 | do_check_noop(r"<|>//! docz"); |
251 | } | 279 | } |
252 | 280 | ||
diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs index 0e5dbbbd5..9c36402b0 100644 --- a/crates/ra_lsp_server/src/lib.rs +++ b/crates/ra_lsp_server/src/lib.rs | |||
@@ -1,6 +1,26 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! Implementation of the LSP for rust-analyzer. |
2 | 2 | //! | |
3 | //! This crate takes Rust-specific analysis results from ra_ide_api and | ||
4 | //! translates into LSP types. | ||
5 | //! | ||
6 | //! It also is the root of all state. `world` module defines the bulk of the | ||
7 | //! state, and `main_loop` module defines the rules for modifying it. | ||
3 | #![recursion_limit = "512"] | 8 | #![recursion_limit = "512"] |
9 | |||
10 | #[allow(unused)] | ||
11 | macro_rules! println { | ||
12 | ($($tt:tt)*) => { | ||
13 | compile_error!("stdout is locked, use eprintln") | ||
14 | }; | ||
15 | } | ||
16 | |||
17 | #[allow(unused)] | ||
18 | macro_rules! print { | ||
19 | ($($tt:tt)*) => { | ||
20 | compile_error!("stdout is locked, use eprint") | ||
21 | }; | ||
22 | } | ||
23 | |||
4 | mod caps; | 24 | mod caps; |
5 | mod cargo_target_spec; | 25 | mod cargo_target_spec; |
6 | mod conv; | 26 | mod conv; |
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index 7d9a1d054..e13c8ca14 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs | |||
@@ -1,8 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! `ra_lsp_server` binary |
2 | 2 | ||
3 | use flexi_logger::{Duplicate, Logger}; | 3 | use flexi_logger::{Duplicate, Logger}; |
4 | use lsp_server::Connection; | 4 | use lsp_server::Connection; |
5 | |||
6 | use ra_lsp_server::{show_message, Result, ServerConfig}; | 5 | use ra_lsp_server::{show_message, Result, ServerConfig}; |
7 | use ra_prof; | 6 | use ra_prof; |
8 | 7 | ||