platformos-check 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d317404f687b20085ee3bd3772b83b791beaac299895868791b1a0c9d1379a0f
4
- data.tar.gz: 503ef865bed91af1a1075e19cbde4f413047da2e1f91254f6f0146ee822b4df4
3
+ metadata.gz: ea3b2795b757ae4f571abc2a432ff97c129e4eba0dacb20ffb3a4cba0badd702
4
+ data.tar.gz: 6eb2287f066a7d4a2c4fe93ac008071672282d29b80741986a982146c8d30311
5
5
  SHA512:
6
- metadata.gz: 9809a013343529578a1c5b1fe1f045569173dd05bc60cb3a475ef9e9c8563a9dac5d3fdb934ea030806d51d5e59381f23b0712db435fb3107282d9bfdb0b5d34
7
- data.tar.gz: '0917811b08472cf1f8abbc0845044b62250a8a7d04c75aafbb47a3e5d97779098ff5c24d9bd932b447c47a558cab8a5916d225d0f810b6d82466bc09adc06fea'
6
+ metadata.gz: 435e5da569ae2d99973b4f26b5383acb304ba16482a4ca7a09b7d7affa7ea01573bebfa9856a2ce6809a300fccaf8f41e7cf95e8844c3c6309098a2ca450a82d
7
+ data.tar.gz: 118099b25e2557574c1ab51c4ad674e8c94607d35d8ce1bf543b2de581ad0c9ca54f4a1d3e6cee569c9eb0c6d4585744df86f905e31a36054f3e2853e379cb10
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.3.0 / 2023-09-15
2
+ ==================
3
+
4
+ * Support for theme_render_rc tag
5
+
1
6
  v0.2.2 / 2023-09-15
2
7
  ==================
3
8
 
@@ -19,8 +19,8 @@ module PlatformosCheck
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
@@ -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.2"
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.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Bliszczyk
@@ -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