Skip to content

Project Configuration

Oliver Atkinson edited this page May 31, 2026 · 1 revision

Project Configuration

lexicon-lsp discovers project configuration from workspace roots. The same configuration should be used by all editor integrations.

Accepted filenames:

  • lexicon-lsp.json
  • .lexicon-lsp.json
  • lexicon.conf
  • .lexicon.conf

Prefer lexicon-lsp.json for clarity.

Single Root

{
  "lexicon": "lexicons/commerce.lexicon"
}

The path is relative to the configuration file.

Use a single root when one composed lexicon describes the whole workspace.

Scoped Root

{
  "scope": "apps/storefront",
  "lexicon": "lexicons/storefront.lexicon"
}

scope limits the mapping to a subtree of the workspace. It is also relative to the configuration file.

Multiple Independent Roots

{
  "lexicons": [
    {
      "scope": "apps/storefront",
      "lexicon": "lexicons/storefront.lexicon"
    },
    {
      "scope": "packages/payments",
      "lexicon": "packages/payments/payments.lexicon"
    }
  ]
}

The longest matching scope wins for each opened file.

Use this when independent products or packages intentionally have separate roots.

Recommended Layout

repo/
  lexicon-lsp.json
  lexicons/
    commerce.lexicon
    shared-commerce.lexicon
    api/
      storefront.lexicon
    ui/
      product.lexicon
  apps/
    storefront/
      src/
  packages/
    generated/

lexicon-lsp.json:

{
  "lexicon": "lexicons/commerce.lexicon"
}

lexicons/commerce.lexicon:

@ ./shared-commerce.lexicon

commerce:
	api:
		storefront:
		@ ./api/storefront.lexicon
	ui:
		product:
		@ ./ui/product.lexicon

Discovery Rules

The server searches workspace roots for configuration files. It skips common generated and dependency directories:

  • .build
  • .git
  • .swiftpm
  • DerivedData
  • node_modules
  • target

Open configuration files are also considered when they live inside the workspace root.

Fallback Behavior

If the server starts with an explicit --lexicon argument, that lexicon is the fallback root:

lexicon-lsp --lexicon lexicons/commerce.lexicon

If no explicit root or config exists, opening a .lexicon file can adopt that file as the fallback lexicon.

Project configuration is better for teams because it is deterministic and shared.

Clone this wiki locally