Detailed changes
@@ -25,7 +25,7 @@ func (app *App) initLSPClients(ctx context.Context) {
func (app *App) createAndStartLSPClient(ctx context.Context, name string, command string, args ...string) {
// Create a specific context for initialization with a timeout
logging.Info("Creating LSP client", "name", name, "command", command, "args", args)
-
+
// Create the LSP client
lspClient, err := lsp.NewClient(ctx, command, args...)
if err != nil {
@@ -36,7 +36,7 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, comman
// Create a longer timeout for initialization (some servers take time to start)
initCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
-
+
// Initialize with the initialization context
_, err = lspClient.InitializeLSPClient(initCtx, config.WorkingDirectory())
if err != nil {
@@ -57,13 +57,13 @@ func (app *App) createAndStartLSPClient(ctx context.Context, name string, comman
}
logging.Info("LSP client initialized", "name", name)
-
+
// Create a child context that can be canceled when the app is shutting down
watchCtx, cancelFunc := context.WithCancel(ctx)
-
+
// Create a context with the server name for better identification
watchCtx = context.WithValue(watchCtx, "serverName", name)
-
+
// Create the workspace watcher
workspaceWatcher := watcher.NewWorkspaceWatcher(lspClient)
@@ -58,4 +58,3 @@ func MarkProjectInitialized() error {
return nil
}
-
@@ -44,13 +44,13 @@ func createTestFiles(t *testing.T, tmpDir string, testFiles []string) {
for _, path := range testFiles {
fullPath := filepath.Join(tmpDir, path)
if path[len(path)-1] == '/' {
- err := os.MkdirAll(fullPath, 0755)
+ err := os.MkdirAll(fullPath, 0o755)
require.NoError(t, err)
} else {
dir := filepath.Dir(fullPath)
- err := os.MkdirAll(dir, 0755)
+ err := os.MkdirAll(dir, 0o755)
require.NoError(t, err)
- err = os.WriteFile(fullPath, []byte(path+": test content"), 0644)
+ err = os.WriteFile(fullPath, []byte(path+": test content"), 0o644)
require.NoError(t, err)
}
}
@@ -16,7 +16,6 @@ type azureClient struct {
type AzureClient ProviderClient
func newAzureClient(opts providerClientOptions) AzureClient {
-
endpoint := os.Getenv("AZURE_OPENAI_ENDPOINT") // ex: https://foo.openai.azure.com
apiVersion := os.Getenv("AZURE_OPENAI_API_VERSION") // ex: 2025-04-01-preview
@@ -98,4 +98,3 @@ func (b *bedrockClient) stream(ctx context.Context, messages []message.Message,
return b.childProvider.stream(ctx, messages, tools)
}
-
@@ -56,14 +56,14 @@ func TestLsTool_Run(t *testing.T) {
// Create directories
for _, dir := range testDirs {
dirPath := filepath.Join(tempDir, dir)
- err := os.MkdirAll(dirPath, 0755)
+ err := os.MkdirAll(dirPath, 0o755)
require.NoError(t, err)
}
// Create files
for _, file := range testFiles {
filePath := filepath.Join(tempDir, file)
- err := os.WriteFile(filePath, []byte("test content"), 0644)
+ err := os.WriteFile(filePath, []byte("test content"), 0o644)
require.NoError(t, err)
}
@@ -83,19 +83,19 @@ func TestLsTool_Run(t *testing.T) {
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
-
+
// Check that visible directories and files are included
assert.Contains(t, response.Content, "dir1")
assert.Contains(t, response.Content, "dir2")
assert.Contains(t, response.Content, "dir3")
assert.Contains(t, response.Content, "file1.txt")
assert.Contains(t, response.Content, "file2.txt")
-
+
// Check that hidden files and directories are not included
assert.NotContains(t, response.Content, ".hidden_dir")
assert.NotContains(t, response.Content, ".hidden_file.txt")
assert.NotContains(t, response.Content, ".hidden_root_file.txt")
-
+
// Check that __pycache__ is not included
assert.NotContains(t, response.Content, "__pycache__")
})
@@ -122,7 +122,7 @@ func TestLsTool_Run(t *testing.T) {
t.Run("handles empty path parameter", func(t *testing.T) {
// For this test, we need to mock the config.WorkingDirectory function
// Since we can't easily do that, we'll just check that the response doesn't contain an error message
-
+
tool := NewLsTool()
params := LSParams{
Path: "",
@@ -138,7 +138,7 @@ func TestLsTool_Run(t *testing.T) {
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
-
+
// The response should either contain a valid directory listing or an error
// We'll just check that it's not empty
assert.NotEmpty(t, response.Content)
@@ -173,11 +173,11 @@ func TestLsTool_Run(t *testing.T) {
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
-
+
// The output format is a tree, so we need to check for specific patterns
// Check that file1.txt is not directly mentioned
assert.NotContains(t, response.Content, "- file1.txt")
-
+
// Check that dir1/ is not directly mentioned
assert.NotContains(t, response.Content, "- dir1/")
})
@@ -189,12 +189,12 @@ func TestLsTool_Run(t *testing.T) {
defer func() {
os.Chdir(origWd)
}()
-
+
// Change to a directory above the temp directory
parentDir := filepath.Dir(tempDir)
err = os.Chdir(parentDir)
require.NoError(t, err)
-
+
tool := NewLsTool()
params := LSParams{
Path: filepath.Base(tempDir),
@@ -210,7 +210,7 @@ func TestLsTool_Run(t *testing.T) {
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
-
+
// Should list the temp directory contents
assert.Contains(t, response.Content, "dir1")
assert.Contains(t, response.Content, "file1.txt")
@@ -291,22 +291,22 @@ func TestCreateFileTree(t *testing.T) {
}
tree := createFileTree(paths)
-
+
// Check the structure of the tree
assert.Len(t, tree, 1) // Should have one root node
-
+
// Check the root node
rootNode := tree[0]
assert.Equal(t, "path", rootNode.Name)
assert.Equal(t, "directory", rootNode.Type)
assert.Len(t, rootNode.Children, 1)
-
+
// Check the "to" node
toNode := rootNode.Children[0]
assert.Equal(t, "to", toNode.Name)
assert.Equal(t, "directory", toNode.Type)
assert.Len(t, toNode.Children, 3) // file1.txt, dir1, dir2
-
+
// Find the dir1 node
var dir1Node *TreeNode
for _, child := range toNode.Children {
@@ -315,7 +315,7 @@ func TestCreateFileTree(t *testing.T) {
break
}
}
-
+
require.NotNil(t, dir1Node)
assert.Equal(t, "directory", dir1Node.Type)
assert.Len(t, dir1Node.Children, 2) // file2.txt and subdir
@@ -354,9 +354,9 @@ func TestPrintTree(t *testing.T) {
Type: "file",
},
}
-
+
result := printTree(tree, "/root")
-
+
// Check the output format
assert.Contains(t, result, "- /root/")
assert.Contains(t, result, " - dir1/")
@@ -390,14 +390,14 @@ func TestListDirectory(t *testing.T) {
// Create directories
for _, dir := range testDirs {
dirPath := filepath.Join(tempDir, dir)
- err := os.MkdirAll(dirPath, 0755)
+ err := os.MkdirAll(dirPath, 0o755)
require.NoError(t, err)
}
// Create files
for _, file := range testFiles {
filePath := filepath.Join(tempDir, file)
- err := os.WriteFile(filePath, []byte("test content"), 0644)
+ err := os.WriteFile(filePath, []byte("test content"), 0o644)
require.NoError(t, err)
}
@@ -405,7 +405,7 @@ func TestListDirectory(t *testing.T) {
files, truncated, err := listDirectory(tempDir, []string{}, 1000)
require.NoError(t, err)
assert.False(t, truncated)
-
+
// Check that visible files and directories are included
containsPath := func(paths []string, target string) bool {
targetPath := filepath.Join(tempDir, target)
@@ -416,12 +416,12 @@ func TestListDirectory(t *testing.T) {
}
return false
}
-
+
assert.True(t, containsPath(files, "dir1"))
assert.True(t, containsPath(files, "file1.txt"))
assert.True(t, containsPath(files, "file2.txt"))
assert.True(t, containsPath(files, "dir1/file3.txt"))
-
+
// Check that hidden files and directories are not included
assert.False(t, containsPath(files, ".hidden_dir"))
assert.False(t, containsPath(files, ".hidden_file.txt"))
@@ -438,12 +438,12 @@ func TestListDirectory(t *testing.T) {
files, truncated, err := listDirectory(tempDir, []string{"*.txt"}, 1000)
require.NoError(t, err)
assert.False(t, truncated)
-
+
// Check that no .txt files are included
for _, file := range files {
assert.False(t, strings.HasSuffix(file, ".txt"), "Found .txt file: %s", file)
}
-
+
// But directories should still be included
containsDir := false
for _, file := range files {
@@ -454,4 +454,4 @@ func TestListDirectory(t *testing.T) {
}
assert.True(t, containsDir)
})
-}
+}
@@ -61,23 +61,23 @@ func GetPersistentShell(workingDir string) *PersistentShell {
func newPersistentShell(cwd string) *PersistentShell {
// Get shell configuration from config
cfg := config.Get()
-
+
// Default to environment variable if config is not set or nil
var shellPath string
var shellArgs []string
-
+
if cfg != nil {
shellPath = cfg.Shell.Path
shellArgs = cfg.Shell.Args
}
-
+
if shellPath == "" {
shellPath = os.Getenv("SHELL")
if shellPath == "" {
shellPath = "/bin/bash"
}
}
-
+
// Default shell args
if len(shellArgs) == 0 {
shellArgs = []string{"-l"}
@@ -82,7 +82,7 @@ func loadCommandsFromDir(commandsDir string, prefix string) ([]Command, error) {
// Check if the commands directory exists
if _, err := os.Stat(commandsDir); os.IsNotExist(err) {
// Create the commands directory if it doesn't exist
- if err := os.MkdirAll(commandsDir, 0755); err != nil {
+ if err := os.MkdirAll(commandsDir, 0o755); err != nil {
return nil, fmt.Errorf("failed to create commands directory %s: %w", commandsDir, err)
}
// Return empty list since we just created the directory
@@ -171,7 +171,6 @@ func loadCommandsFromDir(commandsDir string, prefix string) ([]Command, error) {
commands = append(commands, command)
return nil
})
-
if err != nil {
return nil, fmt.Errorf("failed to load custom commands from %s: %w", commandsDir, err)
}
@@ -1,8 +1,8 @@
package dialog
import (
- "testing"
"regexp"
+ "testing"
)
func TestNamedArgPattern(t *testing.T) {
@@ -38,11 +38,11 @@ func TestNamedArgPattern(t *testing.T) {
for _, tc := range testCases {
matches := namedArgPattern.FindAllStringSubmatch(tc.input, -1)
-
+
// Extract unique argument names
argNames := make([]string, 0)
argMap := make(map[string]bool)
-
+
for _, match := range matches {
argName := match[1] // Group 1 is the name without $
if !argMap[argName] {
@@ -50,13 +50,13 @@ func TestNamedArgPattern(t *testing.T) {
argNames = append(argNames, argName)
}
}
-
+
// Check if we got the expected number of arguments
if len(argNames) != len(tc.expected) {
t.Errorf("Expected %d arguments, got %d for input: %s", len(tc.expected), len(argNames), tc.input)
continue
}
-
+
// Check if we got the expected argument names
for _, expectedArg := range tc.expected {
found := false
@@ -75,7 +75,7 @@ func TestNamedArgPattern(t *testing.T) {
func TestRegexPattern(t *testing.T) {
pattern := regexp.MustCompile(`\$([A-Z][A-Z0-9_]*)`)
-
+
validMatches := []string{
"$FOO",
"$BAR",
@@ -83,7 +83,7 @@ func TestRegexPattern(t *testing.T) {
"$BAZ123",
"$ARGUMENTS",
}
-
+
invalidMatches := []string{
"$foo",
"$1BAR",
@@ -91,16 +91,16 @@ func TestRegexPattern(t *testing.T) {
"FOO",
"$",
}
-
+
for _, valid := range validMatches {
if !pattern.MatchString(valid) {
t.Errorf("Expected %s to match, but it didn't", valid)
}
}
-
+
for _, invalid := range invalidMatches {
if pattern.MatchString(invalid) {
t.Errorf("Expected %s not to match, but it did", invalid)
}
}
-}
+}
@@ -103,4 +103,4 @@ func NewDraculaTheme() *DraculaTheme {
func init() {
// Register the Dracula theme with the theme manager
RegisterTheme("dracula", NewDraculaTheme())
-}
+}
@@ -7,20 +7,20 @@ import (
// Flexoki color palette constants
const (
// Base colors
- flexokiPaper = "#FFFCF0" // Paper (lightest)
- flexokiBase50 = "#F2F0E5" // bg-2 (light)
- flexokiBase100 = "#E6E4D9" // ui (light)
- flexokiBase150 = "#DAD8CE" // ui-2 (light)
- flexokiBase200 = "#CECDC3" // ui-3 (light)
- flexokiBase300 = "#B7B5AC" // tx-3 (light)
- flexokiBase500 = "#878580" // tx-2 (light)
- flexokiBase600 = "#6F6E69" // tx (light)
- flexokiBase700 = "#575653" // tx-3 (dark)
- flexokiBase800 = "#403E3C" // ui-3 (dark)
- flexokiBase850 = "#343331" // ui-2 (dark)
- flexokiBase900 = "#282726" // ui (dark)
- flexokiBase950 = "#1C1B1A" // bg-2 (dark)
- flexokiBlack = "#100F0F" // bg (darkest)
+ flexokiPaper = "#FFFCF0" // Paper (lightest)
+ flexokiBase50 = "#F2F0E5" // bg-2 (light)
+ flexokiBase100 = "#E6E4D9" // ui (light)
+ flexokiBase150 = "#DAD8CE" // ui-2 (light)
+ flexokiBase200 = "#CECDC3" // ui-3 (light)
+ flexokiBase300 = "#B7B5AC" // tx-3 (light)
+ flexokiBase500 = "#878580" // tx-2 (light)
+ flexokiBase600 = "#6F6E69" // tx (light)
+ flexokiBase700 = "#575653" // tx-3 (dark)
+ flexokiBase800 = "#403E3C" // ui-3 (dark)
+ flexokiBase850 = "#343331" // ui-2 (dark)
+ flexokiBase900 = "#282726" // ui (dark)
+ flexokiBase950 = "#1C1B1A" // bg-2 (dark)
+ flexokiBlack = "#100F0F" // bg (darkest)
// Accent colors - Light theme (600)
flexokiRed600 = "#AF3029"
@@ -86,11 +86,11 @@ func NewFlexokiDarkTheme() *FlexokiTheme {
theme.DiffHunkHeaderColor = lipgloss.Color(flexokiBase700)
theme.DiffHighlightAddedColor = lipgloss.Color(flexokiGreen400)
theme.DiffHighlightRemovedColor = lipgloss.Color(flexokiRed400)
- theme.DiffAddedBgColor = lipgloss.Color("#1D2419") // Darker green background
+ theme.DiffAddedBgColor = lipgloss.Color("#1D2419") // Darker green background
theme.DiffRemovedBgColor = lipgloss.Color("#241919") // Darker red background
theme.DiffContextBgColor = lipgloss.Color(flexokiBlack)
theme.DiffLineNumberColor = lipgloss.Color(flexokiBase700)
- theme.DiffAddedLineNumberBgColor = lipgloss.Color("#1A2017") // Slightly darker green
+ theme.DiffAddedLineNumberBgColor = lipgloss.Color("#1A2017") // Slightly darker green
theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#201717") // Slightly darker red
// Markdown colors
@@ -110,14 +110,14 @@ func NewFlexokiDarkTheme() *FlexokiTheme {
theme.MarkdownCodeBlockColor = lipgloss.Color(flexokiBase300)
// Syntax highlighting colors (based on Flexoki's mappings)
- theme.SyntaxCommentColor = lipgloss.Color(flexokiBase700) // tx-3
- theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen400) // gr
- theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange400) // or
- theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue400) // bl
- theme.SyntaxStringColor = lipgloss.Color(flexokiCyan400) // cy
- theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple400) // pu
- theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow400) // ye
- theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2
+ theme.SyntaxCommentColor = lipgloss.Color(flexokiBase700) // tx-3
+ theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen400) // gr
+ theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange400) // or
+ theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue400) // bl
+ theme.SyntaxStringColor = lipgloss.Color(flexokiCyan400) // cy
+ theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple400) // pu
+ theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow400) // ye
+ theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2
theme.SyntaxPunctuationColor = lipgloss.Color(flexokiBase500) // tx-2
return theme
@@ -160,11 +160,11 @@ func NewFlexokiLightTheme() *FlexokiTheme {
theme.DiffHunkHeaderColor = lipgloss.Color(flexokiBase500)
theme.DiffHighlightAddedColor = lipgloss.Color(flexokiGreen600)
theme.DiffHighlightRemovedColor = lipgloss.Color(flexokiRed600)
- theme.DiffAddedBgColor = lipgloss.Color("#EFF2E2") // Light green background
+ theme.DiffAddedBgColor = lipgloss.Color("#EFF2E2") // Light green background
theme.DiffRemovedBgColor = lipgloss.Color("#F2E2E2") // Light red background
theme.DiffContextBgColor = lipgloss.Color(flexokiPaper)
theme.DiffLineNumberColor = lipgloss.Color(flexokiBase500)
- theme.DiffAddedLineNumberBgColor = lipgloss.Color("#E5EBD9") // Light green
+ theme.DiffAddedLineNumberBgColor = lipgloss.Color("#E5EBD9") // Light green
theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#EBD9D9") // Light red
// Markdown colors
@@ -184,14 +184,14 @@ func NewFlexokiLightTheme() *FlexokiTheme {
theme.MarkdownCodeBlockColor = lipgloss.Color(flexokiBase600)
// Syntax highlighting colors (based on Flexoki's mappings)
- theme.SyntaxCommentColor = lipgloss.Color(flexokiBase300) // tx-3
- theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen600) // gr
- theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange600) // or
- theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue600) // bl
- theme.SyntaxStringColor = lipgloss.Color(flexokiCyan600) // cy
- theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple600) // pu
- theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow600) // ye
- theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2
+ theme.SyntaxCommentColor = lipgloss.Color(flexokiBase300) // tx-3
+ theme.SyntaxKeywordColor = lipgloss.Color(flexokiGreen600) // gr
+ theme.SyntaxFunctionColor = lipgloss.Color(flexokiOrange600) // or
+ theme.SyntaxVariableColor = lipgloss.Color(flexokiBlue600) // bl
+ theme.SyntaxStringColor = lipgloss.Color(flexokiCyan600) // cy
+ theme.SyntaxNumberColor = lipgloss.Color(flexokiPurple600) // pu
+ theme.SyntaxTypeColor = lipgloss.Color(flexokiYellow600) // ye
+ theme.SyntaxOperatorColor = lipgloss.Color(flexokiBase500) // tx-2
theme.SyntaxPunctuationColor = lipgloss.Color(flexokiBase500) // tx-2
return theme
@@ -201,4 +201,4 @@ func init() {
// Register the Flexoki themes with the theme manager
RegisterTheme("flexoki-dark", NewFlexokiDarkTheme())
RegisterTheme("flexoki-light", NewFlexokiLightTheme())
-}
+}
@@ -106,12 +106,12 @@ func NewGruvboxTheme() *GruvboxTheme {
theme.DiffHunkHeaderColor = lipgloss.Color(gruvboxDarkFg3)
theme.DiffHighlightAddedColor = lipgloss.Color(gruvboxDarkGreenBright)
theme.DiffHighlightRemovedColor = lipgloss.Color(gruvboxDarkRedBright)
- theme.DiffAddedBgColor = lipgloss.Color("#3C4C3C") // Darker green background
- theme.DiffRemovedBgColor = lipgloss.Color("#4C3C3C") // Darker red background
+ theme.DiffAddedBgColor = lipgloss.Color("#3C4C3C") // Darker green background
+ theme.DiffRemovedBgColor = lipgloss.Color("#4C3C3C") // Darker red background
theme.DiffContextBgColor = lipgloss.Color(gruvboxDarkBg0)
theme.DiffLineNumberColor = lipgloss.Color(gruvboxDarkFg4)
theme.DiffAddedLineNumberBgColor = lipgloss.Color("#32432F") // Slightly darker green
- theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#43322F") // Slightly darker red
+ theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#43322F") // Slightly darker red
// Markdown colors
theme.MarkdownTextColor = lipgloss.Color(gruvboxDarkFg1)
@@ -180,11 +180,11 @@ func NewGruvboxLightTheme() *GruvboxTheme {
theme.DiffHunkHeaderColor = lipgloss.Color(gruvboxLightFg3)
theme.DiffHighlightAddedColor = lipgloss.Color(gruvboxLightGreenBright)
theme.DiffHighlightRemovedColor = lipgloss.Color(gruvboxLightRedBright)
- theme.DiffAddedBgColor = lipgloss.Color("#E8F5E9") // Light green background
+ theme.DiffAddedBgColor = lipgloss.Color("#E8F5E9") // Light green background
theme.DiffRemovedBgColor = lipgloss.Color("#FFEBEE") // Light red background
theme.DiffContextBgColor = lipgloss.Color(gruvboxLightBg0)
theme.DiffLineNumberColor = lipgloss.Color(gruvboxLightFg4)
- theme.DiffAddedLineNumberBgColor = lipgloss.Color("#C8E6C9") // Light green
+ theme.DiffAddedLineNumberBgColor = lipgloss.Color("#C8E6C9") // Light green
theme.DiffRemovedLineNumberBgColor = lipgloss.Color("#FFCDD2") // Light red
// Markdown colors
@@ -221,4 +221,4 @@ func init() {
// Register the Gruvbox themes with the theme manager
RegisterTheme("gruvbox", NewGruvboxTheme())
RegisterTheme("gruvbox-light", NewGruvboxLightTheme())
-}
+}
@@ -192,4 +192,4 @@ func init() {
// Register the Monokai Pro themes with the theme manager
RegisterTheme("monokai", NewMonokaiProTheme())
RegisterTheme("monokai-light", NewMonokaiProLightTheme())
-}
+}
@@ -193,4 +193,4 @@ func init() {
// Register the One Dark and One Light themes with the theme manager
RegisterTheme("onedark", NewOneDarkTheme())
RegisterTheme("onelight", NewOneLightTheme())
-}
+}
@@ -7,7 +7,7 @@ import (
func TestThemeRegistration(t *testing.T) {
// Get list of available themes
availableThemes := AvailableThemes()
-
+
// Check if "catppuccin" theme is registered
catppuccinFound := false
for _, themeName := range availableThemes {
@@ -16,11 +16,11 @@ func TestThemeRegistration(t *testing.T) {
break
}
}
-
+
if !catppuccinFound {
t.Errorf("Catppuccin theme is not registered")
}
-
+
// Check if "gruvbox" theme is registered
gruvboxFound := false
for _, themeName := range availableThemes {
@@ -29,11 +29,11 @@ func TestThemeRegistration(t *testing.T) {
break
}
}
-
+
if !gruvboxFound {
t.Errorf("Gruvbox theme is not registered")
}
-
+
// Check if "monokai" theme is registered
monokaiFound := false
for _, themeName := range availableThemes {
@@ -42,48 +42,48 @@ func TestThemeRegistration(t *testing.T) {
break
}
}
-
+
if !monokaiFound {
t.Errorf("Monokai theme is not registered")
}
-
+
// Try to get the themes and make sure they're not nil
catppuccin := GetTheme("catppuccin")
if catppuccin == nil {
t.Errorf("Catppuccin theme is nil")
}
-
+
gruvbox := GetTheme("gruvbox")
if gruvbox == nil {
t.Errorf("Gruvbox theme is nil")
}
-
+
monokai := GetTheme("monokai")
if monokai == nil {
t.Errorf("Monokai theme is nil")
}
-
+
// Test switching theme
originalTheme := CurrentThemeName()
-
+
err := SetTheme("gruvbox")
if err != nil {
t.Errorf("Failed to set theme to gruvbox: %v", err)
}
-
+
if CurrentThemeName() != "gruvbox" {
t.Errorf("Theme not properly switched to gruvbox")
}
-
+
err = SetTheme("monokai")
if err != nil {
t.Errorf("Failed to set theme to monokai: %v", err)
}
-
+
if CurrentThemeName() != "monokai" {
t.Errorf("Theme not properly switched to monokai")
}
-
+
// Switch back to original theme
_ = SetTheme(originalTheme)
-}
+}
@@ -57,11 +57,11 @@ func NewTokyoNightTheme() *TokyoNightTheme {
theme.BorderDimColor = lipgloss.Color(darkSelection)
// Diff view colors
- theme.DiffAddedColor = lipgloss.Color("#4fd6be") // teal from palette
- theme.DiffRemovedColor = lipgloss.Color("#c53b53") // red1 from palette
- theme.DiffContextColor = lipgloss.Color("#828bb8") // fg_dark from palette
- theme.DiffHunkHeaderColor = lipgloss.Color("#828bb8") // fg_dark from palette
- theme.DiffHighlightAddedColor = lipgloss.Color("#b8db87") // git.add from palette
+ theme.DiffAddedColor = lipgloss.Color("#4fd6be") // teal from palette
+ theme.DiffRemovedColor = lipgloss.Color("#c53b53") // red1 from palette
+ theme.DiffContextColor = lipgloss.Color("#828bb8") // fg_dark from palette
+ theme.DiffHunkHeaderColor = lipgloss.Color("#828bb8") // fg_dark from palette
+ theme.DiffHighlightAddedColor = lipgloss.Color("#b8db87") // git.add from palette
theme.DiffHighlightRemovedColor = lipgloss.Color("#e26a75") // git.delete from palette
theme.DiffAddedBgColor = lipgloss.Color("#20303b")
theme.DiffRemovedBgColor = lipgloss.Color("#37222c")
@@ -193,4 +193,4 @@ func init() {
// Register the Tokyo Night themes with the theme manager
RegisterTheme("tokyonight", NewTokyoNightTheme())
RegisterTheme("tokyonight-day", NewTokyoNightDayTheme())
-}
+}
@@ -195,4 +195,4 @@ func init() {
// Register the Tron themes with the theme manager
RegisterTheme("tron", NewTronTheme())
RegisterTheme("tron-light", NewTronLightTheme())
-}
+}