Skip to content

Commit 7afdbe6

Browse files
committed
Trigger info loop in new thread after 10 second delay
1 parent a7373cc commit 7afdbe6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/ruby_lsp/document.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ def initialize(source, encoding)
142142
# Finds the character index inside the source string for a given line and column
143143
sig { params(position: T::Hash[Symbol, T.untyped]).returns(Integer) }
144144
def find_char_position(position)
145+
info_t = Thread.new do
146+
sleep 10
147+
148+
puts "Looking for char position for over 10 seconds. Starting debug loop."
149+
150+
loop do
151+
puts "POS: #{@pos} Encoding: #{@encoding} CurrentLine: #{@current_line}")
152+
sleep 0.5
153+
end
154+
end
155+
145156
# Find the character index for the beginning of the requested line
146157
until @current_line == position[:line]
147158
@pos += 1 until LINE_BREAK == @source[@pos]
@@ -157,6 +168,9 @@ def find_char_position(position)
157168
requested_position -= utf_16_character_position_correction(@pos, requested_position)
158169
end
159170

171+
info_t.kill
172+
info_t.join
173+
160174
requested_position
161175
end
162176

0 commit comments

Comments
 (0)