theme-check 1.7.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +49 -0
- data/README.md +10 -0
- data/RELEASING.md +13 -0
- data/config/default.yml +5 -0
- data/data/shopify_liquid/deprecated_filters.yml +4 -0
- data/data/shopify_liquid/filters.yml +3 -1
- data/data/shopify_liquid/tags.yml +9 -9
- data/docs/checks/TEMPLATE.md.erb +24 -19
- data/docs/checks/schema_json_format.md +76 -0
- data/docs/language_server/code-action-command-palette.png +0 -0
- data/docs/language_server/code-action-flow.png +0 -0
- data/docs/language_server/code-action-keyboard.png +0 -0
- data/docs/language_server/code-action-light-bulb.png +0 -0
- data/docs/language_server/code-action-problem.png +0 -0
- data/docs/language_server/code-action-quickfix.png +0 -0
- data/docs/language_server/how_to_correct_code_with_code_actions_and_execute_command.md +197 -0
- data/exe/theme-check-language-server +0 -4
- data/lib/theme_check/checks/asset_size_app_block_css.rb +2 -3
- data/lib/theme_check/checks/asset_size_app_block_javascript.rb +2 -3
- data/lib/theme_check/checks/asset_url_filters.rb +2 -0
- data/lib/theme_check/checks/default_locale.rb +1 -1
- data/lib/theme_check/checks/deprecated_filter.rb +79 -4
- data/lib/theme_check/checks/deprecated_global_app_block_type.rb +2 -3
- data/lib/theme_check/checks/matching_schema_translations.rb +14 -9
- data/lib/theme_check/checks/matching_translations.rb +1 -0
- data/lib/theme_check/checks/missing_required_template_files.rb +3 -3
- data/lib/theme_check/checks/missing_template.rb +1 -1
- data/lib/theme_check/checks/pagination_size.rb +2 -3
- data/lib/theme_check/checks/remote_asset.rb +5 -0
- data/lib/theme_check/checks/required_directories.rb +1 -1
- data/lib/theme_check/checks/required_layout_theme_object.rb +9 -4
- data/lib/theme_check/checks/schema_json_format.rb +29 -0
- data/lib/theme_check/checks/space_inside_braces.rb +132 -87
- data/lib/theme_check/checks/translation_key_exists.rb +33 -25
- data/lib/theme_check/checks/unused_assign.rb +3 -2
- data/lib/theme_check/checks/unused_snippet.rb +1 -1
- data/lib/theme_check/checks/valid_html_translation.rb +1 -1
- data/lib/theme_check/checks/valid_schema.rb +2 -2
- data/lib/theme_check/corrector.rb +34 -23
- data/lib/theme_check/exceptions.rb +1 -0
- data/lib/theme_check/file_system_storage.rb +8 -3
- data/lib/theme_check/html_node.rb +99 -6
- data/lib/theme_check/html_visitor.rb +1 -32
- data/lib/theme_check/in_memory_storage.rb +9 -0
- data/lib/theme_check/json_helpers.rb +14 -0
- data/lib/theme_check/language_server/bridge.rb +142 -0
- data/lib/theme_check/language_server/channel.rb +69 -0
- data/lib/theme_check/language_server/client_capabilities.rb +27 -0
- data/lib/theme_check/language_server/code_action_engine.rb +32 -0
- data/lib/theme_check/language_server/code_action_provider.rb +42 -0
- data/lib/theme_check/language_server/code_action_providers/quickfix_code_action_provider.rb +83 -0
- data/lib/theme_check/language_server/code_action_providers/source_fix_all_code_action_provider.rb +40 -0
- data/lib/theme_check/language_server/completion_providers/tag_completion_provider.rb +3 -1
- data/lib/theme_check/language_server/configuration.rb +69 -0
- data/lib/theme_check/language_server/diagnostic.rb +124 -0
- data/lib/theme_check/language_server/diagnostics_engine.rb +80 -0
- data/lib/theme_check/language_server/diagnostics_manager.rb +136 -0
- data/lib/theme_check/language_server/document_change_corrector.rb +267 -0
- data/lib/theme_check/language_server/document_link_provider.rb +6 -6
- data/lib/theme_check/language_server/execute_command_engine.rb +19 -0
- data/lib/theme_check/language_server/execute_command_provider.rb +30 -0
- data/lib/theme_check/language_server/execute_command_providers/correction_execute_command_provider.rb +48 -0
- data/lib/theme_check/language_server/execute_command_providers/run_checks_execute_command_provider.rb +22 -0
- data/lib/theme_check/language_server/handler.rb +92 -217
- data/lib/theme_check/language_server/io_messenger.rb +112 -0
- data/lib/theme_check/language_server/messenger.rb +12 -42
- data/lib/theme_check/language_server/protocol.rb +4 -0
- data/lib/theme_check/language_server/server.rb +54 -110
- data/lib/theme_check/language_server/uri_helper.rb +1 -0
- data/lib/theme_check/language_server/versioned_in_memory_storage.rb +69 -0
- data/lib/theme_check/language_server.rb +28 -6
- data/lib/theme_check/liquid_node.rb +255 -12
- data/lib/theme_check/locale_diff.rb +48 -10
- data/lib/theme_check/node.rb +16 -0
- data/lib/theme_check/offense.rb +27 -23
- data/lib/theme_check/position.rb +4 -4
- data/lib/theme_check/regex_helpers.rb +1 -1
- data/lib/theme_check/schema_helper.rb +70 -0
- data/lib/theme_check/shopify_liquid/system_translations.rb +35 -0
- data/lib/theme_check/shopify_liquid/tag.rb +19 -1
- data/lib/theme_check/shopify_liquid.rb +1 -0
- data/lib/theme_check/storage.rb +4 -0
- data/lib/theme_check/tags.rb +0 -1
- data/lib/theme_check/theme.rb +1 -1
- data/lib/theme_check/theme_file.rb +8 -1
- data/lib/theme_check/theme_file_rewriter.rb +28 -6
- data/lib/theme_check/version.rb +1 -1
- data/lib/theme_check.rb +11 -2
- metadata +31 -3
- data/lib/theme_check/language_server/diagnostics_tracker.rb +0 -66
@@ -1,66 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "logger"
|
3
|
-
|
4
|
-
module ThemeCheck
|
5
|
-
module LanguageServer
|
6
|
-
class DiagnosticsTracker
|
7
|
-
def initialize
|
8
|
-
@previously_reported_files = Set.new
|
9
|
-
@single_files_offenses = {}
|
10
|
-
@first_run = true
|
11
|
-
end
|
12
|
-
|
13
|
-
def first_run?
|
14
|
-
@first_run
|
15
|
-
end
|
16
|
-
|
17
|
-
def build_diagnostics(offenses, analyzed_files: nil)
|
18
|
-
reported_files = Set.new
|
19
|
-
new_single_file_offenses = {}
|
20
|
-
analyzed_files = analyzed_files.map { |path| Pathname.new(path) } if analyzed_files
|
21
|
-
|
22
|
-
offenses.group_by(&:theme_file).each do |theme_file, template_offenses|
|
23
|
-
next unless theme_file
|
24
|
-
reported_offenses = template_offenses
|
25
|
-
previous_offenses = @single_files_offenses[theme_file.path]
|
26
|
-
if analyzed_files.nil? || analyzed_files.include?(theme_file.path)
|
27
|
-
# We re-analyzed the file, so we know the template_offenses are update to date.
|
28
|
-
reported_single_file_offenses = reported_offenses.select(&:single_file?)
|
29
|
-
if reported_single_file_offenses.any?
|
30
|
-
new_single_file_offenses[theme_file.path] = reported_single_file_offenses
|
31
|
-
end
|
32
|
-
elsif previous_offenses
|
33
|
-
# Merge in the previous ones, if some
|
34
|
-
reported_offenses |= previous_offenses
|
35
|
-
end
|
36
|
-
yield theme_file.path, reported_offenses
|
37
|
-
reported_files << theme_file.path
|
38
|
-
end
|
39
|
-
|
40
|
-
@single_files_offenses.each do |path, _|
|
41
|
-
# Already reported above, skip
|
42
|
-
next if reported_files.include?(path)
|
43
|
-
|
44
|
-
if analyzed_files.nil? || analyzed_files.include?(path)
|
45
|
-
# We re-analyzed this file, if it was not reported, all offenses in it got fixed
|
46
|
-
yield path, []
|
47
|
-
new_single_file_offenses[path] = nil
|
48
|
-
end
|
49
|
-
# NOTE: No need to re-report previous offenses as LSP should keep them around until
|
50
|
-
# we clear them.
|
51
|
-
reported_files << path
|
52
|
-
end
|
53
|
-
|
54
|
-
# Publish diagnostics with empty array if all issues on a previously reported theme_file
|
55
|
-
# have been fixed.
|
56
|
-
(@previously_reported_files - reported_files).each do |path|
|
57
|
-
yield path, []
|
58
|
-
end
|
59
|
-
|
60
|
-
@previously_reported_files = reported_files
|
61
|
-
@single_files_offenses.merge!(new_single_file_offenses)
|
62
|
-
@first_run = false
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|