platformos-check 0.0.1 → 0.0.2

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/README.md +22 -7
  5. data/data/platformos_liquid/documentation/latest.json +1 -1
  6. data/docker/bin/platformos-check +13 -0
  7. data/docker/bin/platformos-check-language-server +13 -0
  8. data/docker/check.Dockerfile +1 -1
  9. data/docker/lsp.Dockerfile +1 -1
  10. data/lib/platformos_check/app.rb +11 -13
  11. data/lib/platformos_check/app_file.rb +6 -2
  12. data/lib/platformos_check/asset_file.rb +8 -2
  13. data/lib/platformos_check/checks/undefined_object.rb +3 -0
  14. data/lib/platformos_check/form_file.rb +15 -0
  15. data/lib/platformos_check/language_server/constants.rb +15 -1
  16. data/lib/platformos_check/language_server/document_link_engine.rb +3 -1
  17. data/lib/platformos_check/language_server/document_link_provider.rb +28 -11
  18. data/lib/platformos_check/language_server/document_link_providers/asset_document_link_provider.rb +2 -2
  19. data/lib/platformos_check/language_server/document_link_providers/background_document_link_provider.rb +12 -0
  20. data/lib/platformos_check/language_server/document_link_providers/function_document_link_provider.rb +12 -0
  21. data/lib/platformos_check/language_server/document_link_providers/graphql_document_link_provider.rb +12 -0
  22. data/lib/platformos_check/language_server/document_link_providers/include_document_link_provider.rb +3 -2
  23. data/lib/platformos_check/language_server/document_link_providers/include_form_document_link_provider.rb +12 -0
  24. data/lib/platformos_check/language_server/document_link_providers/render_document_link_provider.rb +3 -2
  25. data/lib/platformos_check/language_server/hover_providers/filter_hover_provider.rb +3 -4
  26. data/lib/platformos_check/liquid_file.rb +4 -12
  27. data/lib/platformos_check/version.rb +1 -1
  28. data/lib/platformos_check.rb +1 -0
  29. metadata +9 -3
  30. data/lib/platformos_check/language_server/document_link_providers/section_document_link_provider.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 840ace78b76cdaa62e67c0e7feae3fce829b8bbd0f9fef7d587a444b047d81ff
4
- data.tar.gz: 618fd6c63b67124c5fb28bad6ab0d3ba8a2c92caa6b9c799e94d2af71d4d6cf7
3
+ metadata.gz: 8ccb7f1c1c4e9ace757741ce3c4276925e847316275e2e4c13b47aa51ed532ac
4
+ data.tar.gz: 1c124ce36db77d499840fbb77468bce36ba0242cabd1b7d68b815b5f57916659
5
5
  SHA512:
6
- metadata.gz: 9be49610b3ccaeafc826ef4f1763e903c7fd2af827cb6481c268bb41280b517df0483b0b1b2215ccd63e7394d8835c446b759a5b4b23796ca197633c7a1caee5
7
- data.tar.gz: 2caa1dcf78c619bdc536636b66fbbf351cfdef948264b2313e29f64c301efb2530bb8b8a8eef674bcf0e51ee510e87750d9fde291044af3aa8d963cbc0a31966
6
+ metadata.gz: 5c238fb281830f32796e5664617a45394f8b6dfea97b4f85c360f7df7825b4704750bf3af2a16a194545e6329b90abd7c396f4ebea9a2a9865217c5024cc74f6
7
+ data.tar.gz: 484605c45b4a8c50c9e22f8026300431ab723ab17233cdef1fbfe8a9efb53aa5d78aff7198338532e0c32783f077c7fac03d21960c909c1729a9684da6bfc11b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.0.2 / 2023-09-09
2
+ ==================
3
+
4
+ * Add documentLink support for pOS tags for easy navigation, aka ctrl + click to quickly access file invoked by render, include, graphql, background and include_form tags
5
+ * Treat Form as liquid file and check it
1
6
 
2
7
  v0.0.1 / 2023-08-19
3
8
  ==================
