From 58413b22d7b5a6f416580dd07831f94f22857de2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Nov 2019 22:28:40 +0300 Subject: [PATCH 1/2] Don't continue line comments --- crates/ra_ide_api/src/typing.rs | 34 ++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs index d51132f7360..21e5be9b383 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 me + let x = 1 + 1; +} +", + r" +fn main() { + // Fix + // <|> me + let x = 1 + 1; +} +", + ); + do_check_noop( + r" +fn main() { + // Fix me<|> + let x = 1 + 1; +} +", + ); + do_check_noop(r"<|>//! docz"); } From 6fbad0619b8f02b69677006dcb20d47936b72846 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 Nov 2019 10:33:08 +0300 Subject: [PATCH 2/2] Ban println in lsp_server --- crates/ra_lsp_server/src/lib.rs | 24 ++++++++++++++++++++++-- crates/ra_lsp_server/src/main.rs | 3 +-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs index 0e5dbbbd506..9c36402b0b9 100644 --- a/crates/ra_lsp_server/src/lib.rs +++ b/crates/ra_lsp_server/src/lib.rs @@ -1,6 +1,26 @@ -//! FIXME: write short doc here - +//! Implementation of the LSP for rust-analyzer. +//! +//! This crate takes Rust-specific analysis results from ra_ide_api and +//! translates into LSP types. +//! +//! It also is the root of all state. `world` module defines the bulk of the +//! state, and `main_loop` module defines the rules for modifying it. #![recursion_limit = "512"] + +#[allow(unused)] +macro_rules! println { + ($($tt:tt)*) => { + compile_error!("stdout is locked, use eprintln") + }; +} + +#[allow(unused)] +macro_rules! print { + ($($tt:tt)*) => { + compile_error!("stdout is locked, use eprint") + }; +} + mod caps; mod cargo_target_spec; mod conv; diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index 7d9a1d054d0..e13c8ca1441 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs @@ -1,8 +1,7 @@ -//! FIXME: write short doc here +//! `ra_lsp_server` binary use flexi_logger::{Duplicate, Logger}; use lsp_server::Connection; - use ra_lsp_server::{show_message, Result, ServerConfig}; use ra_prof;