1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:07:45 +00:00

Everywhere: Hook up remaining debug macros to Debug.h.

This commit is contained in:
asynts 2021-01-24 15:28:26 +01:00 committed by Andreas Kling
parent da69de1f1b
commit eea72b9b5c
63 changed files with 458 additions and 287 deletions

View file

@ -30,6 +30,7 @@
#include "HackStudio.h"
#include "Language.h"
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/LexicalPath.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
@ -153,7 +154,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
{
auto it = man_paths().find(hovered_token);
if (it == man_paths().end()) {
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("no man path for {}", hovered_token);
#endif
m_documentation_tooltip_window->hide();
@ -164,7 +165,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
return;
}
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("opening {}", it->value);
#endif
auto file = Core::File::construct(it->value);
@ -235,7 +236,7 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
auto end_line_length = document().line(span.range.end().line()).length();
adjusted_range.end().set_column(min(end_line_length, adjusted_range.end().column() + 1));
auto hovered_span_text = document().text_in_range(adjusted_range);
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("Hovering: {} \"{}\"", adjusted_range, hovered_span_text);
#endif
@ -301,7 +302,7 @@ void Editor::mousedown_event(GUI::MouseEvent& event)
adjusted_range.end().set_column(adjusted_range.end().column() + 1);
auto span_text = document().text_in_range(adjusted_range);
auto header_path = span_text.substring(1, span_text.length() - 2);
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("Ctrl+click: {} \"{}\"", adjusted_range, header_path);
#endif
navigate_to_include_if_available(header_path);
@ -333,7 +334,7 @@ static HashMap<String, String>& include_paths()
auto path = it.next_full_path();
if (!Core::File::is_directory(path)) {
auto key = path.substring(base.length() + 1, path.length() - base.length() - 1);
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("Adding header \"{}\" in path \"{}\"", key, path);
#endif
paths.set(key, path);
@ -357,7 +358,7 @@ void Editor::navigate_to_include_if_available(String path)
{
auto it = include_paths().find(path);
if (it == include_paths().end()) {
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("no header {} found.", path);
#endif
return;

View file

@ -25,6 +25,7 @@
*/
#include "DiffViewer.h"
#include <AK/Debug.h>
#include <LibDiff/Hunks.h>
#include <LibGUI/AbstractView.h>
#include <LibGUI/Painter.h>
@ -159,7 +160,7 @@ void DiffViewer::set_content(const String& original, const String& diff)
m_original_lines = split_to_lines(original);
m_hunks = Diff::parse_hunks(diff);
#ifdef DEBUG_DIFF
#if DIFF_DEBUG
for (size_t i = 0; i < m_original_lines.size(); ++i)
dbgln("{}:{}", i, m_original_lines[i]);
#endif

View file

@ -25,6 +25,7 @@
*/
#include "AutoComplete.h"
#include <AK/Debug.h>
#include <AK/HashTable.h>
#include <LibCpp/Lexer.h>
@ -42,7 +43,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
auto suggestions = identifier_prefixes(lines, tokens, index_of_target_token.value());
#ifdef DEBUG_AUTOCOMPLETE
#if AUTOCOMPLETE_DEBUG
for (auto& suggestion : suggestions) {
dbgln("suggestion: {}", suggestion.completion);
}

View file

@ -92,7 +92,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)
{
#ifdef DEBUG_CPP_LANGUAGE_SERVER
#if CPP_LANGUAGE_SERVER_DEBUG
dbgln("InsertText for file: {}", message.file_name());
dbgln("Text: {}", message.text());
dbgln("[{}:{}]", message.start_line(), message.start_column());
@ -111,7 +111,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText& message)
{
#ifdef DEBUG_CPP_LANGUAGE_SERVER
#if CPP_LANGUAGE_SERVER_DEBUG
dbgln("RemoveText for file: {}", message.file_name());
dbgln("[{}:{} - {}:{}]", message.start_line(), message.start_column(), message.end_line(), message.end_column());
#endif
@ -136,7 +136,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message)
{
#ifdef DEBUG_CPP_LANGUAGE_SERVER
#if CPP_LANGUAGE_SERVER_DEBUG
dbgln("AutoCompleteSuggestions for: {} {}:{}", message.file_name(), message.cursor_line(), message.cursor_column());
#endif

View file

@ -40,7 +40,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
if (!ast)
return {};
#ifdef DEBUG_AUTOCOMPLETE
#if AUTOCOMPLETE_DEBUG
dbgln("Complete '{}'", code);
ast->dump(1);
dbgln("At offset {}", offset);
@ -49,7 +49,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
auto result = ast->complete_for_editor(m_shell, offset);
Vector<GUI::AutocompleteProvider::Entry> completions;
for (auto& entry : result) {
#ifdef DEBUG_AUTOCOMPLETE
#if AUTOCOMPLETE_DEBUG
dbgln("Suggestion: '{}' starting at {}", entry.text_string, entry.input_offset);
#endif
completions.append({ entry.text_string, entry.input_offset });

View file

@ -92,7 +92,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)
{
#ifdef DEBUG_SH_LANGUAGE_SERVER
#if SH_LANGUAGE_SERVER_DEBUG
dbgln("InsertText for file: {}", message.file_name());
dbgln("Text: {}", message.text());
dbgln("[{}:{}]", message.start_line(), message.start_column());
@ -111,7 +111,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText& message)
{
#ifdef DEBUG_SH_LANGUAGE_SERVER
#if SH_LANGUAGE_SERVER_DEBUG
dbgln("RemoveText for file: {}", message.file_name());
dbgln("[{}:{} - {}:{}]", message.start_line(), message.start_column(), message.end_line(), message.end_column());
#endif
@ -134,7 +134,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message)
{
#ifdef DEBUG_SH_LANGUAGE_SERVER
#if SH_LANGUAGE_SERVER_DEBUG
dbgln("AutoCompleteSuggestions for: {} {}:{}", message.file_name(), message.cursor_line(), message.cursor_column());
#endif