data/CONTRIBUTING.md CHANGED
@@ -56,7 +56,7 @@ Before configuring your IDE, run the following commands in a terminal:
56
56
  ```
57
57
  "platformosCheck.checkOnChange": true,
58
58
  "platformosCheck.onlySingleFileChecks": false,
59
- "platformOSLiquid.languageServerPath": "/Users/<your user>/bin/platformos-check-language-server",
59
+ "platformosLiquid.languageServerPath": "/Users/<your user>/bin/platformos-check-language-server",
60
60
  "platformosCheck.checkOnOpen": true,
61
61
  "platformosCheck.checkOnSave": true
62
62
  ```
data/README.md CHANGED
@@ -10,9 +10,9 @@ PlatformOS Check currently checks for the following:
10
10
 
11
11
  ✅ Liquid syntax errors
12
12
  ✅ JSON syntax errors
13
- ✅ Missing snippet & section templates
13
+ ✅ Missing partials and graphqls
14
14
  ✅ Unused `{% assign ... %}`
15
- ✅ Unused snippet templates
15
+ ✅ Unused partials
16
16
  ✅ Template length
17
17
  ✅ Deprecated tags
18
18
  ✅ Unknown tags
@@ -22,6 +22,7 @@ PlatformOS Check currently checks for the following:
22
22
  ✅ Undefined objects
23
23
  ✅ Deprecated filters
24
24
  ✅ Missing `platformos-check-enable` comment
25
+ ✅ Invalid arguments provided to `{% graphql %}` tags
25
26
 
26
27
  As well as checks that prevent easy to spot performance problems:
27
28
 
