Просмотр исходного кода

ignore: fix typos and formatting (#294)

Márk Magyar 8 месяцев назад
Родитель
Сommit
333569bed3

+ 1 - 1
packages/opencode/src/tool/edit.ts

@@ -22,7 +22,7 @@ export const EditTool = Tool.define({
     replaceAll: z
       .boolean()
       .optional()
-      .describe("Replace all occurences of old_string (default false)"),
+      .describe("Replace all occurrences of old_string (default false)"),
   }),
   async execute(params, ctx) {
     if (!params.filePath) {

+ 1 - 1
packages/opencode/src/tool/multiedit.txt

@@ -10,7 +10,7 @@ To make multiple file edits, provide the following:
 2. edits: An array of edit operations to perform, where each edit contains:
    - old_string: The text to replace (must match the file contents exactly, including all whitespace and indentation)
    - new_string: The edited text to replace the old_string
-   - replace_all: Replace all occurences of old_string. This parameter is optional and defaults to false.
+   - replace_all: Replace all occurrences of old_string. This parameter is optional and defaults to false.
 
 IMPORTANT:
 - All edits are applied in sequence, in the order they are provided

+ 1 - 1
packages/tui/internal/app/app.go

@@ -44,7 +44,7 @@ type SendMsg struct {
 	Text        string
 	Attachments []Attachment
 }
-type CompletionDialogTriggerdMsg struct {
+type CompletionDialogTriggeredMsg struct {
 	InitialValue string
 }
 

+ 1 - 1
packages/tui/internal/components/dialog/complete.go

@@ -116,7 +116,7 @@ func (c *completionDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 	switch msg := msg.(type) {
 	case []CompletionItemI:
 		c.list.SetItems(msg)
-	case app.CompletionDialogTriggerdMsg:
+	case app.CompletionDialogTriggeredMsg:
 		c.pseudoSearchTextArea.SetValue(msg.InitialValue)
 	case tea.KeyMsg:
 		if c.pseudoSearchTextArea.Focused() {

+ 1 - 4
packages/tui/internal/image/clipboard_unix.go

@@ -5,8 +5,8 @@ package image
 import (
 	"bytes"
 	"fmt"
-	"image"
 	"github.com/atotto/clipboard"
+	"image"
 )
 
 func GetImageFromClipboard() ([]byte, string, error) {
@@ -28,8 +28,6 @@ func GetImageFromClipboard() ([]byte, string, error) {
 
 }
 
-
-
 func binaryToImage(data []byte) ([]byte, error) {
 	reader := bytes.NewReader(data)
 	img, _, err := image.Decode(reader)
@@ -40,7 +38,6 @@ func binaryToImage(data []byte) ([]byte, error) {
 	return ImageToBytes(img)
 }
 
-
 func min(a, b int) int {
 	if a < b {
 		return a

+ 19 - 19
packages/tui/internal/layout/overlay.go

@@ -109,11 +109,11 @@ func PlaceOverlay(
 			// Get the foreground line
 			fgLine := fgLines[i-y]
 			fgLineWidth := ansi.PrintableRuneWidth(fgLine)
-			
+
 			// Extract the styles at the border positions
 			leftStyle := getStyleAtPosition(bgLine, pos)
-			rightStyle := getStyleAtPosition(bgLine, pos + 1 + fgLineWidth)
-			
+			rightStyle := getStyleAtPosition(bgLine, pos+1+fgLineWidth)
+
 			// Left border - combine background from original with border foreground
 			leftSeq := combineStyles(leftStyle, options.borderColor)
 			if leftSeq != "" {
@@ -172,17 +172,17 @@ type ansiStyle struct {
 // parseANSISequence parses an ANSI escape sequence into its components
 func parseANSISequence(seq string) ansiStyle {
 	style := ansiStyle{}
-	
+
 	// Extract the parameters from the sequence (e.g., \x1b[38;5;123;48;5;456m -> "38;5;123;48;5;456")
 	if !strings.HasPrefix(seq, "\x1b[") || !strings.HasSuffix(seq, "m") {
 		return style
 	}
-	
+
 	params := seq[2 : len(seq)-1]
 	if params == "" {
 		return style
 	}
-	
+
 	parts := strings.Split(params, ";")
 	i := 0
 	for i < len(parts) {
@@ -222,7 +222,7 @@ func parseANSISequence(seq string) ansiStyle {
 		}
 		i++
 	}
-	
+
 	return style
 }
 
@@ -231,32 +231,32 @@ func combineStyles(bgStyle ansiStyle, fgColor *compat.AdaptiveColor) string {
 	if fgColor == nil && bgStyle.bgColor == "" && len(bgStyle.attrs) == 0 {
 		return ""
 	}
-	
+
 	var parts []string
-	
+
 	// Add attributes
 	parts = append(parts, bgStyle.attrs...)
-	
+
 	// Add background color from the original style
 	if bgStyle.bgColor != "" {
 		parts = append(parts, bgStyle.bgColor)
 	}
-	
+
 	// Add foreground color if specified
 	if fgColor != nil {
 		// Use the light color (could be improved to detect terminal background)
 		color := (*fgColor).Light
-		
+
 		// Use RGBA to get color components
 		r, g, b, _ := color.RGBA()
 		// RGBA returns 16-bit values, we need 8-bit
 		parts = append(parts, fmt.Sprintf("38;2;%d;%d;%d", r>>8, g>>8, b>>8))
 	}
-	
+
 	if len(parts) == 0 {
 		return ""
 	}
-	
+
 	return fmt.Sprintf("\x1b[%sm", strings.Join(parts, ";"))
 }
 
@@ -264,10 +264,10 @@ func combineStyles(bgStyle ansiStyle, fgColor *compat.AdaptiveColor) string {
 func getStyleAtPosition(s string, targetPos int) ansiStyle {
 	// ANSI escape sequence regex
 	ansiRegex := regexp.MustCompile(`\x1b\[[0-9;]*m`)
-	
+
 	visualPos := 0
 	currentStyle := ansiStyle{}
-	
+
 	i := 0
 	for i < len(s) && visualPos <= targetPos {
 		// Check if we're at an ANSI escape sequence
@@ -275,7 +275,7 @@ func getStyleAtPosition(s string, targetPos int) ansiStyle {
 			// Found an ANSI sequence at current position
 			seq := s[i : i+match[1]]
 			parsedStyle := parseANSISequence(seq)
-			
+
 			// Update current style (merge with existing)
 			if parsedStyle.fgColor != "" {
 				currentStyle.fgColor = parsedStyle.fgColor
@@ -286,7 +286,7 @@ func getStyleAtPosition(s string, targetPos int) ansiStyle {
 			if len(parsedStyle.attrs) > 0 {
 				currentStyle.attrs = parsedStyle.attrs
 			}
-			
+
 			i += match[1]
 		} else if i < len(s) {
 			// Regular character
@@ -298,7 +298,7 @@ func getStyleAtPosition(s string, targetPos int) ansiStyle {
 			visualPos++
 		}
 	}
-	
+
 	return currentStyle
 }
 

+ 0 - 1
packages/tui/internal/theme/loader_test.go

@@ -133,4 +133,3 @@ func TestLoadThemesFromDirectories(t *testing.T) {
 		t.Error("Override theme not properly loaded")
 	}
 }
-

+ 2 - 2
packages/tui/internal/tui/tui.go

@@ -117,7 +117,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 			}
 
 			updated, cmd := a.completions.Update(
-				app.CompletionDialogTriggerdMsg{
+				app.CompletionDialogTriggeredMsg{
 					InitialValue: initialValue,
 				},
 			)
@@ -178,7 +178,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 		}
 
 		// 7. Fallback to editor. This is for other characters
-		// likek backspace, tab, etc.
+		// like backspace, tab, etc.
 		updatedEditor, cmd := a.editor.Update(msg)
 		a.editor = updatedEditor.(chat.EditorComponent)
 		return a, cmd

+ 1 - 1
packages/tui/pkg/client/generated-client.go

@@ -603,7 +603,7 @@ func (a *MessageInfo_Metadata_Tool_AdditionalProperties) UnmarshalJSON(b []byte)
 			var fieldVal interface{}
 			err := json.Unmarshal(fieldBuf, &fieldVal)
 			if err != nil {
-				return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err)
+				return fmt.Errorf("error unmarshalling field %s: %w", fieldName, err)
 			}
 			a.AdditionalProperties[fieldName] = fieldVal
 		}

+ 2 - 2
packages/web/src/components/Share.tsx

@@ -444,7 +444,7 @@ function MarkdownPart(props: MarkdownPartProps) {
       {...rest}
     >
       <MarkdownView
-        data-elment-markdown
+        data-element-markdown
         markdown={local.text}
         ref={(el) => (divEl = el)}
       />
@@ -726,7 +726,7 @@ export default function Share(props: {
     for (let i = 0; i < messages().length; i++) {
       const msg = messages()[i]
 
-      // TODO: Cleaup
+      // TODO: Cleanup
       // const system = result.messages.length === 0 && msg.role === "system"
       const assistant = msg.metadata?.assistant
 

+ 2 - 2
packages/web/src/components/share.module.css

@@ -659,12 +659,12 @@
   }
 
   &[data-expanded="true"] {
-    [data-elment-markdown] {
+    [data-element-markdown] {
       display: block;
     }
   }
   &[data-expanded="false"] {
-    [data-elment-markdown] {
+    [data-element-markdown] {
       display: -webkit-box;
       -webkit-box-orient: vertical;
       -webkit-line-clamp: 3;