mirror of
https://github.com/cline/cline.git
synced 2025-06-03 03:59:07 +00:00
Limit web-tree-sitter to max # of files to parse
This commit is contained in:
parent
d93a08af5d
commit
3fc300273d
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "claude-dev",
|
||||
"version": "1.0.64",
|
||||
"version": "1.0.65",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "claude-dev",
|
||||
"version": "1.0.64",
|
||||
"version": "1.0.65",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sdk": "^0.24.3",
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "claude-dev",
|
||||
"displayName": "Claude Dev",
|
||||
"description": "Autonomous software engineer right in your IDE, capable of reading/writing files, executing commands, and more with your permission every step of the way.",
|
||||
"version": "1.0.62",
|
||||
"version": "1.0.65",
|
||||
"icon": "icon.png",
|
||||
"engines": {
|
||||
"vscode": "^1.84.0"
|
||||
|
@ -3,16 +3,16 @@ import { globby } from "globby"
|
||||
import * as path from "path"
|
||||
import { LanguageParser, loadRequiredLanguageParsers } from "./languageParser"
|
||||
|
||||
// TODO: implement caching behavior to avoid having to keep analyzing project for new tasks.
|
||||
async function analyzeProject(dirPath: string): Promise<string> {
|
||||
let result = ""
|
||||
|
||||
// Get all files (not gitignored)
|
||||
const allFiles = await getAllProjectFiles(dirPath)
|
||||
|
||||
let result = `Project: ${path.basename(dirPath)} (${allFiles.length.toLocaleString()} files)\n\n`
|
||||
|
||||
// Separate files to parse and remaining files
|
||||
const { filesToParse, remainingFiles } = separateFiles(allFiles)
|
||||
|
||||
// Load only the necessary language parsers
|
||||
const languageParsers = await loadRequiredLanguageParsers(filesToParse)
|
||||
|
||||
// Parse specific files we have language parsers for
|
||||
@ -20,9 +20,6 @@ async function analyzeProject(dirPath: string): Promise<string> {
|
||||
for (const file of filesToParse) {
|
||||
const definitions = await parseFile(file, languageParsers)
|
||||
if (definitions) {
|
||||
if (!result) {
|
||||
result += "# Source code definitions:\n\n"
|
||||
}
|
||||
result += `${path.relative(dirPath, file)}\n${definitions}\n`
|
||||
} else {
|
||||
filesWithoutDefinitions.push(file)
|
||||
@ -30,7 +27,6 @@ async function analyzeProject(dirPath: string): Promise<string> {
|
||||
}
|
||||
|
||||
// List remaining files' paths
|
||||
result += "# Unparsed files:\n\n"
|
||||
filesWithoutDefinitions
|
||||
.concat(remainingFiles)
|
||||
.sort()
|
||||
@ -98,8 +94,8 @@ function separateFiles(allFiles: string[]): { filesToParse: string[]; remainingF
|
||||
"php",
|
||||
"swift",
|
||||
].map((e) => `.${e}`)
|
||||
const filesToParse = allFiles.filter((file) => extensions.includes(path.extname(file)))
|
||||
const remainingFiles = allFiles.filter((file) => !extensions.includes(path.extname(file)))
|
||||
const filesToParse = allFiles.filter((file) => extensions.includes(path.extname(file))).slice(0, 50) // 50 files max
|
||||
const remainingFiles = allFiles.filter((file) => !filesToParse.includes(file))
|
||||
return { filesToParse, remainingFiles }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user