platformos-check 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b560f1b22edc85eadceb664db3c5cf1d0e844c33f54bf8bf8c15b288ac78648c
4
- data.tar.gz: 49b94ae62cfa63cbc5308ac6ad20226ca95fa475378233d19ec2c67da501688c
3
+ metadata.gz: ea3b2795b757ae4f571abc2a432ff97c129e4eba0dacb20ffb3a4cba0badd702
4
+ data.tar.gz: 6eb2287f066a7d4a2c4fe93ac008071672282d29b80741986a982146c8d30311
5
5
  SHA512:
6
- metadata.gz: 267f9d075571e75979a8026a3c309ebb1aa0888d2f8ea1d6e4df8476358e28b0ff9e16272267fdae93f2c9f48d1aa47aaaa4aecf41c2b288804314de509534e8
7
- data.tar.gz: 748a49ba89dfbf6444ef427f22c1e26c53bd9caac526743297a2a4063c1ebe20f6766c3fdbf8290fb70534699719b858dd85e631b3637c3fb3155382049845e7
6
+ metadata.gz: 435e5da569ae2d99973b4f26b5383acb304ba16482a4ca7a09b7d7affa7ea01573bebfa9856a2ce6809a300fccaf8f41e7cf95e8844c3c6309098a2ca450a82d
7
+ data.tar.gz: 118099b25e2557574c1ab51c4ad674e8c94607d35d8ce1bf543b2de581ad0c9ca54f4a1d3e6cee569c9eb0c6d4585744df86f905e31a36054f3e2853e379cb10
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ v0.3.0 / 2023-09-15
2
+ ==================
3
+
4
+ * Support for theme_render_rc tag
5
+
6
+ v0.2.2 / 2023-09-15
7
+ ==================
8
+
9
+ * Do not crash when directory is copied to partials path
10
+
1
11
  v0.2.1 / 2023-09-14
2
12
  ==================
3
13
 
@@ -12,15 +12,15 @@ module PlatformosCheck
12
12
  GRAPHQL_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(graph_queries|graphql)s?/(.+)\.graphql\z}
13
13
 
14
14
  MIGRATIONS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)migrations/(.+)\.liquid\z}
15
- PAGES_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(pages|views/pages)/(.+)}
16
- PARTIALS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(views/partials|lib)/(.+)}
15
+ PAGES_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(pages|views/pages)/(.+).liquid\z}
16
+ PARTIALS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(views/partials|lib)/(.+)\.liquid\z}
17
17
  FORMS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(form_configurations|forms)/(.+)\.liquid\z}
18
- LAYOUTS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(views/layouts)/(.+)}
18
+ LAYOUTS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(views/layouts)/(.+).liquid\z}
19
19
  SCHEMA_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(custom_model_types|model_schemas|schema)/(.+)\.yml\z}
20
20
  SMSES_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(notifications/sms_notifications|smses)/(.+)\.liquid\z}
21
21
  USER_SCHEMA_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/)?)user.yml}
22
- TRANSLATIONS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)translations.+.yml}
23
- CONFIG_REGEX = %r{(?-mix:^\\/?((marketplace_builder|app)\\/)?)config.yml}
22
+ TRANSLATIONS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)translations/(.+)\.yml}
23
+ CONFIG_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/)?)config.yml}
24
24
 
25
25
  REGEXP_MAP = {
26
26
  API_CALLS_REGEX => ApiCallFile,
@@ -123,6 +123,10 @@ module PlatformosCheck
123
123
  grouped_files[PageFile]&.values || []
124
124
  end
125
125
 
126
+ def app_config
127
+ grouped_files[ConfigFile]&.values&.first
128
+ end
129
+
126
130
  def all
127
131
  grouped_files.values.map(&:values).flatten
128
132
  end
@@ -17,7 +17,7 @@ module PlatformosCheck
17
17
  CHECK_ON_OPEN => null_coalesce(@capabilities.initialization_option(CHECK_ON_OPEN), true),
18
18
  CHECK_ON_SAVE => null_coalesce(@capabilities.initialization_option(CHECK_ON_SAVE), true),
19
19
  CHECK_ON_CHANGE => null_coalesce(@capabilities.initialization_option(CHECK_ON_CHANGE), true),
20
- ONLY_SINGLE_FILE => null_coalesce(@capabilities.initialization_option(ONLY_SINGLE_FILE), false)
20
+ ONLY_SINGLE_FILE => null_coalesce(@capabilities.initialization_option(ONLY_SINGLE_FILE), true)
21
21
  }
