class LsifParser::Highlight::HTMLGitlab

HTML formatter for a hover

Public Class Methods

new(tag: nil) click to toggle source
# File lib/lsif_parser/highlight.rb, line 12
def initialize(tag: nil)
  @line_number = 1
  @tag = tag
end

Public Instance Methods

stream(tokens) { |"\n"| ... } click to toggle source
# File lib/lsif_parser/highlight.rb, line 17
def stream(tokens)
  is_first = true
  token_lines(tokens) do |line|
    yield "\n" unless is_first
    is_first = false

    yield %(<span id="LC#{@line_number}" class="line" lang="#{@tag}">)
    line.each { |token, value| yield span(token, value.chomp) }
    yield %(</span>)

    @line_number += 1
  end
end