Sha256: 405a5cf3a2badeb7405b01d1173ddb4404c02efc4d5e7ecdb0bd740ec3e3668e
Contents?: true
Size: 1.56 KB
Versions: 9
Compression:
Stored size: 1.56 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true # This executable checks if all automatic LSP requests run successfully on every Ruby file under the current directory require "sorbet-runtime" begin T::Configuration.default_checked_level = :never T::Configuration.call_validation_error_handler = ->(*) {} T::Configuration.inline_type_error_handler = ->(*) {} T::Configuration.sig_validation_error_handler = ->(*) {} rescue nil end require_relative "../lib/ruby_lsp/internal" RubyLsp::Extension.load_extensions T::Utils.run_all_sig_blocks files = Dir.glob("#{Dir.pwd}/**/*.rb") puts "Verifying that all automatic LSP requests execute successfully. This may take a while..." errors = {} store = RubyLsp::Store.new message_queue = Thread::Queue.new executor = RubyLsp::Executor.new(store, message_queue) files.each_with_index do |file, index| uri = URI("file://#{file}") store.set(uri: uri, source: File.read(file), version: 1) # Executing any of the automatic requests will execute all of them, so here we just pick one result = executor.execute({ method: "textDocument/documentSymbol", params: { textDocument: { uri: uri.to_s } }, }) error = result.error errors[file] = error if error ensure store.delete(uri) print("\033[M\033[0KCompleted #{index + 1}/#{files.length}") unless ENV["CI"] end puts "\n" message_queue.close if errors.empty? puts "All automatic LSP requests executed successfully" exit end puts <<~ERRORS Errors while executing requests: #{errors.map { |file, error| "#{file}: #{error.message}" }.join("\n")} ERRORS exit!
Version data entries
9 entries across 9 versions & 1 rubygems