Sha256: e85b02db47fff1203d8bdfc8ecf7e87fc605cf13e9ee02aacdbac2804a34320b
Contents?: true
Size: 1.17 KB
Versions: 25
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module PlatformosCheck module LanguageServer class SourceFixAllCodeActionProvider < CodeActionProvider kind "source.fixAll" def code_actions(relative_path, _) diagnostics = diagnostics_manager .diagnostics(relative_path) .filter(&:correctable?) .reject do |diagnostic| # We cannot quickfix if the buffer was modified. This means # our diagnostics and InMemoryStorage are out of sync. diagnostic.file_version != storage.version(diagnostic.relative_path) end .map(&:to_h) diagnostics_to_code_action(diagnostics) end private def diagnostics_to_code_action(diagnostics) return [] if diagnostics.empty? [ { title: "Fix all PlatformOS Check auto-fixable problems", kind:, diagnostics:, command: { title: 'fixAll.file', command: LanguageServer::CorrectionExecuteCommandProvider.command, arguments: diagnostics } } ] end end end end
Version data entries
25 entries across 25 versions & 1 rubygems