Skip to content

Commit

Permalink
Move encoder into the Requests::Support namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
wildmaples committed May 13, 2022
1 parent 48101ad commit e9009b3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 53 deletions.
50 changes: 0 additions & 50 deletions lib/ruby_lsp/encoder/relative.rb

This file was deleted.

3 changes: 1 addition & 2 deletions lib/ruby_lsp/handler.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "ruby_lsp/encoder/relative"
require "ruby_lsp/requests"
require "ruby_lsp/store"
require "benchmark"
Expand Down Expand Up @@ -126,7 +125,7 @@ def respond_with_selection_ranges(uri, positions)

def respond_with_semantic_highlighting(uri)
store.cache_fetch(uri, :semantic_highlighting) do |document|
Requests::SemanticHighlighting.new(document, encoder: Encoder::Relative).run
Requests::SemanticHighlighting.new(document, encoder: Requests::Support::SemanticTokenEncoder).run
end
end

Expand Down
1 change: 1 addition & 0 deletions lib/ruby_lsp/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Requests
module Support
autoload :RuboCopDiagnostic, "ruby_lsp/requests/support/rubocop_diagnostic"
autoload :SelectionRange, "ruby_lsp/requests/support/selection_range"
autoload :SemanticTokenEncoder, "ruby_lsp/requests/support/semantic_token_encoder"
autoload :SyntaxErrorDiagnostic, "ruby_lsp/requests/support/syntax_error_diagnostic"
end
end
Expand Down
3 changes: 2 additions & 1 deletion test/requests/semantic_highlighting_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ def some_method

def assert_tokens(expected, source_code)
document = RubyLsp::Document.new(source_code)
tokens = RubyLsp::Requests::SemanticHighlighting.new(document, encoder: RubyLsp::Encoder::Relative).run
tokens = RubyLsp::Requests::SemanticHighlighting.new(document,
encoder: RubyLsp::Requests::Support::SemanticTokenEncoder).run

assert_equal(
inline_tokens(expected),
Expand Down

0 comments on commit e9009b3

Please sign in to comment.