Shopify / Shopify/theme-tools

Deeplink to open a theme block by its type value specified in the liquid schema

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

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
It would be good DX to allow theme developers to deeplink through theme block type in blocks and preset nested blocks

Describe the solution you'd like
A clear and concise description of what you want to happen.
Deeplink click to open the corresponding theme block asset

Checklist

  • I have checked and made sure that the proposal adheres to this plugin's principles

Additional context
Add any other context or screenshots about the feature request here.
Something like this

// {% schema %}{ "blocks": [{ "type": "█" }] }{% endschema %}
LiquidRawTag(node) {
  if (node.name !== 'schema') return;
  if (!schema || isError(schema.ast) || isError(schema.validSchema)) return;
  const offset = node.blockPositionStart.end;
  const blockDefs = schema.validSchema.blocks;
  if (!blockDefs || hasLocalBlocks(blockDefs)) return;
  return blockDefs.map((def, i) => {
    const type = def.type;
    const typeNode = nodeAtPath(schema.ast, [blocks, i, "type"]);
    return DocumentLink.create(
      Range.create(offset + locStart(typeNode), offset + locEnd(typeNode)),
      Utils.resolvePath(root, 'blocks', type + ".liquid").toString(),
    );
  });
}

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 at the LiquidRawTag(node) schema handling shown in the issue and trace how document links are produced. Check the schema.ast and schema.validSchema paths, including nested preset blocks and local blocks. Done means clicking a block type opens the corresponding blocks/.liquid asset.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.