@@ -48,7 +49,15 @@ With more to come! Suggestions welcome ([create an issue](https://github.com/Pla
48
49
 
49
50
  - Ruby 3.2+
50
51
 
51
- TODO
52
+ ### Install ruby and platform-check gem
53
+
54
+ 1. Download the latest version of Ruby - https://www.ruby-lang.org/en/documentation/installation/
55
+ 2. Install platformos-check gem
56
+
57
+ `gem install platformos-check`
58
+
59
+ You can verify the installation was successful by invoking `platformos-check --version`. If you chose this method, use `platformos-check-language-server` as a path to your language server instead of `/Users/<username/platformos-check-language-server`
60
+
52
61
 
53
62
  ### Using Docker
54
63
 
@@ -61,7 +70,7 @@ DIR=$(pwd)
61
70
  IMAGE_NAME=platformos/platformos-lsp:latest
62
71
 
63
72
  LOG_DIR=$DIR/logs
64
- mkdir $LOG_DIR
73
+ mkdir $LOG_DIR 2>/dev/null
65
74
  LOG_FILE=$LOG_DIR/platformos-lsp.log
66
75
 
67
76
  exec docker run -i \
@@ -69,7 +78,7 @@ exec docker run -i \
69
78
  -w $DIR \
70
79
  -e PLATFORMOS_CHECK_DEBUG=true \
71
80
  -e PLATFORMOS_CHECK_DEBUG_LOG_FILE=$LOG_FILE \
72
- $IMAGE_NAME
81
+ $IMAGE_NAME $@
73
82
  ```
74
83
  This script will automatically download the latest Docker image and initiate a language server. Visual Studio Code (VSC) manages this process automatically. However, you can run the script for verification if needed."
75
84
 
@@ -86,7 +95,7 @@ DIR=$(pwd)
86
95
  IMAGE_NAME=platformos/platformos-check:latest
87
96
 
88
97
  LOG_DIR=$DIR/logs
89
- mkdir $LOG_DIR
98
+ mkdir $LOG_DIR 2>/dev/null
90
99
  LOG_FILE=$LOG_DIR/platformos-check.log
91
100
 
92
101
  exec docker run -i \
@@ -94,7 +103,13 @@ exec docker run -i \
94
103
  -w $DIR \
95
104
  -e PLATFORMOS_CHECK_DEBUG=true \
96
105
  -e PLATFORMOS_CHECK_DEBUG_LOG_FILE=$LOG_FILE \
97
- $IMAGE_NAME
106
+ $IMAGE_NAME $@
107
+ ```
108
+ To verify installation run `platformos-check --help`.
109
+
110
+ Usage example for CI/CD:
111
+ ```
112
+ platformos-check --fail-level error
98
113
  ```
99
114
 
100
115
  ## Configuration
@@ -1,2 +1,2 @@
1
1
 
2
- {"revision":"60e9bc12f29f8b31a26e364965976a52fc72d39d"}
2
+ {"revision":"e1c423c3470100b88c95fcf84af15c652f2c89b7"}
@@ -0,0 +1,13 @@
1
+ DIR=$(pwd)
2
+ IMAGE_NAME=platformos/platformos-check:latest
3
+
4
+ LOG_DIR=$DIR/logs
5
+ mkdir $LOG_DIR 2>/dev/null
6
+ LOG_FILE=$LOG_DIR/platformos-check.log
7
+
8
+ docker run -i \
9
+ -v $DIR:$DIR \
10
+ -w $DIR \
11
+ -e PLATFORMOS_CHECK_DEBUG=true \
12
+ -e PLATFORMOS_CHECK_DEBUG_LOG_FILE=$LOG_FILE \
13
+ $IMAGE_NAME $@
@@ -0,0 +1,13 @@
1
+ DIR=$(pwd)
2
+ IMAGE_NAME=platformos/platformos-lsp:latest
3
+
4
+ LOG_DIR=$DIR/logs
5
+ mkdir $LOG_DIR 2>/dev/null
6
+ LOG_FILE=$LOG_DIR/platformos-lsp.log
7
+
8
+ exec docker run -i \
9
+ -v $DIR:$DIR \
10
+ -w $DIR \
11
+ -e PLATFORMOS_CHECK_DEBUG=true \
12
+ -e PLATFORMOS_CHECK_DEBUG_LOG_FILE=$LOG_FILE \
13
+ $IMAGE_NAME
@@ -1,3 +1,3 @@
1
1
  FROM platformos/platformos-lsp:latest
2
2
 
3
- ENTRYPOINT $WORKDIR/platformos-lsp/bin/platformos-check .
3
+ ENTRYPOINT ["/app/platformos-lsp/bin/platformos-check"]
@@ -16,6 +16,6 @@ RUN git clone https://github.com/Platform-OS/platformos-lsp.git && \
16
16
 
17
17
  RUN adduser --disabled-password --gecos '' platformos && chown platformos:platformos -R /app
18
18
 
19
- ENTRYPOINT "$WORKDIR/platformos-lsp/exe/platformos-check-language-server"
19
+ ENTRYPOINT ["/app/platformos-lsp/exe/platformos-check-language-server"]
20
20
 
21
21
  USER platformos
@@ -14,6 +14,7 @@ module PlatformosCheck
14
14
  MIGRATIONS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)migrations/(.+)\.liquid\z}
15
15
  PAGES_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(pages|views/pages)/(.+)}
16
16
  PARTIALS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(views/partials|lib)/(.+)}
17
+ FORMS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(form_configurations|forms)/(.+)\.liquid\z}
17
18
  LAYOUTS_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(views/layouts)/(.+)}
18
19
  SCHEMA_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(custom_model_types|model_schemas|schema)/(.+)\.yml\z}
19
20
  SMSES_REGEX = %r{\A(?-mix:^/?((marketplace_builder|app)/|modules/(.+)(private|public|marketplace_builder|app)/)?)(notifications/sms_notifications|smses)/(.+)\.liquid\z}
@@ -29,6 +30,7 @@ module PlatformosCheck
29
30
  MIGRATIONS_REGEX => MigrationFile,
30
31
  PAGES_REGEX => PageFile,
31
32
  PARTIALS_REGEX => PartialFile,
33
+ FORMS_REGEX => FormFile,
32
34
  LAYOUTS_REGEX => LayoutFile,
33
35
  SCHEMA_REGEX => SchemaFile,
34
36
  SMSES_REGEX => SmsFile,
@@ -67,7 +69,7 @@ module PlatformosCheck
67
69
  end
68
70
 
69
71
  def liquid
70
- layouts + partials + pages + notifications
72
+ layouts + partials + forms + pages + notifications
71
73
  end
