From 81b3b670dce2687a0c2be2e4886d18e5c18359bb Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 26 May 2021 08:31:56 +0200 Subject: [PATCH] Improved instructions when rust installation is not found --- docs/language_servers.md | 2 +- src/notebook.cpp | 5 ++++- src/window.cpp | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/language_servers.md b/docs/language_servers.md index a3294f4..fbbae20 100644 --- a/docs/language_servers.md +++ b/docs/language_servers.md @@ -69,7 +69,7 @@ ln -s `which pyls` /usr/local/bin/python-language-server ## Rust - Prerequisites: - - Rust + - [Rust](https://www.rust-lang.org/tools/install) Install language server, and create symbolic link to enable server in juCi++: diff --git a/src/notebook.cpp b/src/notebook.cpp index 123809e..bef2af1 100644 --- a/src/notebook.cpp +++ b/src/notebook.cpp @@ -204,8 +204,11 @@ bool Notebook::open(const boost::filesystem::path &file_path_, Position position shown.emplace(language_id); } else if(language_id == "rust") { - Terminal::get().print("\e[33mWarning\e[m: could not find Rust language server.\n"); + auto rust_installed = !filesystem::get_rust_sysroot_path().empty(); + Terminal::get().print(std::string("\e[33mWarning\e[m: could not find Rust ") + (rust_installed ? "language server" : "installation") + ".\n"); Terminal::get().print("For installation instructions please visit: https://gitlab.com/cppit/jucipp/-/blob/master/docs/language_servers.md#rust.\n"); + if(!rust_installed) + Terminal::get().print("You will need to restart juCi++ after installing Rust.\n"); shown.emplace(language_id); } } diff --git a/src/window.cpp b/src/window.cpp index 95d332c..2850448 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -442,8 +442,9 @@ void Window::set_menu_actions() { menu.add_action("file_new_project_rust", []() { auto sysroot = filesystem::get_rust_sysroot_path(); if(sysroot.empty()) { - Terminal::get().print("\e[33mWarning\e[m: could not find Rust.\n"); + Terminal::get().print("\e[33mWarning\e[m: could not find Rust installation.\n"); Terminal::get().print("For installation instructions please visit: https://gitlab.com/cppit/jucipp/-/blob/master/docs/language_servers.md#rust.\n"); + Terminal::get().print("You will need to restart juCi++ after installing Rust.\n"); return; } boost::filesystem::path project_path = Dialog::new_folder(Project::get_preferably_directory_folder());