Browse Source

Add clang-format command to configuration. I use clang-format-3.7 for instance.

merge-requests/365/head
Jørgen Lien Sellæg 10 years ago
parent
commit
785f4ef123
  1. 1
      src/config.cc
  2. 1
      src/files.h
  3. 2
      src/source_clang.cc
  4. 1
      src/terminal.h

1
src/config.cc

@ -71,6 +71,7 @@ void MainConfig::retrieve_config() {
Singleton::Config::window()->default_size = {cfg.get<int>("default_window_size.width"), cfg.get<int>("default_window_size.height")}; Singleton::Config::window()->default_size = {cfg.get<int>("default_window_size.width"), cfg.get<int>("default_window_size.height")};
Singleton::Config::terminal()->make_command=cfg.get<std::string>("project.make_command"); Singleton::Config::terminal()->make_command=cfg.get<std::string>("project.make_command");
Singleton::Config::terminal()->cmake_command=cfg.get<std::string>("project.cmake_command"); Singleton::Config::terminal()->cmake_command=cfg.get<std::string>("project.cmake_command");
Singleton::Config::terminal()->clang_format_commad=cfg.get<std::string>("project.clang_format_command");
Singleton::Config::terminal()->history_size=cfg.get<int>("terminal_history_size"); Singleton::Config::terminal()->history_size=cfg.get<int>("terminal_history_size");
} }

1
src/files.h

@ -105,6 +105,7 @@ const std::string configjson =
" \"cmake_command\": \"cmake\",\n" " \"cmake_command\": \"cmake\",\n"
#endif #endif
" \"make_command\": \"make\"\n" " \"make_command\": \"make\"\n"
" \"clang_format_command\": \"clang-format\"\n"
" },\n" " },\n"
" \"documentation_searches\": {\n" " \"documentation_searches\": {\n"
" \"clang\": {\n" " \"clang\": {\n"

2
src/source_clang.cc

@ -924,7 +924,7 @@ Source::ClangViewAutocomplete(file_path, project_path, language) {
}); });
auto_indent=[this]() { auto_indent=[this]() {
std::string command="clang-format"; auto command=Singleton::Config::terminal()->clang_format_command;
unsigned indent_width; unsigned indent_width;
std::string tab_style; std::string tab_style;
if(tab_char=='\t') { if(tab_char=='\t') {

1
src/terminal.h

@ -16,6 +16,7 @@ public:
public: public:
std::string cmake_command; std::string cmake_command;
std::string make_command; std::string make_command;
std::string clang_format_command;
int history_size; int history_size;
}; };

Loading…
Cancel
Save