diff --git a/docs/language_servers.md b/docs/language_servers.md index c0de42a..aa43cfe 100644 --- a/docs/language_servers.md +++ b/docs/language_servers.md @@ -1,6 +1,8 @@ # Setup of tested language servers -## JavaScript with Flow static type checker +## JavaScript/TypeScript + +### JavaScript with Flow static type checker * Prerequisites: * Node.js * Recommended: @@ -19,7 +21,7 @@ chmod 755 /usr/local/bin/javascript-language-server * Additional setup within a JavaScript project: * Add a `.prettierrc` file to enable style format on save -## TypeScript or JavaScript without Flow +### TypeScript or JavaScript without Flow * Prerequisites: * Node.js * Recommended: diff --git a/src/notebook.cpp b/src/notebook.cpp index 28ded3a..8b81d7e 100644 --- a/src/notebook.cpp +++ b/src/notebook.cpp @@ -174,8 +174,30 @@ bool Notebook::open(const boost::filesystem::path &file_path_, Position position source_views.emplace_back(new Source::ClangView(file_path, language)); else if(language && !language_protocol_language_id.empty() && !filesystem::find_executable(language_protocol_language_id + "-language-server").empty()) source_views.emplace_back(new Source::LanguageProtocolView(file_path, language, language_protocol_language_id)); - else + else { + if(language) { + static std::set shown; + std::string language_id = language->get_id(); + if(shown.find(language_id) == shown.end()) { + if(language_id == "js") { + Terminal::get().print("\e[33mWarning\e[m: Could not find JavaScript/TypeScript language server.\n"); + Terminal::get().print("For installation instructions please visit: https://gitlab.com/cppit/jucipp/-/blob/master/docs/language_servers.md#javascripttypescript.\n"); + shown.emplace(language_id); + } + else if(language_id == "python") { + Terminal::get().print("\e[33mWarning\e[m: Could not find Python language server.\n"); + Terminal::get().print("For installation instructions please visit: https://gitlab.com/cppit/jucipp/-/blob/master/docs/language_servers.md#python3.\n"); + shown.emplace(language_id); + } + else if(language_id == "rust") { + Terminal::get().print("\e[33mWarning\e[m: Could not find Rust language server.\n"); + Terminal::get().print("For installation instructions please visit: https://gitlab.com/cppit/jucipp/-/blob/master/docs/language_servers.md#rust.\n"); + shown.emplace(language_id); + } + } + } source_views.emplace_back(new Source::GenericView(file_path, language)); + } auto view = source_views.back();