Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Elixir factory go to definitionNew to Visual Studio Code? Get it now.
Elixir factory go to definition

Elixir factory go to definition

Kirill Kaiumov

|
15 installs
| (0) | Free
Navigate to factory definitions in Elixir tests
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Elixir factory go to definition

A Visual Studio Code extension that allows you to navigate from factory usage in your Elixir tests directly to the factory definitions.

Features

  • Navigate from factory usage in tests to factory definitions with a keyboard shortcut
  • Supports common factory patterns like insert(:factory_name, ...) and build(:factory_name, ...)
  • Configurable paths to search for factory definitions (supports files, directories, and glob patterns)

Extension Settings

This extension contributes the following settings:

  • elixir-factory-navigator.factoryPaths: An array of paths to search for factory definitions. Supports three types of paths:
    • Individual files (e.g., test/support/factory.ex)
    • Directories (all Elixir files in the directory will be searched)
    • Glob patterns (e.g., test/support/**/factory.ex)

Example configuration in settings.json:

{
  "elixir-factory-navigator.factoryPaths": [
    "test/support/factory.ex",
    "test/support/factories",
    "test/support/**/factory.ex"
  ]
}

In this example:

  • test/support/factory.ex is a specific file that will be searched
  • test/support/factories is a directory - all Elixir files within it will be searched
  • test/support/**/factory.ex is a glob pattern that will find all factory.ex files in the test/support directory and all of its subdirectories (at any depth)

Glob Pattern Examples

  • **/*.ex - All Elixir files in the workspace
  • test/**/*_factory.ex - All files ending with _factory.ex in the test directory and its subdirectories
  • {test,lib}/**/*.ex - All Elixir files in either the test or lib directories

Troubleshooting

If the extension doesn't find a factory definition:

  1. Make sure your cursor is placed directly on the factory name (the text after the colon in insert(:factory_name, ...))
  2. Check that the factory definition exists in one of the configured factory paths
  3. Verify that the factory definition follows the naming convention: def factory_name_factory do or def factory_name_factory(...) do
  4. Open the Developer Tools console (Help -> Toggle Developer Tools) to see debug logs which can help identify issues

Installation

From VS Code Marketplace

Coming soon...

From VSIX File

  1. Download the .vsix file from the repository releases
  2. Open VS Code
  3. Go to the Extensions view (Ctrl+Shift+X)
  4. Click on the "..." (More Actions) button in the top-right corner of the Extensions view
  5. Select "Install from VSIX..." and choose the downloaded file

Building from Source

  1. Clone the repository
  2. Run npm install to install dependencies
  3. Run npm run package to create the VSIX package
  4. Install the generated VSIX file as described above

Requirements

  • Visual Studio Code 1.60.0 or higher

Known Issues

  • The extension currently only supports factory references in the format insert(:factory_name, ...) or build(:factory_name, ...)
  • Multi-root workspaces: The extension will look for factory definitions in the first workspace folder
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft