Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes

This commit is contained in:
Seivan Heidari 2019-11-22 09:20:22 +01:00
commit eb7363d167
3 changed files with 54 additions and 7 deletions

View File

@ -40,9 +40,13 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour
}
let prefix = comment.prefix();
if position.offset
< comment.syntax().text_range().start() + TextUnit::of_str(prefix) + TextUnit::from(1)
{
let comment_range = comment.syntax().text_range();
if position.offset < comment_range.start() + TextUnit::of_str(prefix) + TextUnit::from(1) {
return None;
}
// Continuing non-doc line comments (like this one :) ) is annoying
if prefix == "//" && comment_range.end() == position.offset {
return None;
}
@ -247,6 +251,30 @@ fn foo() {}
}
",
);
do_check(
r"
fn main() {
// Fix<|> 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");
}

View File

@ -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;

View File

@ -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;