Explorar o código

wip: vscode extension

Frank hai 7 meses
pai
achega
80b17dab44

+ 7 - 2
packages/tui/internal/components/commands/commands.go

@@ -2,6 +2,7 @@ package commands
 
 
 import (
 import (
 	"fmt"
 	"fmt"
+	"runtime"
 	"strings"
 	"strings"
 
 
 	tea "github.com/charmbracelet/bubbletea/v2"
 	tea "github.com/charmbracelet/bubbletea/v2"
@@ -76,6 +77,10 @@ func (c *commandsComponent) View() string {
 	}
 	}
 
 
 	if c.showVscode {
 	if c.showVscode {
+		ctrlKey := "ctrl"
+		if runtime.GOOS == "darwin" {
+			ctrlKey = "cmd"
+		}
 		commandsToShow = append(commandsToShow,
 		commandsToShow = append(commandsToShow,
 			// empty line
 			// empty line
 			commands.Command{
 			commands.Command{
@@ -86,14 +91,14 @@ func (c *commandsComponent) View() string {
 				Name:        commands.CommandName(util.Ide()),
 				Name:        commands.CommandName(util.Ide()),
 				Description: "open opencode",
 				Description: "open opencode",
 				Keybindings: []commands.Keybinding{
 				Keybindings: []commands.Keybinding{
-					{Key: "cmd+esc", RequiresLeader: false},
+					{Key: ctrlKey + "+esc", RequiresLeader: false},
 				},
 				},
 			},
 			},
 			commands.Command{
 			commands.Command{
 				Name:        commands.CommandName(util.Ide()),
 				Name:        commands.CommandName(util.Ide()),
 				Description: "reference file",
 				Description: "reference file",
 				Keybindings: []commands.Keybinding{
 				Keybindings: []commands.Keybinding{
-					{Key: "cmd+opt+k", RequiresLeader: false},
+					{Key: ctrlKey + "+opt+k", RequiresLeader: false},
 				},
 				},
 			},
 			},
 		)
 		)

+ 6 - 2
sdks/vscode/package.json

@@ -51,13 +51,17 @@
         "command": "opencode.openTerminal",
         "command": "opencode.openTerminal",
         "title": "Run opencode",
         "title": "Run opencode",
         "key": "cmd+escape",
         "key": "cmd+escape",
-        "mac": "cmd+escape"
+        "mac": "cmd+escape",
+        "win": "ctrl+escape",
+        "linux": "ctrl+escape"
       },
       },
       {
       {
         "command": "opencode.addFilepathToTerminal",
         "command": "opencode.addFilepathToTerminal",
         "title": "opencode: Insert At-Mentioned",
         "title": "opencode: Insert At-Mentioned",
         "key": "cmd+alt+k",
         "key": "cmd+alt+k",
-        "mac": "cmd+alt+k"
+        "mac": "cmd+alt+k",
+        "win": "ctrl+alt+K",
+        "linux": "ctrl+alt+K"
       }
       }
     ]
     ]
   },
   },