Browse Source

Refactor out of utils

Saoud Rizwan 1 year ago
parent
commit
40f7942801

+ 4 - 3
src/core/ClaudeDev.ts

@@ -23,14 +23,15 @@ import { getApiMetrics } from "../shared/getApiMetrics"
 import { HistoryItem } from "../shared/HistoryItem"
 import { Tool, ToolName } from "../shared/Tool"
 import { ClaudeAskResponse } from "../shared/WebviewMessage"
-import { findLast, findLastIndex, formatContentBlockToMarkdown } from "../utils"
-import { truncateHalfConversation } from "../utils/context-management"
+import { findLast, findLastIndex } from "../utils/array"
+import { formatContentBlockToMarkdown } from "../integrations/misc/export-markdown"
+import { truncateHalfConversation } from "./sliding-window"
 import { extractTextFromFile } from "../integrations/misc/extract-text"
 import { regexSearchFiles } from "../services/ripgrep"
 import { parseMentions } from "./mentions/context-mentions"
 import { UrlContentFetcher } from "../services/browser/UrlContentFetcher"
 import { diagnosticsToProblemsString, getNewDiagnostics } from "../integrations/diagnostics"
-import { arePathsEqual } from "../utils/path-helpers"
+import { arePathsEqual } from "../utils/path"
 
 const SYSTEM_PROMPT = async (
 	supportsImages: boolean

+ 0 - 0
src/utils/context-management.ts → src/core/sliding-window/index.ts


+ 1 - 1
src/extension.ts

@@ -4,7 +4,7 @@ import * as vscode from "vscode"
 import { ClaudeDevProvider } from "./core/webview/ClaudeDevProvider"
 import delay from "delay"
 import { createClaudeDevAPI } from "./exports"
-import "./utils/path-helpers" // necessary to have access to String.prototype.toPosix
+import "./utils/path" // necessary to have access to String.prototype.toPosix
 
 /*
 Built using https://github.com/microsoft/vscode-webview-ui-toolkit

+ 1 - 1
src/integrations/misc/open-file.ts

@@ -1,7 +1,7 @@
 import * as path from "path"
 import * as os from "os"
 import * as vscode from "vscode"
-import { arePathsEqual } from "../../utils/path-helpers"
+import { arePathsEqual } from "../../utils/path"
 
 export async function openImage(dataUri: string) {
 	const matches = dataUri.match(/^data:image\/([a-zA-Z]+);base64,(.+)$/)

+ 1 - 1
src/services/glob/list-files.ts

@@ -1,7 +1,7 @@
 import { globby, Options } from "globby"
 import os from "os"
 import * as path from "path"
-import { arePathsEqual } from "../../utils/path-helpers"
+import { arePathsEqual } from "../../utils/path"
 
 export async function listFiles(dirPath: string, recursive: boolean, limit: number): Promise<[string[], boolean]> {
 	const absolutePath = path.resolve(dirPath)

+ 0 - 0
src/utils/array-helpers.ts → src/utils/array.ts


+ 0 - 5
src/utils/index.ts

@@ -1,5 +0,0 @@
-export * from "../core/webview/getNonce"
-export * from "../core/webview/getUri"
-export * from "../integrations/misc/process-images"
-export * from "../integrations/misc/export-markdown"
-export * from "./array-helpers"

+ 0 - 0
src/utils/path-helpers.ts → src/utils/path.ts