wip: vscode extension

This commit is contained in:
Frank
2025-07-22 11:21:26 -04:00
parent 99d6a28249
commit 01f8d3b05d
4 changed files with 65 additions and 131 deletions

View File

@@ -24,7 +24,6 @@ import (
cmdcomp "github.com/sst/opencode/internal/components/commands"
"github.com/sst/opencode/internal/components/dialog"
"github.com/sst/opencode/internal/components/fileviewer"
"github.com/sst/opencode/internal/components/ide"
"github.com/sst/opencode/internal/components/modal"
"github.com/sst/opencode/internal/components/status"
"github.com/sst/opencode/internal/components/toast"
@@ -654,14 +653,16 @@ func (a Model) home() string {
// Use limit of 4 for vscode, 6 for others
limit := 6
if os.Getenv("OPENCODE_CALLER") == "vscode" {
if util.IsVSCode() {
limit = 4
}
showVscode := util.IsVSCode()
commandsView := cmdcomp.New(
a.app,
cmdcomp.WithBackground(t.Background()),
cmdcomp.WithLimit(limit),
cmdcomp.WithVscode(showVscode),
)
cmds := lipgloss.PlaceHorizontal(
effectiveWidth,
@@ -670,19 +671,6 @@ func (a Model) home() string {
styles.WhitespaceStyle(t.Background()),
)
// Add VSCode shortcuts if in VSCode environment
var ideShortcuts string
if os.Getenv("OPENCODE_CALLER") == "vscode" {
ideView := ide.New()
ideView.SetBackgroundColor(t.Background())
ideShortcuts = lipgloss.PlaceHorizontal(
effectiveWidth,
lipgloss.Center,
ideView.View(),
styles.WhitespaceStyle(t.Background()),
)
}
lines := []string{}
lines = append(lines, "")
lines = append(lines, "")
@@ -690,10 +678,6 @@ func (a Model) home() string {
lines = append(lines, "")
lines = append(lines, "")
lines = append(lines, cmds)
if os.Getenv("OPENCODE_CALLER") == "vscode" {
lines = append(lines, "")
lines = append(lines, ideShortcuts)
}
lines = append(lines, "")
lines = append(lines, "")