Skip to content

Commit

Permalink
move function
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Feb 6, 2024
1 parent b907ecd commit 962572c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,6 @@ defmodule ElixirLS.LanguageServer.Providers.SelectionRanges do
end)
end

# this function differs from the one in SourceFile - it returns utf8 ranges
defp full_range(lines) do
utf8_size =
lines
|> List.last()
|> String.length()

range(0, 0, Enum.count(lines) - 1, utf8_size)
end

def token_pair_ranges(lines, token_pairs, stop_tokens, line, character) do
token_pairs
|> Enum.filter(fn {{_, {start_line, start_character, _}, _},
Expand Down
11 changes: 9 additions & 2 deletions apps/language_server/lib/language_server/range_utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ defmodule ElixirLS.LanguageServer.RangeUtils do

import ElixirLS.LanguageServer.Protocol

@type range_t :: map
# this function differs from the one in SourceFile - it returns utf8 ranges
def full_range(lines) do
utf8_size =
lines
|> List.last()
|> String.length()

range(0, 0, Enum.count(lines) - 1, utf8_size)
end

def valid?(range(start_line, start_character, end_line, end_character))
when is_integer(start_line) and is_integer(end_line) and is_integer(start_character) and
Expand All @@ -23,7 +31,6 @@ defmodule ElixirLS.LanguageServer.RangeUtils do
increasingly_narrowing?([right | rest])
end

@spec left_in_right?(range_t, range_t) :: boolean
def left_in_right?(
range(start_line_1, start_character_1, end_line_1, end_character_1),
range(start_line_2, start_character_2, end_line_2, end_character_2)
Expand Down

0 comments on commit 962572c

Please sign in to comment.