Skip to content

theme-language-server-common: support go-to-definition for Liquid file references#1140

Open
RomainDW wants to merge 1 commit intoShopify:mainfrom
RomainDW:fix/definition-file-references
Open

theme-language-server-common: support go-to-definition for Liquid file references#1140
RomainDW wants to merge 1 commit intoShopify:mainfrom
RomainDW:fix/definition-file-references

Conversation

@RomainDW
Copy link

@RomainDW RomainDW commented Mar 4, 2026

What

Add textDocument/definition support for Liquid file references by reusing document-link targets.

Supported references:

  • {% render 'snippet' %} / {% include 'snippet' %} -> snippets/<name>.liquid
  • {% section 'name' %} -> sections/<name>.liquid
  • {{ 'file.ext' | asset_url }} -> assets/<file.ext>
  • {% content_for 'block', type: 'name' %} -> blocks/<name>.liquid

Why

Today these references are available through documentLink but not through definition, so cmd/ctrl+click go-to-definition does not work in editors that use textDocument/definition.

How

  • Added DocumentLinksDefinitionProvider that:
    • computes all document links for the current file
    • selects the active link under cursor
    • returns a LocationLink for that target
  • Wired it into DefinitionProvider
  • Passed findThemeRootURI into DefinitionProvider from startServer

Tests

Added DocumentLinksDefinitionProvider.spec.ts covering:

  • render snippet
  • section
  • asset_url
  • content_for block type
  • non-reference cursor returns null

Executed locally:

CI=1 corepack yarn test \
  packages/theme-language-server-common/src/definitions/providers/DocumentLinksDefinitionProvider.spec.ts \
  packages/theme-language-server-common/src/definitions/providers/TranslationStringDefinitionProvider.spec.ts \
  packages/theme-language-server-common/src/definitions/providers/SchemaTranslationStringDefinitionProvider.spec.ts

Result: 3 files passed, 6 tests passed.

Closes #1139

@RomainDW RomainDW requested a review from a team as a code owner March 4, 2026 15:17
@RomainDW RomainDW closed this Mar 4, 2026
@RomainDW RomainDW deleted the fix/definition-file-references branch March 4, 2026 15:21
@RomainDW RomainDW restored the fix/definition-file-references branch March 4, 2026 15:31
@RomainDW RomainDW reopened this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

theme-language-server: add textDocument/definition for Liquid file references (render/section/content_for/asset_url)

1 participant