editorlocator

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-editorlocator

Go


Find installed code editors and IDEs and open a folder or file in one. Package editorlocator, module github.com/Rethunk-Tech/go-editorlocator.

Each editor's command line differs: one takes a folder and a file:line:column, another a solution and a separate line argument, a third only a file. This package answers both halves in one place — which editors are installed on this computer, and the arguments that open a path in the one the caller picked — so a caller never carries its own table of editor flags.

Quick start

go get github.com/Rethunk-Tech/go-editorlocator

A worked example and the contracts: HUMANS.md.

Features

  • Find lists every editor and IDE it can see: each program on PATH, the VS Code, VSCodium, Rider and Cursor install folders, and on Windows the Visual Studios from the installer's own tool plus the programs registered for .sln, .slnx and .csproj.
  • One entry per program, and one per installed JetBrains version, named with the version it records.
  • Every Editor carries its Kind, so a caller can group or filter the list without re-reading the path.
  • ProjectArgs and FileArgs build the arguments for a folder, a solution or a file at a line and column, in the form that editor takes.
  • SolutionIn reports a folder's single solution file and returns nothing when there is none or a choice of several.
  • The discovery table and the injected lookups are unexported, so the search runs against a fake filesystem in tests.

Documentation

Doc Audience
HUMANS.md Running and using the package
AGENTS.md Internals, invariants, and why
CONTRIBUTING.md Process — commits, tests, docs
SECURITY.md Vulnerability disclosure
CHANGELOG.md Release notes

License

MIT — see LICENSE. © 2026 Rethunk.Tech, LLC.

Documentation

Overview

Package editorlocator finds installed code editors and IDEs and builds the command line to open a folder, a solution or a file at a line in one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileArgs

func FileArgs(program, file string, line, column int) []string

FileArgs is the arguments that open a file in program at a line and column, in the form that program takes.

func ProjectArgs

func ProjectArgs(program, dir, solution string) []string

ProjectArgs is the arguments that open a project in program: the VS Code family works on folders, and the rest open the solution when there is one.

func SolutionIn

func SolutionIn(dir string) string

SolutionIn is the folder's one solution file, or "" when it holds none or a choice of several.

Types

type Editor

type Editor struct {
	Name    string `json:"name"`
	Program string `json:"program"`
	Kind    Kind   `json:"kind"`
}

Editor is one installed program a project can open in; each installed version is its own.

func Find

func Find() []Editor

Find lists the editors installed on this computer, each installed version on its own. The first entry is the one the table's order prefers: PATH before an install folder, and the newest version of a folder pattern before older ones.

type Kind

type Kind int

Kind is the family a program belongs to, which decides what it is given to open.

const (
	// Other is a program no family below claims: it is given a path and told nothing else.
	Other Kind = iota
	// VSCodeFamily opens a folder, and a file at a line and column.
	VSCodeFamily
	// JetBrains opens a solution, and a file at a line.
	JetBrains
	// VisualStudio opens a solution, and a file without a line.
	VisualStudio
)

The families KindOf tells apart.

func KindOf

func KindOf(program string) Kind

KindOf reports the family a program is in, read from its name alone. An installer may move the program or rename the folder around it, but the name of the program itself is what decides how it reads its arguments.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL