Browse Source

Formatted code with custom clang-format

merge-requests/389/head
eidheim 8 years ago
parent
commit
bf984231d4
  1. 9
      .clang-format
  2. 27
      README.md
  3. 6
      src/cmake.cc
  4. 2
      src/cmake.h
  5. 3
      src/compile_commands.cc
  6. 2
      src/compile_commands.h
  7. 4
      src/config.cc
  8. 8
      src/config.h
  9. 8
      src/ctags.cc
  10. 3
      src/ctags.h
  11. 11
      src/debug_lldb.cc
  12. 6
      src/debug_lldb.h
  13. 2
      src/dialogs.cc
  14. 5
      src/dialogs.h
  15. 1
      src/dialogs_unix.cc
  16. 4
      src/dialogs_win.cc
  17. 11
      src/directories.cc
  18. 13
      src/directories.h
  19. 5
      src/dispatcher.h
  20. 2
      src/documentation_cppreference.h
  21. 8
      src/entrybox.h
  22. 9
      src/filesystem.cc
  23. 4
      src/filesystem.h
  24. 36
      src/git.cc
  25. 15
      src/git.h
  26. 1
      src/info.h
  27. 6
      src/juci.cc
  28. 3
      src/juci.h
  29. 2
      src/menu.cc
  30. 6
      src/menu.h
  31. 14
      src/meson.cc
  32. 8
      src/notebook.cc
  33. 5
      src/notebook.h
  34. 11
      src/project.cc
  35. 15
      src/project.h
  36. 6
      src/project_build.h
  37. 10
      src/selection_dialog.cc
  38. 7
      src/selection_dialog.h
  39. 75
      src/source.cc
  40. 13
      src/source.h
  41. 16
      src/source_base.cc
  42. 5
      src/source_base.h
  43. 34
      src/source_clang.cc
  44. 20
      src/source_clang.h
  45. 2
      src/source_diff.cc
  46. 14
      src/source_diff.h
  47. 46
      src/source_language_protocol.cc
  48. 4
      src/source_language_protocol.h
  49. 12
      src/source_spellcheck.cc
  50. 3
      src/source_spellcheck.h
  51. 13
      src/terminal.cc
  52. 11
      src/terminal.h
  53. 5
      src/tooltips.h
  54. 6
      src/usages_clang.cc
  55. 30
      src/window.cc
  56. 3
      src/window.h
  57. 6
      tests/cmake_build_test.cc
  58. 6
      tests/git_test.cc
  59. 6
      tests/lldb_test.cc
  60. 2
      tests/meson_build_test.cc
  61. 2
      tests/process_test.cc
  62. 6
      tests/source_clang_test.cc
  63. 4
      tests/source_test.cc
  64. 12
      tests/stubs/selection_dialog.cc
  65. 2
      tests/usages_clang_test_files/main.cpp

9
.clang-format

@ -0,0 +1,9 @@
IndentWidth: 2
AccessModifierOffset: -2
UseTab: Never
ColumnLimit: 0
MaxEmptyLinesToKeep: 2
SpaceBeforeParens: Never
BreakBeforeBraces: Custom
BraceWrapping: {BeforeElse: true, BeforeCatch: true}
NamespaceIndentation: All

27
README.md

@ -77,3 +77,30 @@ See [installation guide](docs/install.md).
## Documentation
See [how to build the API doc](docs/api.md).
## Coding style
Due to poor lambda support in clang-format, a custom clang-format is used with the following patch applied:
```diff
diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp
index bb8efd61a3..e80a487055 100644
--- a/lib/Format/ContinuationIndenter.cpp
+++ b/lib/Format/ContinuationIndenter.cpp
@@ -276,6 +276,8 @@ LineState ContinuationIndenter::getInitialState(unsigned FirstIndent,
}
bool ContinuationIndenter::canBreak(const LineState &State) {
+ if(Style.ColumnLimit==0)
+ return true;
const FormatToken &Current = *State.NextToken;
const FormatToken &Previous = *Current.Previous;
assert(&Previous == Current.Previous);
@@ -325,6 +327,8 @@ bool ContinuationIndenter::canBreak(const LineState &State) {
}
bool ContinuationIndenter::mustBreak(const LineState &State) {
+ if(Style.ColumnLimit==0)
+ return false;
const FormatToken &Current = *State.NextToken;
const FormatToken &Previous = *Current.Previous;
if (Current.MustBreakBefore || Current.is(TT_InlineASMColon))
```

6
src/cmake.cc