72
74
 
73
75
  def yaml
@@ -86,6 +88,10 @@ module PlatformosCheck
86
88
  grouped_files[PartialFile]&.values || []
87
89
  end
88
90
 
91
+ def forms
92
+ grouped_files[FormFile]&.values || []
93
+ end
94
+
89
95
  def layouts
90
96
  grouped_files[LayoutFile]&.values || []
91
97
  end
@@ -98,6 +104,10 @@ module PlatformosCheck
98
104
  grouped_files[EmailFile]&.values || []
99
105
  end
100
106
 
107
+ def graphqls
108
+ grouped_files[GraphqlFile]&.values || []
109
+ end
110
+
101
111
  def smses
102
112
  grouped_files[SmsFile]&.values || []
103
113
  end
@@ -110,10 +120,6 @@ module PlatformosCheck
110
120
  grouped_files[PageFile]&.values || []
111
121
  end
112
122
 
113
- def directories
114
- storage.directories
115
- end
116
-
117
123
  def all
118
124
  @all ||= grouped_files.values.map(&:values).flatten
119
125
  end
@@ -126,13 +132,5 @@ module PlatformosCheck
126
132
  all.find { |t| t.name == name_or_relative_path }
127
133
  end
128
134
  end
129
-
130
- def sections
131
- liquid.select(&:section?)
132
- end
133
-
134
- def snippets
135
- liquid.select(&:snippet?)
136
- end
137
135
  end
138
136
  end
@@ -23,11 +23,15 @@ module PlatformosCheck
23
23
  end
24
24
 
25
25
  def name
26
- @name ||= dir_prefix.nil? ? relative_path.sub_ext('').to_s : build_name
26
+ @name ||= dir_prefix.nil? ? remove_extension(relative_path).to_s : build_name
27
+ end
28
+
29
+ def remove_extension(path)
30
+ path.sub_ext('')
27
31
  end
28
32
 
29
33
  def build_name
30
- n = relative_path.sub(dir_prefix, '').sub_ext('').to_s
34
+ n = remove_extension(relative_path.sub(dir_prefix, '')).to_s
31
35
  return n if module_name.nil?
32
36
 
33
37
  prefix = "modules#{File::SEPARATOR}#{module_name}#{File::SEPARATOR}"
@@ -4,6 +4,8 @@ require "zlib"
4
4
 
5
5
  module PlatformosCheck
6
6
  class AssetFile < AppFile
7
+ DIR_PREFIX = %r{\A/?((marketplace_builder|app)/assets/|modules/((\w|-)*)/(private|public)/assets/)}
8
+
7
9
  def initialize(relative_path, storage)
8
10
  super
9
11
  @loaded = false
@@ -27,8 +29,12 @@ module PlatformosCheck
27
29
  @gzipped_size ||= Zlib.gzip(source).bytesize
28
30
  end
29
31
 
30
- def name
31
- relative_path.to_s
32
+ def dir_prefix
33
+ DIR_PREFIX
34
+ end
35
+
36
+ def remove_extension(path)
37
+ path
32
38
  end
33
39
  end
34
40
  end
@@ -144,6 +144,9 @@ module PlatformosCheck
144
144
  if info.app_file.notification?
145
145
  # NOTE: `data` comes from graphql for notifications
146
146
  check_object(info, all_global_objects + %w[data response form])
147
+ elsif info.app_file.form?
148
+ # NOTE: `data` comes from graphql for notifications
149
+ check_object(info, all_global_objects + %w[form form_builder])
147
150
  else
148
151
  check_object(info, all_global_objects)
149
152
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformosCheck
4
+ class FormFile < LiquidFile
5
+ DIR_PREFIX = %r{\A/?((marketplace_builder|app)/(form_configurations|forms)/|modules/((\w|-)*)/(private|public)/(form_configurations|forms)/)}
6
+
7
+ def form?
8
+ true
9
+ end
10
+
11
+ def dir_prefix
12
+ DIR_PREFIX
13
+ end
14
+ end
15
+ end
@@ -13,9 +13,23 @@ module PlatformosCheck
13
13
  /mix
14
14
  end
