codigo

package module
v0.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 22 Imported by: 0

README

codigo

VSCode as a Go library. Embed an editor in your Go programs.

Set up codigo.Workbench with a terminal factory and filesystem (both of which can be virtual), then you can serve it as an HTTP handler to access your custom VSCode editor in the browser. Use with a webview window library to give the editor its own native window.

func main() {
	cwd, _ := os.Getwd()
	fsys := workingpathfs.New(osfs.New(), cwd)

	wb := &codigo.Workbench{
		ProductConfiguration: product.Configuration{
			NameLong: "My Custom Editor",
		},
		FS: fsys,
	}

	log.Println("editor serving on :8080 ...")
	if err := http.ListenAndServe(":8080", wb); err != nil {
		log.Fatal(err)
	}

}

Let me know what else you'd like to customize from Go!

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VSCodigoBridge = &GalleryExtensionInfo{
	ID:         "btwiuse.codigo-bridge",
	PreRelease: true,
}

Functions

func DownloadAndUnzipVSCode

func DownloadAndUnzipVSCode()

func EnvRELAY

func EnvRELAY(s string) string

func Run

func Run(args []string) error

Types

type BuiltinExtension

type BuiltinExtension = any

type ColorScheme

type ColorScheme struct {
	ThemeType string            `json:"themeType"` // "dark" | "light" | "hcLight" | "hcDark"
	Colors    map[string]string `json:"colors,omitempty"`
}

type GalleryExtensionInfo

type GalleryExtensionInfo struct {
	ID                 string `json:"id"`
	PreRelease         bool   `json:"preRelease,omitempty"`
	MigrateStorageFrom string `json:"migrateStorageFrom,omitempty"`
}

type URIComponents

type URIComponents struct {
	Scheme    string `json:"scheme"`
	Authority string `json:"authority,omitempty"`
	Path      string `json:"path,omitempty"`
	Query     string `json:"query,omitempty"`
	Fragment  string `json:"fragment,omitempty"`
}

type Workbench

type Workbench struct {
	ProductConfiguration        product.Configuration `json:"productConfiguration"`
	AdditionalBuiltinExtensions []BuiltinExtension    `json:"additionalBuiltinExtensions,omitempty"`
	FolderURI                   *URIComponents        `json:"folderUri,omitempty"`
	InitialColorTheme           ColorScheme           `json:"initialColorTheme,omitempty"`

	FS fs.FS `json:"-"`
}

func (*Workbench) GetFS

func (wb *Workbench) GetFS() fs.FS

func (*Workbench) ServeHTTP

func (wb *Workbench) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
cmd
codigo command
The product package provides data structures to configure a VSCode product.
The product package provides data structures to configure a VSCode product.

Jump to

Keyboard shortcuts

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