@ -1,10 +1,10 @@
#include "cmake.h"
#include "filesystem.h"
#include "dialogs.h"
#include "compile_commands.h"
#include "config.h"
#include "dialogs.h"
#include "filesystem.h"
#include "terminal.h"
#include <regex>
#include "compile_commands.h"
CMake::CMake(const boost::filesystem::path &path) {
const auto find_cmake_project = [](const boost::filesystem::path &cmake_path) {

2
src/cmake.h

@ -1,8 +1,8 @@
#pragma once
#include <boost/filesystem.hpp>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <vector>
class CMake {
public:

3
src/compile_commands.cc

@ -77,7 +77,8 @@ CompileCommands::CompileCommands(const boost::filesystem::path &build_path) {
commands.emplace_back(Command{directory, parameters, boost::filesystem::absolute(file, build_path)});
}
}
catch(...) {}
catch(...) {
}
}
std::vector<std::string> CompileCommands::get_arguments(const boost::filesystem::path &build_path, const boost::filesystem::path &file_path) {

2
src/compile_commands.h

@ -1,7 +1,7 @@
#pragma once
#include <boost/filesystem.hpp>
#include <vector>
#include <string>
#include <vector>
class CompileCommands {
public:

4
src/config.cc

@ -1,10 +1,10 @@
#include "config.h"
#include <exception>
#include "files.h"
#include <iostream>
#include "filesystem.h"
#include "terminal.h"
#include <algorithm>
#include <exception>
#include <iostream>
Config::Config() {
home_path = filesystem::get_home_path();

8
src/config.h

@ -1,11 +1,11 @@
#pragma once
#include <boost/property_tree/json_parser.hpp>
#include "dispatcher.h"
#include <boost/filesystem.hpp>
#include <unordered_map>
#include <boost/property_tree/json_parser.hpp>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "dispatcher.h"
class Config {
public:
@ -93,8 +93,10 @@ public:
std::unordered_map<std::string, DocumentationSearch> documentation_searches;
};
private:
Config();
public:
static Config &get() {
static Config singleton;

8
src/ctags.cc

@ -1,12 +1,12 @@
#include "ctags.h"
#include "config.h"
#include "terminal.h"
#include "project_build.h"
#include "filesystem.h"
#include "project_build.h"
#include "terminal.h"
#include <climits>
#include <iostream>
#include <vector>
#include <regex>
#include <climits>
#include <vector>
std::pair<boost::filesystem::path, std::unique_ptr<std::stringstream>> Ctags::get_result(const boost::filesystem::path &path) {
auto build = Project::Build::create(path);

3
src/ctags.h

@ -1,7 +1,7 @@
#pragma once
#include <string>
#include <boost/filesystem.hpp>
#include <sstream>
#include <string>
#include <vector>
class Ctags {
@ -22,6 +22,7 @@ public:
static Location get_location(const std::string &line, bool markup);
static std::vector<Location> get_locations(const boost::filesystem::path &path, const std::string &name, const std::string &type);
private:
static std::vector<std::string> get_type_parts(const std::string &type);
};

11
src/debug_lldb.cc

@ -3,12 +3,12 @@
#ifdef __APPLE__
#include <cstdlib>
#endif
#include <boost/filesystem.hpp>
#include <iostream>
#include "terminal.h"
#include "config.h"
#include "filesystem.h"
#include "process.hpp"
#include "config.h"
#include "terminal.h"
#include <boost/filesystem.hpp>
#include <iostream>
extern char **environ;
@ -406,7 +406,8 @@ void Debug::LLDB::select_frame(uint32_t frame_index, uint32_t thread_index_id) {
if(state == lldb::StateType::eStateStopped) {
if(thread_index_id != 0)
process->SetSelectedThreadByIndexID(thread_index_id);
process->GetSelectedThread().SetSelectedFrame(frame_index);;
process->GetSelectedThread().SetSelectedFrame(frame_index);
;
}
}

6
src/debug_lldb.h

@ -2,8 +2,8 @@
#include <boost/filesystem.hpp>
#include <list>
#include <lldb/API/LLDB.h>
#include <thread>
#include <mutex>
#include <thread>
#include <tuple>
namespace Debug {
@ -29,8 +29,10 @@ namespace Debug {
int line_nr;
int line_index;
};
private:
LLDB();
public:
static LLDB &get() {
static LLDB singleton;
@ -85,4 +87,4 @@ namespace Debug {
size_t buffer_size;
};
}
} // namespace Debug

2
src/dialogs.cc

@ -39,8 +39,10 @@ std::string Dialog::gtk_dialog(const boost::filesystem::path &path, const std::s
#ifdef __APPLE__
class FileChooserDialog : public Gtk::FileChooserDialog {
Gtk::FileChooserAction action;
public:
FileChooserDialog(const Glib::ustring &title, Gtk::FileChooserAction action) : Gtk::FileChooserDialog(title, action), action(action) {}
protected:
bool on_key_press_event(GdkEventKey *key_event) override {
if(action == Gtk::FileChooserAction::FILE_CHOOSER_ACTION_OPEN || action == Gtk::FileChooserAction::FILE_CHOOSER_ACTION_SELECT_FOLDER) {

5
src/dialogs.h

@ -1,8 +1,8 @@
#pragma once
#include <string>
#include <boost/filesystem.hpp>
#include <vector>
#include <gtkmm.h>
#include <string>
#include <vector>
class Dialog {
public:
@ -15,6 +15,7 @@ public:
class Message : public Gtk::Window {
public:
Message(const std::string &text);
protected:
bool on_delete_event(GdkEventAny *event) override;
};

1
src/dialogs_unix.cc

@ -29,4 +29,3 @@ std::string Dialog::save_file_as(const boost::filesystem::path &path) {
{std::make_pair("Cancel", Gtk::RESPONSE_CANCEL), std::make_pair("Save", Gtk::RESPONSE_OK)},
Gtk::FILE_CHOOSER_ACTION_SAVE);
}

4
src/dialogs_win.cc

@ -1,15 +1,15 @@
#include "dialogs.h"
#include "singletons.h"
#include "juci.h"
#include "singletons.h"
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_VISTA
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#include <windows.h>
#include <shobjidl.h>
#include <vector>
#include <windows.h>
#include <iostream> //TODO: remove
using namespace std; //TODO: remove

11
src/directories.cc

@ -1,10 +1,10 @@
#include "directories.h"
#include <algorithm>
#include "entrybox.h"
#include "filesystem.h"
#include "notebook.h"
#include "source.h"
#include "terminal.h"
#include "notebook.h"
#include "filesystem.h"
#include "entrybox.h"
#include <algorithm>
bool Directories::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path &path, const Gtk::SelectionData &selection_data) const {
return true;
@ -522,7 +522,8 @@ void Directories::add_or_update_path(const boost::filesystem::path &dir_path, co
try {
repository = Git::get_repository(dir_path);
}
catch(const std::exception &) {}
catch(const std::exception &) {
}
monitor->signal_changed().connect([this, connection, path_and_row, repository](const Glib::RefPtr<Gio::File> &file,
const Glib::RefPtr<Gio::File> &,

13
src/directories.h

@ -1,15 +1,15 @@
#pragma once
#include "boost/filesystem.hpp"
#include "dispatcher.h"
#include "git.h"
#include <atomic>
#include <gtkmm.h>
#include <vector>
#include <mutex>
#include <string>
#include "boost/filesystem.hpp"
#include <thread>
#include <mutex>
#include <atomic>
#include <unordered_map>
#include <unordered_set>
#include "git.h"
#include "dispatcher.h"
#include <vector>
class Directories : public Gtk::ListViewText {
class DirectoryData {
@ -51,6 +51,7 @@ class Directories : public Gtk::ListViewText {
};
Directories();
public:
static Directories &get() {
static Directories singleton;

5
src/dispatcher.h

@ -1,8 +1,8 @@
#pragma once
#include <gtkmm.h>
#include <mutex>
#include <functional>
#include <gtkmm.h>
#include <list>
#include <mutex>
class Dispatcher {
private:
@ -10,6 +10,7 @@ private:
std::mutex functions_mutex;
Glib::Dispatcher dispatcher;
sigc::connection connection;
public:
Dispatcher();
~Dispatcher();

2
src/documentation_cppreference.h

@ -6,4 +6,4 @@ namespace Documentation {
public:
static std::string get_url(const std::string &symbol) noexcept;
};
}
} // namespace Documentation

8
src/entrybox.h

@ -1,9 +1,9 @@
#pragma once
#include <list>
#include <functional>
#include "gtkmm.h"
#include <unordered_map>
#include <functional>
#include <list>
#include <string>
#include <unordered_map>
#include <vector>
class EntryBox : public Gtk::Box {
@ -12,6 +12,7 @@ public:
public:
Entry(const std::string &content = "", std::function<void(const std::string &content)> on_activate_ = nullptr, unsigned width_chars = -1);
std::function<void(const std::string &content)> on_activate;
private:
size_t selected_history;
};
@ -33,6 +34,7 @@ public:
private:
EntryBox();
public:
static EntryBox &get() {
static EntryBox singleton;

9
src/filesystem.cc

@ -1,7 +1,7 @@
#include <algorithm>
#include <fstream>
#include <iostream>
#include <sstream>
#include <algorithm>
#include "filesystem.h"
@ -21,7 +21,9 @@ std::vector<std::string> filesystem::read_lines(const std::string &path) {
std::vector<std::string> res;
std::ifstream input(path, std::ofstream::binary);
if(input) {
do { res.emplace_back(); } while(getline(input, res.back()));
do {
res.emplace_back();
} while(getline(input, res.back()));
}
input.close();
return res;
@ -210,7 +212,8 @@ boost::filesystem::path filesystem::get_executable(const boost::filesystem::path
return executable;
}
}
catch(...) {}
catch(...) {
}
return executable_name;
}

4
src/filesystem.h

@ -1,7 +1,7 @@
#pragma once
#include <vector>
#include <string>
#include <boost/filesystem.hpp>
#include <string>
#include <vector>
class filesystem {
public:

36
src/git.cc

@ -15,7 +15,8 @@ std::string Git::Error::message() noexcept {
Git::Repository::Diff::Diff(const boost::filesystem::path &path, git_repository *repository) : repository(repository) {
blob = std::shared_ptr<git_blob>(nullptr, [](git_blob *blob) {
if(blob) git_blob_free(blob);
if(blob)
git_blob_free(blob);
});
Error error;
std::lock_guard<std::mutex> lock(mutex);
@ -59,8 +60,7 @@ std::vector<Git::Repository::Diff::Hunk> Git::Repository::Diff::get_hunks(const
git_diff_options options;
git_diff_init_options(&options, GIT_DIFF_OPTIONS_VERSION);
options.context_lines = 0;
error.code=git_diff_buffers(old_buffer.c_str(), old_buffer.size(), nullptr, new_buffer.c_str(), new_buffer.size(), nullptr, &options, nullptr, nullptr,
[](const git_diff_delta *delta, const git_diff_hunk *hunk, void *payload) {
error.code = git_diff_buffers(old_buffer.c_str(), old_buffer.size(), nullptr, new_buffer.c_str(), new_buffer.size(), nullptr, &options, nullptr, nullptr, [](const git_diff_delta *delta, const git_diff_hunk *hunk, void *payload) {
auto hunks = static_cast<std::vector<Git::Repository::Diff::Hunk> *>(payload);
hunks->emplace_back(hunk->old_start, hunk->old_lines, hunk->new_start, hunk->new_lines);
return 0;
@ -128,16 +128,26 @@ Git::Repository::~Repository() {
std::string Git::Repository::status_string(STATUS status) noexcept {
switch(status) {
case STATUS::CURRENT: return "current";
case STATUS::NEW: return "new";
case STATUS::MODIFIED: return "modified";
case STATUS::DELETED: return "deleted";
case STATUS::RENAMED: return "renamed";
case STATUS::TYPECHANGE: return "typechange";
case STATUS::UNREADABLE: return "unreadable";
case STATUS::IGNORED: return "ignored";
case STATUS::CONFLICTED: return "conflicted";
default: return "";
case STATUS::CURRENT:
return "current";
case STATUS::NEW:
return "new";
case STATUS::MODIFIED:
return "modified";
case STATUS::DELETED:
return "deleted";
case STATUS::RENAMED:
return "renamed";
case STATUS::TYPECHANGE:
return "typechange";
case STATUS::UNREADABLE:
return "unreadable";
case STATUS::IGNORED:
return "ignored";
case STATUS::CONFLICTED:
return "conflicted";
default:
return "";
}
}

15
src/git.h

@ -1,19 +1,21 @@
#pragma once
#include <boost/filesystem.hpp>
#include <giomm.h>
#include <git2.h>
#include <mutex>
#include <memory>
#include <iostream>
#include <memory>
#include <mutex>
#include <unordered_set>
#include <vector>
#include <giomm.h>
#include <boost/filesystem.hpp>
class Git {
friend class Repository;
public:
class Error {
friend class Git;
std::string message() noexcept;
public:
int code = 0;
operator bool() noexcept { return code < 0; }
@ -37,6 +39,7 @@ public:
/// Start and size
std::pair<int, int> new_lines;
};
private:
friend class Repository;
Diff(const boost::filesystem::path &path, git_repository *repository);
@ -45,6 +48,7 @@ public:
git_diff_options options;
static int hunk_cb(const git_diff_delta *delta, const git_diff_hunk *hunk, void *payload) noexcept;
static int line_cb(const git_diff_delta *delta, const git_diff_hunk *hunk, const git_diff_line *line, void *payload) noexcept;
public:
Lines get_lines(const std::string &buffer);
static std::vector<Hunk> get_hunks(const std::string &old_buffer, const std::string &new_buffer);
@ -57,6 +61,7 @@ public:
std::unordered_set<std::string> added;
std::unordered_set<std::string> modified;
};
private:
friend class Git;
Repository(const boost::filesystem::path &path);
@ -70,6 +75,7 @@ public:
Status saved_status;
bool has_saved_status = false;
std::mutex saved_status_mutex;
public:
~Repository();
@ -99,6 +105,7 @@ private:
static void initialize() noexcept;
static boost::filesystem::path path(const char *cpath, size_t cpath_length = static_cast<size_t>(-1)) noexcept;
public:
static std::shared_ptr<Repository> get_repository(const boost::filesystem::path &path);
};

1
src/info.h

@ -3,6 +3,7 @@
class Info : public Gtk::InfoBar {
Info();
public:
static Info &get() {
static Info instance;

6
src/juci.cc

@ -1,10 +1,10 @@
#include "juci.h"
#include "window.h"
#include "notebook.h"
#include "config.h"
#include "directories.h"
#include "menu.h"
#include "config.h"
#include "notebook.h"
#include "terminal.h"
#include "window.h"
#ifndef _WIN32
#include <csignal>
#endif

3
src/juci.h

@ -25,8 +25,8 @@
[juCi++] --> [tiny-process-library] : use
\enduml
*/
#include <gtkmm.h>
#include <boost/filesystem.hpp>
#include <gtkmm.h>
class Application : public Gtk::Application {
public:
@ -34,6 +34,7 @@ public:
int on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine> &cmd) override;
void on_activate() override;
void on_startup() override;
private:
std::vector<boost::filesystem::path> directories;
std::vector<std::pair<boost::filesystem::path, size_t>> files;

2
src/menu.cc

@ -1,7 +1,7 @@
#include "menu.h"
#include "config.h"
#include <string>
#include <iostream>
#include <string>
const Glib::ustring menu_xml = R"RAW(<interface>
<menu id='right-click-line-menu'>

6
src/menu.h

@ -1,11 +1,12 @@
#pragma once
#include <string>
#include <unordered_map>
#include <functional>
#include <gtkmm.h>
#include <string>
#include <unordered_map>
class Menu {
Menu() = default;
public:
static Menu &get() {
static Menu singleton;
@ -23,6 +24,7 @@ public:
std::unique_ptr<Gtk::Menu> right_click_line_menu;
std::unique_ptr<Gtk::Menu> right_click_selected_menu;
std::function<void()> toggle_menu_items = [] {};
private:
Glib::RefPtr<Gtk::Builder> builder;
};

14
src/meson.cc

@ -1,10 +1,10 @@
#include "meson.h"
#include "filesystem.h"
#include "compile_commands.h"
#include <regex>
#include "terminal.h"
#include "dialogs.h"
#include "config.h"
#include "dialogs.h"
#include "filesystem.h"
#include "terminal.h"
#include <regex>
Meson::Meson(const boost::filesystem::path &path) {
const auto find_project = [](const boost::filesystem::path &file_path) {
@ -51,7 +51,8 @@ bool Meson::update_default_build(const boost::filesystem::path &default_build_pa
return true;
Dialog::Message message("Creating/updating default build");
auto exit_status=Terminal::get().process(Config::get().project.meson.command+' '+(compile_commands_exists?"--internal regenerate ":"")+
auto exit_status = Terminal::get().process(Config::get().project.meson.command + ' ' +
(compile_commands_exists ? "--internal regenerate " : "") +
filesystem::escape_argument(project_path.string()), default_build_path);
message.hide();
if(exit_status == EXIT_SUCCESS)
@ -77,7 +78,8 @@ bool Meson::update_debug_build(const boost::filesystem::path &debug_build_path,
return true;
Dialog::Message message("Creating/updating debug build");
auto exit_status=Terminal::get().process(Config::get().project.meson.command+' '+(compile_commands_exists?"--internal regenerate ":"")+
auto exit_status = Terminal::get().process(Config::get().project.meson.command + ' ' +
(compile_commands_exists ? "--internal regenerate " : "") +
"--buildtype debug " + filesystem::escape_argument(project_path.string()), debug_build_path);
message.hide();
if(exit_status == EXIT_SUCCESS)

8
src/notebook.cc

@ -1,14 +1,14 @@
#include "notebook.h"
#include "config.h"
#include "directories.h"
#include <fstream>
#include <regex>
#include "project.h"
#include "filesystem.h"
#include "gtksourceview-3.0/gtksourceview/gtksourcemap.h"
#include "project.h"
#include "selection_dialog.h"
#include "source_clang.h"
#include "source_language_protocol.h"
#include "gtksourceview-3.0/gtksourceview/gtksourcemap.h"
#include <fstream>
#include <regex>
Notebook::TabLabel::TabLabel(const std::function<void()> &on_close) {
set_can_focus(false);

5
src/notebook.h

@ -1,10 +1,10 @@
#pragma once
#include <iostream>
#include "gtkmm.h"
#include "source.h"
#include <type_traits>
#include <iostream>
#include <map>
#include <sigc++/sigc++.h>
#include <type_traits>
class Notebook : public Gtk::Paned {
class TabLabel : public Gtk::EventBox {
@ -22,6 +22,7 @@ class Notebook : public Gtk::Paned {
private:
Notebook();
public:
static Notebook &get() {
static Notebook singleton;

11
src/project.cc

@ -1,20 +1,20 @@
#include "project.h"
#include "config.h"
#include "terminal.h"
#include "filesystem.h"
#include "directories.h"
#include <fstream>
#include "filesystem.h"
#include "menu.h"
#include "notebook.h"
#include "selection_dialog.h"
#include "terminal.h"
#include <fstream>
#ifdef JUCI_ENABLE_DEBUG
#include "debug_lldb.h"
#endif
#include "ctags.h"
#include "info.h"
#include "source_clang.h"
#include "source_language_protocol.h"
#include "usages_clang.h"
#include "ctags.h"
#include <future>
boost::filesystem::path Project::debug_last_stop_file_path;
@ -731,7 +731,8 @@ void Project::LanguageProtocol::show_symbols() {
offsets->emplace_back(Source::Offset(start_it->second.get<unsigned>("line"), start_it->second.get<unsigned>("character"), file));
names.emplace_back(name);
}
catch(...) {}
catch(...) {
}
}
}
}

15
src/project.h

@ -1,12 +1,12 @@
#pragma once
#include <gtkmm.h>
#include <boost/filesystem.hpp>
#include <atomic>
#include <unordered_map>
#include "tooltips.h"
#include "dispatcher.h"
#include <iostream>
#include "project_build.h"
#include "tooltips.h"
#include <atomic>
#include <boost/filesystem.hpp>
#include <gtkmm.h>
#include <iostream>
#include <unordered_map>
namespace Project {
class DebugRunArguments {
@ -40,6 +40,7 @@ namespace Project {
class Base : public std::enable_shared_from_this<Base> {
protected:
static std::unique_ptr<DebugOptions> debug_options;
public:
Base() = default;
Base(std::unique_ptr<Build> &&build) : build(std::move(build)) {}
@ -164,4 +165,4 @@ namespace Project {
std::shared_ptr<Base> create();
extern std::shared_ptr<Base> current;
};
}; // namespace Project

6
src/project_build.h

@ -1,7 +1,7 @@
#pragma once
#include <boost/filesystem.hpp>
#include "cmake.h"
#include "meson.h"
#include <boost/filesystem.hpp>
namespace Project {
class Build {
@ -23,6 +23,7 @@ namespace Project {
class CMakeBuild : public Build {
::CMake cmake;
public:
CMakeBuild(const boost::filesystem::path &path);
@ -35,6 +36,7 @@ namespace Project {
class MesonBuild : public Build {
Meson meson;
public:
MesonBuild(const boost::filesystem::path &path);
@ -57,4 +59,4 @@ namespace Project {
};
class NpmBuild : public Build {};
}
} // namespace Project

10
src/selection_dialog.cc

@ -36,8 +36,8 @@ void SelectionDialogBase::ListViewText::clear() {
size = 0;
}
SelectionDialogBase::SelectionDialogBase(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup):
start_mark(start_mark), text_view(text_view), window(Gtk::WindowType::WINDOW_POPUP), vbox(Gtk::Orientation::ORIENTATION_VERTICAL), list_view_text(use_markup), show_search_entry(show_search_entry) {
SelectionDialogBase::SelectionDialogBase(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup)
: start_mark(start_mark), text_view(text_view), window(Gtk::WindowType::WINDOW_POPUP), vbox(Gtk::Orientation::ORIENTATION_VERTICAL), list_view_text(use_markup), show_search_entry(show_search_entry) {
auto g_application = g_application_get_default();
auto gio_application = Glib::wrap(g_application, true);
auto application = Glib::RefPtr<Gtk::Application>::cast_static(gio_application);
@ -195,7 +195,8 @@ void SelectionDialogBase::hide() {
std::unique_ptr<SelectionDialog> SelectionDialog::instance;
SelectionDialog::SelectionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup) : SelectionDialogBase(text_view, start_mark, show_search_entry, use_markup) {
SelectionDialog::SelectionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup)
: SelectionDialogBase(text_view, start_mark, show_search_entry, use_markup) {
auto search_key = std::make_shared<std::string>();
auto filter_model = Gtk::TreeModelFilter::create(list_view_text.get_model());
@ -412,7 +413,8 @@ bool CompletionDialog::on_key_press(GdkEventKey* key) {
}
return false;
}
if(key->keyval==GDK_KEY_Shift_L || key->keyval==GDK_KEY_Shift_R || key->keyval==GDK_KEY_Alt_L || key->keyval==GDK_KEY_Alt_R || key->keyval==GDK_KEY_Control_L || key->keyval==GDK_KEY_Control_R || key->keyval==GDK_KEY_Meta_L || key->keyval==GDK_KEY_Meta_R)
if(key->keyval == GDK_KEY_Shift_L || key->keyval == GDK_KEY_Shift_R || key->keyval == GDK_KEY_Alt_L || key->keyval == GDK_KEY_Alt_R ||
key->keyval == GDK_KEY_Control_L || key->keyval == GDK_KEY_Control_R || key->keyval == GDK_KEY_Meta_L || key->keyval == GDK_KEY_Meta_R)
return false;
if((key->keyval == GDK_KEY_Down || key->keyval == GDK_KEY_KP_Down) && list_view_text.get_model()->children().size() > 0) {
auto it = list_view_text.get_selection()->get_selected();

7
src/selection_dialog.h

@ -1,7 +1,7 @@
#pragma once
#include "gtkmm.h"
#include <unordered_map>
#include <functional>
#include <unordered_map>
class SelectionDialogBase {
class ListViewText : public Gtk::TreeView {
@ -14,6 +14,7 @@ class SelectionDialogBase {
Gtk::TreeModelColumn<std::string> text;
Gtk::TreeModelColumn<unsigned int> index;
};
public:
bool use_markup;
ColumnRecord column_record;
@ -21,6 +22,7 @@ class SelectionDialogBase {
void append(const std::string &value);
void erase_rows();
void clear();
private:
Glib::RefPtr<Gtk::ListStore> list_store;
Gtk::CellRendererText cell_renderer;
@ -69,6 +71,7 @@ protected:
class SelectionDialog : public SelectionDialogBase {
SelectionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup);
static std::unique_ptr<SelectionDialog> instance;
public:
bool on_key_press(GdkEventKey *key);
@ -84,6 +87,7 @@ public:
class CompletionDialog : public SelectionDialogBase {
CompletionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark);
static std::unique_ptr<CompletionDialog> instance;
public:
bool on_key_release(GdkEventKey *key);
bool on_key_press(GdkEventKey *key);
@ -92,6 +96,7 @@ public:
instance = std::unique_ptr<CompletionDialog>(new CompletionDialog(text_view, start_mark));
}
static std::unique_ptr<CompletionDialog> &get() { return instance; }
private:
void select(bool hide_window = true);

75
src/source.cc

@ -1,23 +1,23 @@
#include "source.h"
#include "config.h"
#include "directories.h"
#include "filesystem.h"
#include "terminal.h"
#include "git.h"
#include "info.h"
#include "directories.h"
#include "menu.h"
#include "selection_dialog.h"
#include "git.h"
#include <gtksourceview/gtksource.h>
#include "terminal.h"
#include <boost/property_tree/json_parser.hpp>
#include <boost/spirit/home/qi/char.hpp>
#include <boost/spirit/home/qi/operator.hpp>
#include <boost/spirit/home/qi/string.hpp>
#include <gtksourceview/gtksource.h>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <regex>
#include <limits>
#include <set>
Glib::RefPtr<Gsv::LanguageManager> Source::LanguageManager::get_default() {
static auto instance = Gsv::LanguageManager::create();
@ -388,24 +388,15 @@ Gsv::DrawSpacesFlags Source::View::parse_show_whitespace_characters(const std::s
namespace qi = boost::spirit::qi;
qi::symbols<char, Gsv::DrawSpacesFlags> options;
options.add
("space", Gsv::DRAW_SPACES_SPACE)
("tab", Gsv::DRAW_SPACES_TAB)
("newline", Gsv::DRAW_SPACES_NEWLINE)
("nbsp", Gsv::DRAW_SPACES_NBSP)
("leading", Gsv::DRAW_SPACES_LEADING)
("text", Gsv::DRAW_SPACES_TEXT)
("trailing", Gsv::DRAW_SPACES_TRAILING)
("all", Gsv::DRAW_SPACES_ALL);
options.add("space", Gsv::DRAW_SPACES_SPACE)("tab", Gsv::DRAW_SPACES_TAB)("newline", Gsv::DRAW_SPACES_NEWLINE)("nbsp", Gsv::DRAW_SPACES_NBSP)
("leading", Gsv::DRAW_SPACES_LEADING)("text", Gsv::DRAW_SPACES_TEXT)("trailing", Gsv::DRAW_SPACES_TRAILING)("all", Gsv::DRAW_SPACES_ALL);
std::set<Gsv::DrawSpacesFlags> out;
// parse comma-separated list of options
qi::phrase_parse(text.begin(), text.end(), options % ',', qi::space, out);
return out.count(Gsv::DRAW_SPACES_ALL)>0 ?
Gsv::DRAW_SPACES_ALL :
static_cast<Gsv::DrawSpacesFlags>(std::accumulate(out.begin(), out.end(), 0));
return out.count(Gsv::DRAW_SPACES_ALL) > 0 ? Gsv::DRAW_SPACES_ALL : static_cast<Gsv::DrawSpacesFlags>(std::accumulate(out.begin(), out.end(), 0));
}
bool Source::View::save() {
@ -684,7 +675,8 @@ void Source::View::setup_format_style(bool is_generic_view) {
hide_tooltips();
}
}
catch(...) {}
catch(...) {
}
}
}
else if(is_generic_view) {
@ -705,7 +697,8 @@ void Source::View::setup_format_style(bool is_generic_view) {
add_diagnostic_tooltip(start, end, sm[1].str(), true);
}
catch(...) {}
catch(...) {
}
}
}
if(is_generic_view) {
@ -1266,12 +1259,14 @@ Gtk::TextIter Source::View::find_non_whitespace_code_iter_backward(Gtk::TextIter
*iter == '/' ||
#endif
*iter == ' ' || *iter == '\t' || iter.ends_line()) &&
iter.backward_char()) {}
iter.backward_char()) {
}
return iter;
}
Gtk::TextIter Source::View::get_start_of_expression(Gtk::TextIter iter) {
while(!iter.starts_line() && (*iter==' ' || *iter=='\t' || iter.ends_line() || !is_code_iter(iter) || *iter=='/') && iter.backward_char()) {}
while(!iter.starts_line() && (*iter == ' ' || *iter == '\t' || iter.ends_line() || !is_code_iter(iter) || *iter == '/') && iter.backward_char()) {
}
if(iter.starts_line())
return iter;
@ -1332,12 +1327,14 @@ Gtk::TextIter Source::View::get_start_of_expression(Gtk::TextIter iter) {
if(!stream_operator_found && !colon_found) {
auto previous_iter = iter;
previous_iter.backward_char();
while(!previous_iter.starts_line() && (*previous_iter==' ' || previous_iter.ends_line()) && previous_iter.backward_char()) {}
while(!previous_iter.starts_line() && (*previous_iter == ' ' || previous_iter.ends_line()) && previous_iter.backward_char()) {
}
if(*previous_iter != ',' && *previous_iter != ':' && *previous_iter != '=' && *previous_iter != '&' && *previous_iter != '|')
return iter;
else if(*previous_iter == ':' && is_code_iter(previous_iter)) {
previous_iter.backward_char();
while(!previous_iter.starts_line() && *previous_iter==' ' && previous_iter.backward_char()) {}
while(!previous_iter.starts_line() && *previous_iter == ' ' && previous_iter.backward_char()) {
}
if(*previous_iter == ')') {
auto token = get_token(get_tabs_end_iter(get_buffer()->get_iter_at_line(previous_iter.get_line())));
if(token == "case")
@ -1594,11 +1591,13 @@ void Source::View::cleanup_whitespace_characters_on_return(const Gtk::TextIter &
auto start_blank_iter = iter;
auto end_blank_iter = iter;
while((*end_blank_iter == ' ' || *end_blank_iter == '\t') &&
!end_blank_iter.ends_line() && end_blank_iter.forward_char()) {}
!end_blank_iter.ends_line() && end_blank_iter.forward_char()) {
}
if(!start_blank_iter.starts_line()) {
start_blank_iter.backward_char();
while((*start_blank_iter == ' ' || *start_blank_iter == '\t') &&
!start_blank_iter.starts_line() && start_blank_iter.backward_char()) {}
!start_blank_iter.starts_line() && start_blank_iter.backward_char()) {
}
if(*start_blank_iter != ' ' && *start_blank_iter != '\t')
start_blank_iter.forward_char();
}
@ -1768,12 +1767,14 @@ bool Source::View::on_key_press_event_basic(GdkEventKey* key) {
// Special case if insert is at beginning of empty line:
if(iter.starts_line() && iter.ends_line() && !get_buffer()->get_has_selection()) {
auto prev_line_iter = iter;
while(prev_line_iter.starts_line() && prev_line_iter.backward_char()) {}
while(prev_line_iter.starts_line() && prev_line_iter.backward_char()) {
}
prev_line_iter = get_start_of_expression(prev_line_iter);
auto prev_line_tabs_end_iter = get_tabs_end_iter(prev_line_iter);
auto next_line_iter = iter;
while(next_line_iter.starts_line() && next_line_iter.forward_char()) {}
while(next_line_iter.starts_line() && next_line_iter.forward_char()) {
}
auto next_line_tabs_end_iter = get_tabs_end_iter(next_line_iter);
Gtk::TextIter tabs_end_iter;
@ -1889,7 +1890,8 @@ bool Source::View::on_key_press_event_basic(GdkEventKey* key) {
} while(iter.forward_char());
if(do_smart_delete) {
if(!insert_iter.starts_line()) {
while((*iter==' ' || *iter=='\t') && iter.forward_char()) {}
while((*iter == ' ' || *iter == '\t') && iter.forward_char()) {
}
}
get_buffer()->erase(insert_iter, iter);
return true;
@ -2224,7 +2226,8 @@ bool Source::View::on_key_press_event_bracket_language(GdkEventKey* key) {
// Indenting after for instance: if(...)\n...;\n
else if(*condition_iter == ';' && condition_iter.get_line() > 0 && is_code_iter(condition_iter)) {
auto previous_end_iter = start_iter;
while(previous_end_iter.backward_char() && !previous_end_iter.ends_line()) {}
while(previous_end_iter.backward_char() && !previous_end_iter.ends_line()) {
}
previous_end_iter = find_non_whitespace_code_iter_backward(previous_end_iter);
auto previous_start_iter = get_tabs_end_iter(get_buffer()->get_iter_at_line(get_start_of_expression(previous_end_iter).get_line()));
auto previous_tabs = get_line_before(previous_start_iter);
@ -2242,7 +2245,8 @@ bool Source::View::on_key_press_event_bracket_language(GdkEventKey* key) {
else if(*condition_iter == ':' && is_code_iter(condition_iter)) {
bool perform_indent = true;
auto iter = condition_iter;
while(!iter.starts_line() && *iter==' ' && iter.backward_char()) {}
while(!iter.starts_line() && *iter == ' ' && iter.backward_char()) {
}
if(*iter == ')') {
auto token = get_token(get_tabs_end_iter(get_buffer()->get_iter_at_line(iter.get_line())));
if(token != "case")
@ -2310,7 +2314,8 @@ bool Source::View::on_key_press_event_bracket_language(GdkEventKey* key) {
size_t line_nr = iter.get_line();
if(line_nr > 0 && tabs.size() >= tab_size && iter == tabs_end_iter) {
auto previous_end_iter = iter;
while(previous_end_iter.backward_char() && !previous_end_iter.ends_line()) {}
while(previous_end_iter.backward_char() && !previous_end_iter.ends_line()) {
}
auto condition_iter = find_non_whitespace_code_iter_backward(previous_end_iter);
auto previous_start_iter = get_tabs_end_iter(get_buffer()->get_iter_at_line(get_start_of_expression(condition_iter).get_line()));
auto previous_tabs = get_line_before(previous_start_iter);
@ -2351,7 +2356,8 @@ bool Source::View::on_key_press_event_bracket_language(GdkEventKey* key) {
if(*condition_iter == ';' && condition_iter.get_line() > 0 && is_code_iter(condition_iter)) {
auto start_iter = get_start_of_expression(condition_iter);
auto previous_end_iter = start_iter;
while(previous_end_iter.backward_char() && !previous_end_iter.ends_line()) {}
while(previous_end_iter.backward_char() && !previous_end_iter.ends_line()) {
}
previous_end_iter = find_non_whitespace_code_iter_backward(previous_end_iter);
auto previous_start_iter = get_tabs_end_iter(get_buffer()->get_iter_at_line(get_start_of_expression(previous_end_iter).get_line()));
auto previous_tabs = get_line_before(previous_start_iter);
@ -2995,7 +3001,8 @@ bool Source::View::on_button_press_event(GdkEventButton *event) {
if(iter)
get_buffer()->place_cursor(iter);
Menu::get().right_click_line_menu->popup(event->button, event->time);
} else {
}
else {
Menu::get().right_click_selected_menu->popup(event->button, event->time);
}
return true;

13
src/source.h

@ -1,14 +1,14 @@
#pragma once
#include "source_spellcheck.h"
#include "source_diff.h"
#include "source_spellcheck.h"
#include "tooltips.h"
#include <boost/property_tree/xml_parser.hpp>
#include <boost/filesystem.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include <set>
#include <tuple>
namespace Source {
/// Workaround for buggy Gsv::LanguageManager::get_default()
@ -99,6 +99,7 @@ namespace Source {
bool full_reparse_needed = false;
virtual void soft_reparse(bool delayed = false) { soft_reparse_needed = false; }
virtual void full_reparse() { full_reparse_needed = false; }
protected:
std::atomic<bool> parsed;
Tooltips diagnostic_tooltips;
@ -141,6 +142,7 @@ namespace Source {
std::string tab;
bool interactive_completion = true;
private:
void setup_tooltip_and_dialog_events();
void setup_format_style(bool is_generic_view);
@ -174,9 +176,10 @@ namespace Source {
public:
static Glib::RefPtr<CompletionBuffer> create() { return Glib::RefPtr<CompletionBuffer>(new CompletionBuffer()); }
};
public:
GenericView(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language);
void parse_language_file(Glib::RefPtr<CompletionBuffer> &completion_buffer, bool &has_context_class, const boost::property_tree::ptree &pt);
};
}
} // namespace Source

16
src/source_base.cc

@ -1,8 +1,8 @@
#include "source_base.h"
#include "config.h"
#include "git.h"
#include "info.h"
#include "terminal.h"
#include "git.h"
#include "config.h"
#include <fstream>
Source::BaseView::BaseView(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language) : Gsv::View(), file_path(file_path), language(language), status_diagnostics(0, 0, 0) {
@ -270,7 +270,8 @@ Gtk::TextIter Source::BaseView::get_iter_at_line_end(int line_nr) {
}
else {
auto iter = get_buffer()->get_iter_at_line(line_nr);
while(!iter.ends_line() && iter.forward_char()) {}
while(!iter.ends_line() && iter.forward_char()) {
}
return iter;
}
}
@ -308,7 +309,8 @@ Gtk::TextIter Source::BaseView::get_smart_home_iter(const Gtk::TextIter &iter) {
auto start_sentence_iter = start_line_iter;
while(!start_sentence_iter.ends_line() &&
(*start_sentence_iter == ' ' || *start_sentence_iter == '\t') &&
start_sentence_iter.forward_char()) {}
start_sentence_iter.forward_char()) {
}
if(iter > start_sentence_iter || iter == start_line_iter)
return start_sentence_iter;
@ -321,7 +323,8 @@ Gtk::TextIter Source::BaseView::get_smart_end_iter(const Gtk::TextIter &iter) {
auto end_sentence_iter = end_line_iter;
while(!end_sentence_iter.starts_line() &&
(*end_sentence_iter == ' ' || *end_sentence_iter == '\t' || end_sentence_iter.ends_line()) &&
end_sentence_iter.backward_char()) {}
end_sentence_iter.backward_char()) {
}
if(!end_sentence_iter.ends_line() && *end_sentence_iter != ' ' && *end_sentence_iter != '\t')
end_sentence_iter.forward_char();
@ -367,7 +370,8 @@ Gtk::TextIter Source::BaseView::get_tabs_end_iter(const Glib::RefPtr<Gtk::TextBu
}
Gtk::TextIter Source::BaseView::get_tabs_end_iter(int line_nr) {
auto sentence_iter = get_buffer()->get_iter_at_line(line_nr);
while((*sentence_iter==' ' || *sentence_iter=='\t') && !sentence_iter.ends_line() && sentence_iter.forward_char()) {}
while((*sentence_iter == ' ' || *sentence_iter == '\t') && !sentence_iter.ends_line() && sentence_iter.forward_char()) {
}
return sentence_iter;
}
Gtk::TextIter Source::BaseView::get_tabs_end_iter() {

5
src/source_base.h

@ -1,9 +1,9 @@
#pragma once
#include <boost/filesystem.hpp>
#include <gtksourceviewmm.h>
#include <mutex>
#include <set>
#include <boost/filesystem.hpp>
namespace Source {
class BaseView : public Gsv::View {
@ -74,6 +74,7 @@ namespace Source {
std::set<int> diagnostic_offsets;
void place_cursor_at_next_diagnostic();
public:
std::function<void(BaseView *view)> update_tab_label;
std::function<void(BaseView *view)> update_status_location;
@ -87,4 +88,4 @@ namespace Source {
bool disable_spellcheck = false;
};
}
} // namespace Source

34
src/source_clang.cc

@ -1,23 +1,23 @@
#include "source_clang.h"
#include "config.h"
#include "terminal.h"
#include "project_build.h"
#include "terminal.h"
#ifdef JUCI_ENABLE_DEBUG
#include "debug_lldb.h"
#endif
#include "info.h"
#include "dialogs.h"
#include "compile_commands.h"
#include "ctags.h"
#include "selection_dialog.h"
#include "dialogs.h"
#include "documentation_cppreference.h"
#include "filesystem.h"
#include "compile_commands.h"
#include "info.h"
#include "selection_dialog.h"
#include "usages_clang.h"
#include "documentation_cppreference.h"
clangmm::Index Source::ClangViewParse::clang_index(0, 0);
Source::ClangViewParse::ClangViewParse(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language):
BaseView(file_path, language), Source::View(file_path, language) {
Source::ClangViewParse::ClangViewParse(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language)
: BaseView(file_path, language), Source::View(file_path, language) {
Usages::Clang::erase_cache(file_path);
auto tag_table = get_buffer()->get_tag_table();
@ -441,8 +441,8 @@ void Source::ClangViewParse::show_type_tooltips(const Gdk::Rectangle &rectangle)
}
Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language):
BaseView(file_path, language), Source::ClangViewParse(file_path, language), autocomplete(this, interactive_completion, last_keyval, true) {
Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language)
: BaseView(file_path, language), Source::ClangViewParse(file_path, language), autocomplete(this, interactive_completion, last_keyval, true) {
non_interactive_completion = [this] {
if(CompletionDialog::get() && CompletionDialog::get()->is_visible())
return;
@ -572,7 +572,8 @@ Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::pa
else if(!interactive_completion) {
auto end_iter = get_buffer()->get_insert()->get_iter();
auto iter = end_iter;
while(iter.backward_char() && autocomplete.is_continue_key(*iter)) {}
while(iter.backward_char() && autocomplete.is_continue_key(*iter)) {
}
if(iter != end_iter)
iter.forward_char();
std::unique_lock<std::mutex> lock(autocomplete.prefix_mutex);
@ -795,7 +796,8 @@ bool Source::ClangViewAutocomplete::is_possible_parameter() {
auto iter = get_buffer()->get_insert()->get_iter();
if(iter.backward_char() && (!interactive_completion || last_keyval == '(' || last_keyval == ',' || last_keyval == ' ' ||
last_keyval == GDK_KEY_Return || last_keyval == GDK_KEY_KP_Enter)) {
while((*iter==' ' || *iter=='\t' || *iter=='\n' || *iter=='\r') && iter.backward_char()) {}
while((*iter == ' ' || *iter == '\t' || *iter == '\n' || *iter == '\r') && iter.backward_char()) {
}
if(*iter == '(' || *iter == ',')
return true;
}
@ -816,8 +818,8 @@ const std::unordered_map<std::string, std::string> &Source::ClangViewAutocomplet
}
Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language) :
BaseView(file_path, language), Source::ClangViewParse(file_path, language) {
Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language)
: BaseView(file_path, language), Source::ClangViewParse(file_path, language) {
get_buffer()->signal_changed().connect([this]() {
if(last_tagged_identifier) {
get_buffer()->remove_tag(similar_symbol_tag, get_buffer()->begin(), get_buffer()->end());
@ -1731,8 +1733,8 @@ void Source::ClangViewRefactor::tag_similar_identifiers(const Identifier &identi
}
Source::ClangView::ClangView(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language>& language):
BaseView(file_path, language), ClangViewParse(file_path, language), ClangViewAutocomplete(file_path, language), ClangViewRefactor(file_path, language) {
Source::ClangView::ClangView(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language)
: BaseView(file_path, language), ClangViewParse(file_path, language), ClangViewAutocomplete(file_path, language), ClangViewRefactor(file_path, language) {
if(language) {
get_source_buffer()->set_highlight_syntax(true);
get_source_buffer()->set_language(language);

20
src/source_clang.h

@ -1,14 +1,14 @@
#pragma once
#include <thread>
#include "autocomplete.h"
#include "clangmm.h"
#include "dispatcher.h"
#include "source.h"
#include "terminal.h"
#include <atomic>
#include <map>
#include <mutex>
#include <set>
#include "clangmm.h"
#include "source.h"
#include "terminal.h"
#include "dispatcher.h"
#include "autocomplete.h"
#include <thread>
namespace Source {
class ClangViewParse : public View {
@ -23,6 +23,7 @@ namespace Source {
void configure() override;
void soft_reparse(bool delayed = false) override;
protected:
Dispatcher dispatcher;
void parse_initialize();
@ -41,6 +42,7 @@ namespace Source {
std::atomic<ParseProcessState> parse_process_state;
CXCompletionString selected_completion_string = nullptr;
private:
Glib::ustring parse_thread_buffer;
@ -57,11 +59,13 @@ namespace Source {
class ClangViewAutocomplete : public virtual ClangViewParse {
public:
ClangViewAutocomplete(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language);
protected:
Autocomplete autocomplete;
std::unique_ptr<clangmm::CodeCompleteResults> code_complete_results;
std::vector<CXCompletionString> completion_strings;
sigc::connection delayed_show_arguments_connection;
private:
bool is_possible_parameter();
bool show_arguments;
@ -84,8 +88,10 @@ namespace Source {
std::string usr_extended;
clangmm::Cursor cursor;
};
public:
ClangViewRefactor(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language);
private:
Identifier get_identifier();
void wait_parsing();
@ -107,4 +113,4 @@ namespace Source {
std::thread full_reparse_thread;
bool full_reparse_running = false;
};
}
} // namespace Source

2
src/source_diff.cc

@ -1,8 +1,8 @@
#include "source_diff.h"
#include "config.h"
#include "terminal.h"
#include "filesystem.h"
#include "info.h"
#include "terminal.h"
#include <boost/version.hpp>
Source::DiffView::Renderer::Renderer() : Gsv::GutterRenderer() {

14
src/source_diff.h

@ -1,13 +1,13 @@
#pragma once
#include "dispatcher.h"
#include "git.h"
#include "source_base.h"
#include <atomic>
#include <boost/filesystem.hpp>
#include "dispatcher.h"
#include <set>
#include <map>
#include <thread>
#include <atomic>
#include <mutex>
#include "git.h"
#include <set>
#include <thread>
namespace Source {
class DiffView : virtual public Source::BaseView {
@ -28,6 +28,7 @@ namespace Source {
const Gdk::Rectangle &cell_area, Gtk::TextIter &start, Gtk::TextIter &end,
Gsv::GutterRendererState p6) override;
};
public:
DiffView(const boost::filesystem::path &file_path, const Glib::RefPtr<Gsv::Language> &language);
~DiffView() override;
@ -41,6 +42,7 @@ namespace Source {
/// Use canonical path to follow symbolic links
boost::filesystem::path canonical_file_path;
private:
std::mutex canonical_file_path_mutex;
@ -66,4 +68,4 @@ namespace Source {
Git::Repository::Diff::Lines lines;
void update_lines();
};
}
} // namespace Source

46
src/source_language_protocol.cc

@ -1,22 +1,21 @@
#include "source_language_protocol.h"
#include "filesystem.h"
#include "info.h"
#include "project.h"
#include "selection_dialog.h"
#include "terminal.h"
#include "project.h"
#include "filesystem.h"
#ifdef JUCI_ENABLE_DEBUG
#include "debug_lldb.h"
#endif
#include "menu.h"
#include <regex>
#include <future>
#include <limits>
#include <regex>
const bool output_messages_and_errors = false;
LanguageProtocol::Client::Client(std::string root_uri_, std::string language_id_) : root_uri(std::move(root_uri_)), language_id(std::move(language_id_)) {
process = std::make_unique<TinyProcessLib::Process>(language_id+"-language-server", root_uri,
[this](const char *bytes, size_t n) {
process = std::make_unique<TinyProcessLib::Process>(language_id + "-language-server", root_uri, [this](const char *bytes, size_t n) {
server_message_stream.write(bytes, n);
parse_server_message();
}, [](const char *bytes, size_t n) {
@ -146,7 +145,8 @@ void LanguageProtocol::Client::parse_server_message() {
try {
server_message_size = static_cast<size_t>(std::stoul(line.substr(16)));
}
catch(...) {}
catch(...) {
}
}
}
if(line.empty() && server_message_size != static_cast<size_t>(-1)) {
@ -498,7 +498,8 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() {
Offset(end_it->second.get<unsigned>("line"), end_it->second.get<unsigned>("character")),
text_it->second.get_value<std::string>()});
}
catch(...) {}
catch(...) {
}
}
}
}
@ -670,8 +671,10 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() {
auto start = get_buffer()->get_insert()->get_iter();
auto end = start;
auto previous = start;
while(previous.backward_char() && ((*previous>='A' && *previous<='Z') || (*previous>='a' && *previous<='z') || (*previous>='0' && *previous<='9') || *previous=='_') && start.backward_char()) {}
while(((*end>='A' && *end<='Z') || (*end>='a' && *end<='z') || (*end>='0' && *end<='9') || *end=='_') && end.forward_char()) {}
while(previous.backward_char() && ((*previous >= 'A' && *previous <= 'Z') || (*previous >= 'a' && *previous <= 'z') || (*previous >= '0' && *previous <= '9') || *previous == '_') && start.backward_char()) {
}
while(((*end >= 'A' && *end <= 'Z') || (*end >= 'a' && *end <= 'z') || (*end >= '0' && *end <= '9') || *end == '_') && end.forward_char()) {
}
if(start == end) {
Info::get().print("No valid symbol found at current cursor location");
@ -979,7 +982,9 @@ void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rect
}
}
if(!content->empty()) {
while(!content->empty() && content->back()=='\n') { content->pop_back(); } // Remove unnecessary newlines
while(!content->empty() && content->back() == '\n') {
content->pop_back();
} // Remove unnecessary newlines
dispatcher.post([this, offset, content, current_request] {
if(current_request != request_count)
return;
@ -998,8 +1003,10 @@ void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rect
auto start = get_buffer()->get_iter_at_offset(offset);
auto end = start;
auto previous = start;
while(previous.backward_char() && ((*previous>='A' && *previous<='Z') || (*previous>='a' && *previous<='z') || (*previous>='0' && *previous<='9') || *previous=='_') && start.backward_char()) {}
while(((*end>='A' && *end<='Z') || (*end>='a' && *end<='z') || (*end>='0' && *end<='9') || *end=='_') && end.forward_char()) {}
while(previous.backward_char() && ((*previous >= 'A' && *previous <= 'Z') || (*previous >= 'a' && *previous <= 'z') || (*previous >= '0' && *previous <= '9') || *previous == '_') && start.backward_char()) {
}
while(((*end >= 'A' && *end <= 'Z') || (*end >= 'a' && *end <= 'z') || (*end >= '0' && *end <= '9') || *end == '_') && end.forward_char()) {
}
auto offset = get_declaration(start);
Glib::ustring debug_value = Debug::LLDB::get().get_value(get_buffer()->get_text(start, end), offset.file_path, offset.line + 1, offset.index + 1);
@ -1029,8 +1036,10 @@ void Source::LanguageProtocolView::show_type_tooltips(const Gdk::Rectangle &rect
auto start = get_buffer()->get_iter_at_offset(offset);
auto end = start;
auto previous = start;
while(previous.backward_char() && ((*previous>='A' && *previous<='Z') || (*previous>='a' && *previous<='z') || (*previous>='0' && *previous<='9') || *previous=='_') && start.backward_char()) {}
while(((*end>='A' && *end<='Z') || (*end>='a' && *end<='z') || (*end>='0' && *end<='9') || *end=='_') && end.forward_char()) {}
while(previous.backward_char() && ((*previous >= 'A' && *previous <= 'Z') || (*previous >= 'a' && *previous <= 'z') || (*previous >= '0' && *previous <= '9') || *previous == '_') && start.backward_char()) {
}
while(((*end >= 'A' && *end <= 'Z') || (*end >= 'a' && *end <= 'z') || (*end >= '0' && *end <= '9') || *end == '_') && end.forward_char()) {
}
type_tooltips.emplace_back(create_tooltip_buffer, this, get_buffer()->create_mark(start), get_buffer()->create_mark(end));
type_tooltips.show();
});
@ -1067,7 +1076,8 @@ void Source::LanguageProtocolView::tag_similar_symbols() {
offsets.emplace_back(std::make_pair(Offset(start_it->second.get<unsigned>("line"), start_it->second.get<unsigned>("character")),
Offset(end_it->second.get<unsigned>("line"), end_it->second.get<unsigned>("character"))));
}
catch(...) {}
catch(...) {
}
}
}
}
@ -1178,7 +1188,8 @@ void Source::LanguageProtocolView::setup_autocomplete() {
else if(!interactive_completion) {
auto end_iter = get_buffer()->get_insert()->get_iter();
auto iter = end_iter;
while(iter.backward_char() && autocomplete.is_continue_key(*iter)) {}
while(iter.backward_char() && autocomplete.is_continue_key(*iter)) {
}
if(iter != end_iter)
iter.forward_char();
std::unique_lock<std::mutex> lock(autocomplete.prefix_mutex);
@ -1407,7 +1418,8 @@ void Source::LanguageProtocolView::add_flow_coverage_tooltips(bool called_in_thr
flow_coverage_marks.emplace_back(get_buffer()->create_mark(start), get_buffer()->create_mark(end));
}
}
catch(...) {}
catch(...) {
}
}
status_diagnostics = std::make_tuple(num_warnings + num_flow_coverage_warnings, num_errors, num_fix_its);
if(update_status_diagnostics)

4
src/source_language_protocol.h

@ -4,10 +4,10 @@
#include "source.h"
#include <boost/property_tree/json_parser.hpp>
#include <list>
#include <mutex>
#include <sstream>
#include <map>
#include <mutex>
#include <set>
#include <sstream>
namespace Source {
class LanguageProtocolView;

12
src/source_spellcheck.cc

@ -49,7 +49,8 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path,
if(!is_code_iter(iter)) {
if(last_keyval == GDK_KEY_Return || last_keyval == GDK_KEY_KP_Enter) {
auto previous_line_iter = iter;
while(previous_line_iter.backward_char() && !previous_line_iter.ends_line()) {}
while(previous_line_iter.backward_char() && !previous_line_iter.ends_line()) {
}
if(previous_line_iter.backward_char()) {
get_buffer()->remove_tag(spellcheck_error_tag, previous_line_iter, iter);
if(!is_code_iter(previous_line_iter)) {
@ -372,7 +373,8 @@ bool Source::SpellCheckView::is_code_iter(const Gtk::TextIter &iter) {
auto previous_previous_iter = previous_iter;
if(previous_previous_iter.backward_char() && *previous_previous_iter == '*') {
auto it = previous_iter;
while(!it.begins_tag(comment_tag) && it.backward_to_tag_toggle(comment_tag)) {}
while(!it.begins_tag(comment_tag) && it.backward_to_tag_toggle(comment_tag)) {
}
auto next_iter = it;
if(it.begins_tag(comment_tag) && next_iter.forward_char() && *it == '/' && *next_iter == '*' && previous_iter != it)
return true;
@ -392,7 +394,8 @@ bool Source::SpellCheckView::is_code_iter(const Gtk::TextIter &iter) {
++backslash_count;
if(backslash_count % 2 == 0) {
auto it = iter;
while(!it.begins_tag(string_tag) && it.backward_to_tag_toggle(string_tag)) {}
while(!it.begins_tag(string_tag) && it.backward_to_tag_toggle(string_tag)) {
}
if(it.begins_tag(string_tag) && *it == '\'' && iter != it)
return true;
}
@ -411,7 +414,8 @@ bool Source::SpellCheckView::is_code_iter(const Gtk::TextIter &iter) {
++backslash_count;
if(backslash_count % 2 == 0) {
auto it = previous_iter;
while(!it.begins_tag(string_tag) && it.backward_to_tag_toggle(string_tag)) {}
while(!it.begins_tag(string_tag) && it.backward_to_tag_toggle(string_tag)) {
}
if(it.begins_tag(string_tag) && *previous_iter == *it && previous_iter != it)
return true;
}

3
src/source_spellcheck.h

@ -23,6 +23,7 @@ namespace Source {
Glib::RefPtr<Gtk::TextTag> comment_tag;
Glib::RefPtr<Gtk::TextTag> string_tag;
Glib::RefPtr<Gtk::TextTag> no_spell_check_tag;
private:
Glib::RefPtr<Gtk::TextTag> spellcheck_error_tag;
@ -41,4 +42,4 @@ namespace Source {
void spellcheck(const Gtk::TextIter &start, const Gtk::TextIter &end);
};
}
} // namespace Source

13
src/terminal.cc

@ -1,9 +1,9 @@
#include "terminal.h"
#include "config.h"
#include "project.h"
#include "filesystem.h"
#include "info.h"
#include "notebook.h"
#include "filesystem.h"
#include "project.h"
#include <iostream>
#include <regex>
#include <thread>
@ -308,7 +308,8 @@ void Terminal::async_print(size_t line_nr, const std::string &message) {
}
auto end_line_iter = get_buffer()->get_iter_at_line(static_cast<int>(line_nr - deleted_lines));
while(!end_line_iter.ends_line() && end_line_iter.forward_char()) {}
while(!end_line_iter.ends_line() && end_line_iter.forward_char()) {
}
get_buffer()->insert(end_line_iter, umessage);
});
}
@ -346,7 +347,8 @@ bool Terminal::on_button_press_event(GdkEventButton* button_event) {
if(iter.has_tag(link_tag)) {
auto start_iter = get_buffer()->get_iter_at_line(iter.get_line());
auto end_iter = start_iter;
while(!end_iter.ends_line() && end_iter.forward_char()) {}
while(!end_iter.ends_line() && end_iter.forward_char()) {
}
auto link = find_link(get_buffer()->get_text(start_iter, end_iter).raw());
if(std::get<0>(link) != static_cast<size_t>(-1)) {
boost::filesystem::path path = std::get<2>(link);
@ -386,7 +388,8 @@ bool Terminal::on_button_press_event(GdkEventButton* button_event) {
view->scroll_to_cursor_delayed(view, true, true);
return true;
}
catch(...) {}
catch(...) {
}
}
}
}

11
src/terminal.h

@ -1,15 +1,16 @@
#pragma once
#include <mutex>
#include <functional>
#include "dispatcher.h"
#include "gtkmm.h"
#include "process.hpp"
#include <boost/filesystem.hpp>
#include <functional>
#include <iostream>
#include "process.hpp"
#include "dispatcher.h"
#include <mutex>
#include <tuple>
class Terminal : public Gtk::TextView {
Terminal();
public:
static Terminal &get() {
static Terminal singleton;
@ -29,10 +30,12 @@ public:
void configure();
void clear();
protected:
bool on_motion_notify_event(GdkEventMotion *motion_event) override;
bool on_button_press_event(GdkEventButton *button_event) override;
bool on_key_press_event(GdkEventKey *event) override;
private:
Dispatcher dispatcher;
Glib::RefPtr<Gtk::TextTag> bold_tag;

5
src/tooltips.h

@ -1,9 +1,9 @@
#pragma once
#include "gtkmm.h"
#include <string>
#include <list>
#include <functional>
#include <list>
#include <set>
#include <string>
class Tooltip {
public:
@ -20,6 +20,7 @@ public:
Glib::RefPtr<Gtk::TextBuffer::Mark> end_mark;
Glib::RefPtr<Gtk::TextBuffer> text_buffer;
private:
std::unique_ptr<Gtk::Window> window;
void wrap_lines();

6
src/usages_clang.cc

@ -91,8 +91,7 @@ Usages::Clang::Cache::Cache(boost::filesystem::path project_path_, boost::filesy
}
}
}
},
&visitor_data);
}, &visitor_data);
}
std::vector<std::pair<clangmm::Offset, clangmm::Offset>> Usages::Clang::Cache::get_similar_token_offsets(clangmm::Cursor::Kind kind, const std::string &spelling,
@ -321,8 +320,7 @@ void Usages::Clang::cache(const boost::filesystem::path &project_path, const boo
visitor_data->paths.emplace(path);
return CXChildVisit_Continue;
},
&visitor_data);
}, &visitor_data);
visitor_data.paths.erase(path);

30
src/window.cc

@ -1,13 +1,13 @@
#include "window.h"
#include "config.h"
#include "menu.h"
#include "notebook.h"
#include "directories.h"
#include "dialogs.h"
#include "filesystem.h"
#include "project.h"
#include "directories.h"
#include "entrybox.h"
#include "filesystem.h"
#include "info.h"
#include "menu.h"
#include "notebook.h"
#include "project.h"
#include "selection_dialog.h"
#include "terminal.h"
@ -166,10 +166,10 @@ void Window::configure() {
auto foreground_value = style && style->property_foreground_set() ? style->property_foreground().get_value() : get_style_context()->get_color().to_string();
auto background_value = style && style->property_background_set() ? style->property_background().get_value() : get_style_context()->get_background_color().to_string();
#if GTK_VERSION_GE(3, 20)
css_provider_tooltips->load_from_data(".juci_tooltip_box {background-color: "+background_value+";}"
css_provider_tooltips->load_from_data(".juci_tooltip_box {background-color: " + background_value + ";}" +
".juci_tooltip_text_view text {color: " + foreground_value + ";background-color: " + background_value + ";}");
#else
css_provider_tooltips->load_from_data(".juci_tooltip_box {background-color: "+background_value+";}"
css_provider_tooltips->load_from_data(".juci_tooltip_box {background-color: " + background_value + ";}" +
".juci_tooltip_text_view *:not(:selected) {color: " + foreground_value + ";background-color: " + background_value + ";}");
#endif
get_style_context()->add_provider_for_screen(screen, css_provider_tooltips, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
@ -373,7 +373,8 @@ void Window::set_menu_actions() {
print_compositor->set_wrap_mode(Gtk::WrapMode::WRAP_WORD_CHAR);
print_operation->signal_begin_print().connect([print_operation, print_compositor](const Glib::RefPtr<Gtk::PrintContext> &print_context) {
while(!print_compositor->paginate(print_context));
while(!print_compositor->paginate(print_context))
;
print_operation->set_n_pages(print_compositor->get_n_pages());
});
print_operation->signal_draw_page().connect([print_compositor](const Glib::RefPtr<Gtk::PrintContext> &print_context, int page_nr) {
@ -682,7 +683,6 @@ void Window::set_menu_actions() {
if(view)
view->hide_tooltips();
SelectionDialog::get()->show();
});
menu.add_action("source_comments_toggle", []() {
@ -1442,7 +1442,8 @@ void Window::search_and_replace_entry() {
else if(number > 1)
label_it->set_text(message + " results found");
}
catch(const std::exception &e) {}
catch(const std::exception &e) {
}
}
};
EntryBox::get().entries.emplace_back(last_search, [](const std::string &content) {
@ -1573,7 +1574,8 @@ void Window::set_tab_entry() {
else if(tab_char_string == "tab")
tab_char = '\t';
}
catch(const std::exception &e) {}
catch(const std::exception &e) {
}
if(tab_char != 0 && tab_size > 0) {
view->set_tab_char_and_size(tab_char, tab_size);
@ -1605,7 +1607,8 @@ void Window::goto_line_entry() {
view->place_cursor_at_line_index(stoi(content) - 1, 0);
view->scroll_to_cursor_delayed(view, true, false);
}
catch(const std::exception &e) {}
catch(const std::exception &e) {
}
EntryBox::get().hide();
}
});
@ -1712,7 +1715,8 @@ void Window::save_session() {
boost::property_tree::write_json((Config::get().home_juci_path / "last_session.json").string(), root_pt);
}
catch(...) {}
catch(...) {
}
}
void Window::load_session(std::vector<boost::filesystem::path> &directories, std::vector<std::pair<boost::filesystem::path, size_t>> &files, std::vector<std::pair<int, int>> &file_offsets, std::string &current_file, bool read_directories_and_files) {

3
src/window.h

@ -1,10 +1,11 @@
#pragma once
#include <gtkmm.h>
#include <atomic>
#include <boost/filesystem.hpp>
#include <gtkmm.h>
class Window : public Gtk::ApplicationWindow {
Window();
public:
static Window &get() {
static Window singleton;

6
tests/cmake_build_test.cc

@ -1,9 +1,9 @@
#include <glib.h>
#include "cmake.h"
#include "project_build.h"
#include "config.h"
#include <boost/filesystem.hpp>
#include "process.hpp"
#include "project_build.h"
#include <boost/filesystem.hpp>
#include <glib.h>
#include <iostream>
using namespace std;

6
tests/git_test.cc

@ -1,7 +1,7 @@
#include <glib.h>
#include <gtkmm.h>
#include "git.h"
#include <boost/filesystem.hpp>
#include <glib.h>
#include <gtkmm.h>
int main() {
auto app = Gtk::Application::create();
@ -19,7 +19,7 @@ int main() {
auto status = repository->get_status();
auto diff = repository->get_diff((boost::filesystem::path("tests") / "git_test.cc"));
auto lines=diff.get_lines("#include added\n#include <glib.h>\n#include modified\n#include \"git.h\"\n");
auto lines = diff.get_lines("#include added\n#include \"git.h\"\n#include modified\n#include <glib.h>\n");
g_assert_cmpuint(lines.added.size(), ==, 1);
g_assert_cmpuint(lines.modified.size(), ==, 1);
g_assert_cmpuint(lines.removed.size(), ==, 1);

6
tests/lldb_test.cc

@ -1,8 +1,8 @@
#include <glib.h>
#include "debug_lldb.h"
#include <thread>
#include <boost/filesystem.hpp>
#include <atomic>
#include <boost/filesystem.hpp>
#include <glib.h>
#include <thread>
int main() {
auto build_path = boost::filesystem::canonical(JUCI_BUILD_PATH);

2
tests/meson_build_test.cc

@ -1,6 +1,6 @@
#include "meson.h"
#include <glib.h>
#include "project.h"
#include <glib.h>
int main() {
auto tests_path = boost::filesystem::canonical(JUCI_TESTS_PATH);

2
tests/process_test.cc

@ -1,5 +1,5 @@
#include <glib.h>
#include "process.hpp"
#include <glib.h>
int main() {
auto output = std::make_shared<std::string>();

6
tests/source_clang_test.cc

@ -1,7 +1,7 @@
#include <glib.h>
#include "source_clang.h"
#include "config.h"
#include "filesystem.h"
#include "source_clang.h"
#include <glib.h>
std::string main_error = R"(int main() {
int number=2;
@ -134,8 +134,8 @@ int main() {
// Test Implement method
{
clang_view->get_buffer()->set_text(R"(#include <string>
#include <vector>
#include <map>
#include <vector>
namespace N {
class T {

4
tests/source_test.cc

@ -1,6 +1,6 @@
#include <glib.h>
#include "source.h"
#include "filesystem.h"
#include "source.h"
#include <glib.h>
std::string hello_world = R"(#include <iostream>

12
tests/stubs/selection_dialog.cc

@ -2,8 +2,8 @@
SelectionDialogBase::ListViewText::ListViewText(bool use_markup) {}
SelectionDialogBase::SelectionDialogBase(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup):
text_view(text_view), list_view_text(use_markup) {}
SelectionDialogBase::SelectionDialogBase(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup)
: text_view(text_view), list_view_text(use_markup) {}
void SelectionDialogBase::show() {}
@ -13,8 +13,8 @@ void SelectionDialogBase::add_row(const std::string& row) {}
std::unique_ptr<SelectionDialog> SelectionDialog::instance;
SelectionDialog::SelectionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup) :
SelectionDialogBase(text_view, start_mark, show_search_entry, use_markup) {}
SelectionDialog::SelectionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark, bool show_search_entry, bool use_markup)
: SelectionDialogBase(text_view, start_mark, show_search_entry, use_markup) {}
SelectionDialogBase::~SelectionDialogBase() {}
@ -22,8 +22,8 @@ bool SelectionDialog::on_key_press(GdkEventKey* key) { return true; }
std::unique_ptr<CompletionDialog> CompletionDialog::instance;
CompletionDialog::CompletionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark):
SelectionDialogBase(text_view, start_mark, false, false) {}
CompletionDialog::CompletionDialog(Gtk::TextView *text_view, const Glib::RefPtr<Gtk::TextBuffer::Mark> &start_mark)
: SelectionDialogBase(text_view, start_mark, false, false) {}
bool CompletionDialog::on_key_press(GdkEventKey *key) { return true; }

2
tests/usages_clang_test_files/main.cpp

@ -1,5 +1,5 @@
#include <iostream>
#include "test.hpp"
#include <iostream>
int main() {
Test test;

Loading…
Cancel
Save