Shopify / Shopify/theme-tools

[LiquidDoc] Support param type validations when value is a variable

Open
#818 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

#gsd:44310
Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

I feel like it can be done. Not sure if there is a clean way but want to capture it in a ticket.

E.g. If you visit the AssignMarkup, you can see what type it is under node.value.expression.type. But i do this this fails pretty quickly for complex assigns:

{% assign foo = product.handle | filter1 | filter 2 %}

We have a symbols table in TypeSystem (packages/theme-language-server-common), but we'd have to move it over. We can investigate this after though.

Originally posted by @aswamy in https://github.com/Shopify/theme-tools/pull/792#discussion_r1970158035

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting AssignMarkup and how node.value.expression.type is used for parameter type validation. Then review the symbols table in packages/theme-language-server-common and how complex assigns such as chained filters are represented. Done means parameter type validation works when the value is a variable, including the example with product.handle and chained filters.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.