Skip to content

Commit

Permalink
Add code_units_cache helper
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Oct 10, 2024
1 parent 7b95a3f commit 86925ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ruby_lsp/erb_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ def inside_host_language?(char_position)
char && char != " "
end

sig do
returns(T.any(
T.proc.params(arg0: Integer).returns(Integer),
Prism::CodeUnitsCache,
))
end
def code_units_cache
@parse_result.code_units_cache(@encoding)
end

class ERBScanner
extend T::Sig

Expand Down
10 changes: 10 additions & 0 deletions lib/ruby_lsp/ruby_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,15 @@ def locate_node(position, node_types: [])
encoding: @encoding,
)
end

sig do
returns(T.any(
T.proc.params(arg0: Integer).returns(Integer),
Prism::CodeUnitsCache,
))
end
def code_units_cache
@parse_result.code_units_cache(@encoding)
end
end
end

0 comments on commit 86925ea

Please sign in to comment.