Skip to content

Latest commit

 

History

History
58 lines (46 loc) · 2.13 KB

CONTRIBUTING.md

File metadata and controls

58 lines (46 loc) · 2.13 KB

Contributing Guidelines

Thanks for contributing to Trunk's Neovim plugin! Read on to learn more.

Overview

The Trunk Check Neovim Plugin is in Beta with limited support. Please feel free to reach out to us on Slack if you encounter any issues, but note that we will be prioritizing our work on the core CLI and VSCode extension.

Local Development

To develop locally, follow the install instructions and then change the plugin path used by lazy.nvim.

require("lazy").setup({
	{
		dir = "<path-to-repo>/neovim-trunk",
		lazy = false,
		config = {
			-- trunkPath = "trunk",
			-- lspArgs = {},
			-- formatOnSave = true,
			-- formatOnSaveTimeout = 10, -- seconds
			-- logLevel = "info"
		},
		main = "trunk",
		dependencies = {"nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim"}
	}
})

On Linux, we usually develop using the AppImage installation.

Use demo_data as a sandbox for testing the plugin.

Code Overview

Neovim plugins are setup as follows:

  • The plugin directory at the root of the repo contains a vimscript file responsible for:
    • Starting any background processes (in this case, the Trunk LSP server)
    • Defining any commands accessible from Neovim
    • And marking the plugin as finished loading
  • A lua directory containing any lua files for core functionality. Our lua directory contains:
    • trunk.lua, which defines global state for the lifetime of the plugin, provides functionality for each of the vimscript commands, and launches the Trunk LSP server.
    • log.lua, which manages logging, which is written to .trunk/logs/neovim.log and is flushed periodically. When run from outside of a Trunk repo, this log is written to a tempfile.

These files interface with the built-in Neovim LSP framework to provide inline diagnostics and other features.