22
22
  end
23
23
 
@@ -2,14 +2,14 @@
2
2
 
3
3
  module PlatformosCheck
4
4
  module LanguageServer
5
- def self.partial_tag(tag)
5
+ def self.partial_tag(tag, with_rc: false)
6
6
  /
7
- \{%-?\s*#{tag}\s+'(?<partial>[^']*)'|
8
- \{%-?\s*#{tag}\s+"(?<partial>[^"]*)"|
7
+ \{%-?\s*#{tag}#{'(_rc)?' if with_rc}\s+'(?<partial>[^']*)'|
8
+ \{%-?\s*#{tag}#{'(_rc)?' if with_rc}\s+"(?<partial>[^"]*)"|
9
9
 
10
10
  # in liquid tags the whole line is white space until the tag
11
- ^\s*#{tag}\s+'(?<partial>[^']*)'|
12
- ^\s*#{tag}\s+"(?<partial>[^"]*)"
11
+ ^\s*#{tag}#{'(_rc)?' if with_rc}\s+'(?<partial>[^']*)'|
12
+ ^\s*#{tag}#{'(_rc)?' if with_rc}\s+"(?<partial>[^"]*)"
13
13
  /mix
14
14
  end
15
15
 
@@ -25,6 +25,7 @@ module PlatformosCheck
25
25
  end
26
26
 
27
27
  PARTIAL_RENDER = partial_tag('render')
28
+ PARTIAL_THEME_RENDER = partial_tag('theme_render', with_rc: true)
28
29
  PARTIAL_INCLUDE = partial_tag('include')
29
30
  PARTIAL_INCLUDE_FORM = partial_tag('include_form')
30
31
  PARTIAL_FUNCTION = partial_tag_with_result('function')
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformosCheck
4
+ module LanguageServer
5
+ class ThemeRenderDocumentLinkProvider < DocumentLinkProvider
6
+ @partial_regexp = PARTIAL_THEME_RENDER
7
+ @app_file_type = :partials
8
+ @default_dir = 'views/partials'
9
+ @default_extension = '.liquid'
10
+
11
+ def file_link(partial, platformos_app)
12
+ relative_path = nil
13
+ path_prefixes(platformos_app).each do |prefix|
14
+ partial_with_prefix = (prefix.split(File::SEPARATOR) + [partial]).join(File::SEPARATOR)
15
+ relative_path = platformos_app.send(app_file_type).detect { |f| f.name == partial_with_prefix }&.relative_path
16
+ break if relative_path
17
+ end
18
+
19
+ relative_path ||= default_relative_path(partial)
20
+
21
+ file_uri(@storage.path(relative_path))
22
+ end
23
+
24
+ private
25
+
26
+ def path_prefixes(platformos_app)
27
+ platformos_app.app_config.content['theme_search_paths'] || ['']
28
+ rescue StandardError
29
+ ['']
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformosCheck
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: platformos-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Bliszczyk
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-09-14 00:00:00.000000000 Z
13
+ date: 2023-09-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: graphql
@@ -229,6 +229,7 @@ files:
229
229
  - lib/platformos_check/language_server/document_link_providers/include_document_link_provider.rb
230
230
  - lib/platformos_check/language_server/document_link_providers/include_form_document_link_provider.rb
231
231
  - lib/platformos_check/language_server/document_link_providers/render_document_link_provider.rb
232
+ - lib/platformos_check/language_server/document_link_providers/theme_render_document_link_provider.rb
232
233
  - lib/platformos_check/language_server/execute_command_engine.rb
233
234
  - lib/platformos_check/language_server/execute_command_provider.rb
234
235
  - lib/platformos_check/language_server/execute_command_providers/correction_execute_command_provider.rb