15
15
 
16
+ def self.partial_tag_with_result(tag)
17
+ /
18
+ \{%-?\s*#{tag}\s+(?<var>[\w]+)+\s*=\s*'(?<partial>[^']*)'|
19
+ \{%-?\s*#{tag}\s+(?<var>[\w]+)\s*=\s*"(?<partial>[^"]*)"|
20
+
21
+ # in liquid tags the whole line is white space until the tag
22
+ ^\s*#{tag}\s+(?<var>[\w]+)+\s*=\s*'(?<partial>[^']*)'|
23
+ ^\s*#{tag}\s+(?<var>[\w]+)+\s*=\s*"(?<partial>[^"]*)"
24
+ /mix
25
+ end
26
+
16
27
  PARTIAL_RENDER = partial_tag('render')
17
28
  PARTIAL_INCLUDE = partial_tag('include')
18
- PARTIAL_SECTION = partial_tag('section')
29
+ PARTIAL_INCLUDE_FORM = partial_tag('include_form')
30
+ PARTIAL_FUNCTION = partial_tag_with_result('function')
31
+ PARTIAL_GRAPHQL = partial_tag_with_result('graphql')
32
+ PARTIAL_BACKGROUND = partial_tag_with_result('background')
19
33
 
20
34
  ASSET_INCLUDE = /
21
35
  \{\{-?\s*'(?<partial>[^']*)'\s*\|\s*asset_url|
@@ -12,8 +12,10 @@ module PlatformosCheck
12
12
  buffer = @storage.read(relative_path)
13
13
  return [] unless buffer
14
14
 
15
+ platformos_app = PlatformosCheck::App.new(@storage)
16
+
15
17
  @providers.flat_map do |p|
16
- p.document_links(buffer)
18
+ p.document_links(buffer, platformos_app)
17
19
  end
18
20
  end
19
21
  end
@@ -8,7 +8,7 @@ module PlatformosCheck
8
8
  include URIHelper
9
9
 
10
10
  class << self
11
- attr_accessor :partial_regexp, :destination_directory, :destination_postfix
11
+ attr_accessor :partial_regexp, :app_file_type, :default_dir, :default_extension
12
12
 
13
13
  def all
14
14
  @all ||= []
@@ -23,19 +23,23 @@ module PlatformosCheck
23
23
  @storage = storage
24
24
  end
25
25
 
26
- def partial_regexp
27
- self.class.partial_regexp
26
+ def app_file_type
27
+ self.class.app_file_type
28
+ end
29
+
30
+ def default_dir
31
+ self.class.default_dir
28
32
  end
29
33
 
30
- def destination_directory
31
- self.class.destination_directory
34
+ def default_extension
35
+ self.class.default_extension
32
36
  end
33
37
 
34
- def destination_postfix
35
- self.class.destination_postfix
38
+ def partial_regexp
39
+ self.class.partial_regexp
36
40
  end
37
41
 
38
- def document_links(buffer)
42
+ def document_links(buffer, platformos_app)
39
43
  matches(buffer, partial_regexp).map do |match|
40
44
  start_row, start_column = from_index_to_row_column(
41
45
  buffer,
@@ -48,7 +52,7 @@ module PlatformosCheck
48
52
  )
49
53
 
50
54
  {
51
- target: file_link(match[:partial]),
55
+ target: file_link(match[:partial], platformos_app),
52
56
  range: {
53
57
  start: {
54
58
  line: start_row,
@@ -63,8 +67,21 @@ module PlatformosCheck
63
67
  end
64
68
  end
65
69
 
66
- def file_link(partial)
67
- file_uri(@storage.path(destination_directory + '/' + partial + destination_postfix))
70
+ def file_link(partial, platformos_app)
71
+ relative_path = platformos_app.send(app_file_type).detect { |f| f.name == partial }&.relative_path
72
+ relative_path ||= default_relative_path(partial)
73
+
74
+ file_uri(@storage.path(relative_path))
75
+ end
76
+
77
+ def default_relative_path(partial)
78
+ return Pathname.new("app/#{default_dir}/#{partial}#{default_extension}") unless partial.start_with?('modules/')
79
+
80
+ partial_components = partial.split(File::SEPARATOR)
81
+ module_prefix = partial_components.shift(2).join(File::SEPARATOR)
82
+ partial_without_module = partial_components.join(File::SEPARATOR)
83
+
84
+ Pathname.new("#{module_prefix}/public/#{default_dir}/#{partial_without_module}#{default_extension}")
68
85
  end
69
86
  end
70
87
  end
@@ -4,8 +4,8 @@ module PlatformosCheck
4
4
  module LanguageServer
5
5
  class AssetDocumentLinkProvider < DocumentLinkProvider
6
6
  @partial_regexp = ASSET_INCLUDE
7
- @destination_directory = "assets"
8
- @destination_postfix = ""
7
+ @app_file_type = :assets
8
+ @default_dir = 'assets'
9
9
  end
10
10
  end
11
11
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformosCheck
4
+ module LanguageServer
5
+ class BackgroundDocumentLinkProvider < DocumentLinkProvider
6
+ @partial_regexp = PARTIAL_BACKGROUND
7
+ @app_file_type = :partials
8
+ @default_dir = 'lib'
9
+ @default_extension = '.liquid'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformosCheck
4
+ module LanguageServer
5
+ class FunctionDocumentLinkProvider < DocumentLinkProvider
6
+ @partial_regexp = PARTIAL_FUNCTION
7
+ @app_file_type = :partials
8
+ @default_dir = 'lib'
9
+ @default_extension = '.liquid'
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformosCheck
4
+ module LanguageServer
5
+ class GraphqlDocumentLinkProvider < DocumentLinkProvider
6
+ @partial_regexp = PARTIAL_GRAPHQL
7
+ @app_file_type = :graphqls
8
+ @default_dir = 'graphql'
9
+ @default_extension = '.graphql'
10
+ end
11
+ end
12
+ end
@@ -4,8 +4,9 @@ module PlatformosCheck
4
4
  module LanguageServer
5
5
  class IncludeDocumentLinkProvider < DocumentLinkProvider
6
6
  @partial_regexp = PARTIAL_INCLUDE
7
- @destination_directory = "snippets"
8
- @destination_postfix = ".liquid"
7
+ @app_file_type = :partials
8
+ @default_dir = 'views/partials'
9
+ @default_extension = '.liquid'
9
10
  end
10
11
  end
11
12
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformosCheck
4
+ module LanguageServer
5
+ class IncludeFormDocumentLinkProvider < DocumentLinkProvider
6
+ @partial_regexp = PARTIAL_INCLUDE_FORM
7
+ @app_file_type = :forms
8
+ @default_dir = 'forms'
9
+ @default_extension = '.liquid'
10
+ end
11
+ end
12
+ end
@@ -4,8 +4,9 @@ module PlatformosCheck
4
4
  module LanguageServer
5
5
  class RenderDocumentLinkProvider < DocumentLinkProvider
6
6
  @partial_regexp = PARTIAL_RENDER
7
- @destination_directory = "snippets"
8
- @destination_postfix = ".liquid"
7
+ @app_file_type = :partials
8
+ @default_dir = 'views/partials'
9
+ @default_extension = '.liquid'
9
10
  end
10
11
  end
11
12
  end
@@ -89,7 +89,7 @@ module PlatformosCheck
89
89
  end
90
90
 
91
91
  def param_to_doc(param)
92
- "#{param.name}:#{param.return_type.downcase}"
92
+ "#{param&.name || 'object'}:#{param&.return_type&.downcase || 'untyped'}"
93
93
  end
94
94
 
95
95
  def filter_to_completion(filter)
@@ -97,11 +97,10 @@ module PlatformosCheck
97
97
  first_param, *other_params = filter.parameters
98
98
  other_params = other_params.map { |param| param_to_doc(param) }
99
99
  other_params = other_params.any? ? ": #{other_params.join(', ')}" : ""
100
- content = "#{param_to_doc(first_param)} | #{filter.name}#{other_params} => #{filter.return_type}"
100
+ content += " \n\n#{param_to_doc(first_param)} | #{filter.name}#{other_params} => #{filter.return_type}"
101
101
 
102
102
  {
103
- contents: content,
104
-
103
+ contents: content
105
104
  # label: filter.name,
106
105
  # kind: CompletionItemKinds::FUNCTION,
107
106
  # **format_hash(filter),
@@ -15,10 +15,6 @@ module PlatformosCheck
15
15
  true
16
16
  end
17
17
 
18
- def template?
19
- name.start_with?('template')
20
- end
21
-
22
18
  def notification?
23
19
  false
24
20
  end
@@ -31,20 +27,16 @@ module PlatformosCheck
31
27
  false
32
28
  end
33
29
 
34
- def partial?
30
+ def form?
35
31
  false
36
32
  end
37
33
 
38
- def layout?
34
+ def partial?
39
35
  false
40
36
  end
41
37
 
42
- def section?
43
- name.start_with?('sections')
44
- end
45
-
46
- def snippet?
47
- name.start_with?('snippet')
38
+ def layout?
39
+ false
48
40
  end
49
41
 
50
42
  def rewriter
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformosCheck
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
@@ -17,6 +17,7 @@ require_relative "platformos_check/graphql_file"
17
17
  require_relative "platformos_check/liquid_file"
18
18
  require_relative "platformos_check/page_file"
19
19
  require_relative "platformos_check/partial_file"
20
+ require_relative "platformos_check/form_file"
20
21
  require_relative "platformos_check/layout_file"
21
22
  require_relative "platformos_check/migration_file"
22
23
  require_relative "platformos_check/sms_file"
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.0.1
4
+ version: 0.0.2
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-08 00:00:00.000000000 Z
13
+ date: 2023-09-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: liquid
@@ -87,6 +87,8 @@ files:
87
87
  - data/platformos_liquid/documentation/latest.json
88
88
  - data/platformos_liquid/documentation/objects.json
89
89
  - data/platformos_liquid/documentation/tags.json
90
+ - docker/bin/platformos-check
91
+ - docker/bin/platformos-check-language-server
90
92
  - docker/check.Dockerfile
91
93
  - docker/lsp.Dockerfile
92
94
  - docs/api/check.md
@@ -166,6 +168,7 @@ files:
166
168
  - lib/platformos_check/email_file.rb
167
169
  - lib/platformos_check/exceptions.rb
168
170
  - lib/platformos_check/file_system_storage.rb
171
+ - lib/platformos_check/form_file.rb
169
172
  - lib/platformos_check/graphql_file.rb
170
173
  - lib/platformos_check/html_check.rb
171
174
  - lib/platformos_check/html_node.rb
@@ -202,9 +205,12 @@ files:
202
205
  - lib/platformos_check/language_server/document_link_engine.rb
203
206
  - lib/platformos_check/language_server/document_link_provider.rb
204
207
  - lib/platformos_check/language_server/document_link_providers/asset_document_link_provider.rb
208
+ - lib/platformos_check/language_server/document_link_providers/background_document_link_provider.rb
209
+ - lib/platformos_check/language_server/document_link_providers/function_document_link_provider.rb
210
+ - lib/platformos_check/language_server/document_link_providers/graphql_document_link_provider.rb
205
211
  - lib/platformos_check/language_server/document_link_providers/include_document_link_provider.rb
212
+ - lib/platformos_check/language_server/document_link_providers/include_form_document_link_provider.rb
206
213
  - lib/platformos_check/language_server/document_link_providers/render_document_link_provider.rb
207
- - lib/platformos_check/language_server/document_link_providers/section_document_link_provider.rb
208
214
  - lib/platformos_check/language_server/execute_command_engine.rb
209
215
  - lib/platformos_check/language_server/execute_command_provider.rb
210
216
  - lib/platformos_check/language_server/execute_command_providers/correction_execute_command_provider.rb
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module PlatformosCheck
4
- module LanguageServer
5
- class SectionDocumentLinkProvider < DocumentLinkProvider
6
- @partial_regexp = PARTIAL_SECTION
7
- @destination_directory = "sections"
8
- @destination_postfix = ".liquid"
9
- end
10
- end
11
- end