@@ -286,7 +286,7 @@ defmodule ElixirLS.LanguageServer.Build do
286
286
# position is a 1 based line number
287
287
# we return a range of trimmed text in that line
288
288
defp range ( position , source_file )
289
- when is_integer ( position ) and position >= 1 and is_binary ( source_file ) do
289
+ when is_integer ( position ) and position >= 1 and not is_nil ( source_file ) do
290
290
# line is 1 based
291
291
line = position - 1
292
292
text = Enum . at ( SourceFile . lines ( source_file ) , line ) || ""
@@ -309,7 +309,7 @@ defmodule ElixirLS.LanguageServer.Build do
309
309
# position is a 1 based line number and 0 based character cursor (UTF8)
310
310
# we return a 0 length range exactly at that location
311
311
defp range ( { line_start , char_start } , source_file )
312
- when line_start >= 1 and is_binary ( source_file ) do
312
+ when line_start >= 1 and not is_nil ( source_file ) do
313
313
lines = SourceFile . lines ( source_file )
314
314
# line is 1 based
315
315
start_line = Enum . at ( lines , line_start - 1 )
@@ -331,7 +331,7 @@ defmodule ElixirLS.LanguageServer.Build do
331
331
# position is a range defined by 1 based line numbers and 0 based character cursors (UTF8)
332
332
# we return exactly that range
333
333
defp range ( { line_start , char_start , line_end , char_end } , source_file )
334
- when line_start >= 1 and line_end >= 1 and is_binary ( source_file ) do
334
+ when line_start >= 1 and line_end >= 1 and not is_nil ( source_file ) do
335
335
lines = SourceFile . lines ( source_file )
336
336
# line is 1 based
337
337
start_line = Enum . at ( lines , line_start - 1 )
@@ -355,7 +355,7 @@ defmodule ElixirLS.LanguageServer.Build do
355
355
356
356
# position is 0 which means unknown
357
357
# we return the full file range
358
- defp range ( 0 , source_file ) when is_binary ( source_file ) do
358
+ defp range ( 0 , source_file ) when not is_nil ( source_file ) do
359
359
SourceFile . full_range ( source_file )
360
360
end
361
361
0 commit comments