summaryrefslogtreecommitdiff
path: root/src/highlighter.cc
blob: 3e253343713b88f64c3671e2af45a33d4b3796f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "highlighter.hh"

#include "debug.hh"
#include "flags.hh"

namespace Kakoune
{

void Highlighter::highlight(HighlightContext context, DisplayBuffer& display_buffer, BufferRange range)
{
    if (context.pass & m_passes) try
    {
        do_highlight(context, display_buffer, range);
    }
    catch (runtime_error& error)
    {
        write_to_debug_buffer(format("Error while highlighting: {}", error.what()));
    }
}

void Highlighter::compute_display_setup(HighlightContext context, DisplaySetup& setup) const
{
    if (context.pass & m_passes)
        do_compute_display_setup(context, setup);
}


bool Highlighter::has_children() const
{
    return false;
}

Highlighter& Highlighter::get_child(StringView path)
{
    throw runtime_error("this highlighter does not hold children");
}

void Highlighter::add_child(String, UniquePtr<Highlighter>&&, bool)
{
    throw runtime_error("this highlighter does not hold children");
}

void Highlighter::remove_child(StringView id)
{
    throw runtime_error("this highlighter does not hold children");
}

Completions Highlighter::complete_child(StringView path, ByteCount cursor_pos, bool group) const
{
    throw runtime_error("this highlighter does not hold children");
}

void Highlighter::fill_unique_ids(Vector<StringView>& unique_ids) const
{}

}