@aiderdesk/tree-sitter-utils 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -0
- package/dist/cache-manager.d.ts +16 -0
- package/dist/cache-manager.d.ts.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/file-utils.d.ts +2 -0
- package/dist/file-utils.d.ts.map +1 -0
- package/dist/graph-builder.d.ts +13 -0
- package/dist/graph-builder.d.ts.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1070 -0
- package/dist/index.js.map +7 -0
- package/dist/language-detector.d.ts +5 -0
- package/dist/language-detector.d.ts.map +1 -0
- package/dist/logger.d.ts +11 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/pagerank.d.ts +7 -0
- package/dist/pagerank.d.ts.map +1 -0
- package/dist/symbol-extractor.d.ts +14 -0
- package/dist/symbol-extractor.d.ts.map +1 -0
- package/dist/tree-renderer.d.ts +9 -0
- package/dist/tree-renderer.d.ts.map +1 -0
- package/dist/tree-sitter-analyzer.d.ts +16 -0
- package/dist/tree-sitter-analyzer.d.ts.map +1 -0
- package/dist/tree-sitter-parser.d.ts +13 -0
- package/dist/tree-sitter-parser.d.ts.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/wasm-downloader.d.ts +7 -0
- package/dist/wasm-downloader.d.ts.map +1 -0
- package/package.json +62 -0
- package/resources/queries/c-tags.scm +9 -0
- package/resources/queries/c_sharp-tags.scm +46 -0
- package/resources/queries/cpp-tags.scm +15 -0
- package/resources/queries/dart-tags.scm +91 -0
- package/resources/queries/elisp-tags.scm +8 -0
- package/resources/queries/elixir-tags.scm +54 -0
- package/resources/queries/elm-tags.scm +19 -0
- package/resources/queries/fortran-tags.scm +15 -0
- package/resources/queries/go-tags.scm +30 -0
- package/resources/queries/haskell-tags.scm +3 -0
- package/resources/queries/hcl-tags.scm +77 -0
- package/resources/queries/java-tags.scm +20 -0
- package/resources/queries/javascript-tags.scm +94 -0
- package/resources/queries/julia-tags.scm +60 -0
- package/resources/queries/kotlin-tags.scm +27 -0
- package/resources/queries/matlab-tags.scm +10 -0
- package/resources/queries/ocaml-tags.scm +115 -0
- package/resources/queries/ocaml_interface-tags.scm +98 -0
- package/resources/queries/php-tags.scm +26 -0
- package/resources/queries/python-tags.scm +12 -0
- package/resources/queries/ql-tags.scm +26 -0
- package/resources/queries/ruby-tags.scm +64 -0
- package/resources/queries/rust-tags.scm +60 -0
- package/resources/queries/scala-tags.scm +65 -0
- package/resources/queries/tsx-tags.scm +51 -0
- package/resources/queries/typescript-tags.scm +61 -0
- package/resources/queries/zig-tags.scm +3 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/language-detector.ts", "../src/index.ts", "../src/tree-sitter-parser.ts", "../src/wasm-downloader.ts", "../src/logger.ts", "../src/constants.ts", "../src/symbol-extractor.ts", "../src/graph-builder.ts", "../src/pagerank.ts", "../src/tree-renderer.ts", "../src/cache-manager.ts", "../src/file-utils.ts", "../src/tree-sitter-analyzer.ts"],
|
|
4
|
+
"sourcesContent": ["import * as path from 'path';\n\nconst LANGUAGE_MAP: Record<string, string> = {\n '.py': 'python',\n '.js': 'javascript',\n '.jsx': 'javascript',\n '.ts': 'typescript',\n '.tsx': 'tsx',\n '.mjs': 'javascript',\n '.cjs': 'javascript',\n '.java': 'java',\n '.go': 'go',\n '.rs': 'rust',\n '.c': 'c',\n '.cpp': 'cpp',\n '.cc': 'cpp',\n '.cxx': 'cpp',\n '.h': 'c',\n '.hpp': 'cpp',\n '.hxx': 'cpp',\n '.cs': 'c_sharp',\n '.dart': 'dart',\n '.hs': 'haskell',\n '.lhs': 'haskell',\n '.jl': 'julia',\n '.ml': 'ocaml',\n '.mli': 'ocaml_interface',\n '.php': 'php',\n '.rb': 'ruby',\n '.rake': 'ruby',\n '.gemspec': 'ruby',\n '.scala': 'scala',\n '.sc': 'scala',\n};\n\nexport function detectLanguage(filePath: string): string | null {\n const ext = path.extname(filePath).toLowerCase();\n return LANGUAGE_MAP[ext] || null;\n}\n\nexport function isLanguageSupported(filePath: string): boolean {\n return detectLanguage(filePath) !== null;\n}\n\nexport function getSupportedExtensions(): string[] {\n return Object.keys(LANGUAGE_MAP);\n}\n\nexport function getSupportedLanguages(): string[] {\n return [...new Set(Object.values(LANGUAGE_MAP))];\n}\n", "// Export types\nexport type { Tag, Symbol, RepoMapOptions, SymbolOptions, GraphEdge, RankedDefinition, ParseResult, LanguageConfig, Logger } from './types';\n\n// Export classes\nexport { TreeSitterAnalyzer } from './tree-sitter-analyzer';\nexport { TreeSitterParser } from './tree-sitter-parser';\nexport { SymbolExtractor } from './symbol-extractor';\nexport { GraphBuilder } from './graph-builder';\nexport { PageRankCalculator } from './pagerank';\nexport { TreeRenderer } from './tree-renderer';\nexport { CacheManager } from './cache-manager';\n\n// Export utilities\nexport { detectLanguage, isLanguageSupported, getSupportedExtensions, getSupportedLanguages } from './language-detector';\nexport { downloadWasmForLanguage, getLanguageWasmConfig, getSupportedLanguagesForWasm } from './wasm-downloader';\nexport { setLogger, getLogger } from './logger';\nexport { getAllFiles } from './file-utils';\n\n// Convenience functions\nimport { TreeSitterAnalyzer } from './tree-sitter-analyzer';\n\nlet defaultAnalyzer: TreeSitterAnalyzer | null = null;\n\nasync function getAnalyzer(): Promise<TreeSitterAnalyzer> {\n if (!defaultAnalyzer) {\n defaultAnalyzer = new TreeSitterAnalyzer();\n await defaultAnalyzer.initialize();\n }\n return defaultAnalyzer;\n}\n\n/**\n * Extract symbols from files\n * @param filePaths - Array of file paths to extract symbols from\n * @param options - Symbol extraction options\n * @returns Array of symbols\n */\nexport async function extractSymbols(filePaths: string[], options?: import('./types').SymbolOptions): Promise<import('./types').Symbol[]> {\n const analyzer = await getAnalyzer();\n return analyzer.extractSymbols(filePaths, options);\n}\n\n/**\n * Generate a repository map\n * @param root - Root directory of the repository\n * @param options - Repository map options\n * @returns Formatted repository map string\n */\nexport async function getRepoMap(root: string, options?: Omit<import('./types').RepoMapOptions, 'root'>): Promise<string> {\n const analyzer = await getAnalyzer();\n return analyzer.getRepoMap({ ...options, root });\n}\n", "import * as fs from 'fs/promises';\nimport * as path from 'path';\n\nimport { Parser, Language, Query } from 'web-tree-sitter';\n\nimport { Tag } from './types';\nimport { detectLanguage } from './language-detector';\nimport { downloadWasmForLanguage } from './wasm-downloader';\nimport { QUERIES_DIR } from './constants';\nimport logger from './logger';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SyntaxNode = any;\n\nexport class TreeSitterParser {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private parser: any = null;\n private languages: Map<string, Language> = new Map();\n private queries: Map<string, string> = new Map();\n private initialized = false;\n\n async initialize(): Promise<void> {\n if (this.initialized) {\n return;\n }\n\n try {\n await Parser.init();\n this.parser = new Parser();\n\n // Load queries\n try {\n const queryFiles = await fs.readdir(QUERIES_DIR);\n\n for (const file of queryFiles) {\n if (file.endsWith('-tags.scm')) {\n const language = file.replace('-tags.scm', '');\n const queryPath = path.join(QUERIES_DIR, file);\n const queryContent = await fs.readFile(queryPath, 'utf-8');\n this.queries.set(language, queryContent);\n }\n }\n } catch (error) {\n logger.warn('[TreeSitterParser] Could not load query files from resources:', error);\n }\n\n this.initialized = true;\n logger.info(`[TreeSitterParser] Initialized with ${this.queries.size} language queries`);\n } catch (error) {\n logger.error('[TreeSitterParser] Initialization failed:', error);\n throw error;\n }\n }\n\n private async loadLanguage(language: string): Promise<Language | null> {\n if (this.languages.has(language)) {\n return this.languages.get(language)!;\n }\n\n try {\n // Use on-demand WASM download\n const wasmBuffer = await downloadWasmForLanguage(language);\n if (!wasmBuffer) {\n return null;\n }\n\n const lang = await Language.load(wasmBuffer);\n this.languages.set(language, lang);\n return lang;\n } catch (error) {\n logger.error(`[TreeSitterParser] Failed to load language ${language}:`, error);\n return null;\n }\n }\n\n async parseFile(filePath: string, rootDir?: string): Promise<Tag[]> {\n if (!this.initialized || !this.parser) {\n await this.initialize();\n }\n\n if (!this.parser) {\n return [];\n }\n\n const language = detectLanguage(filePath);\n if (!language) {\n return [];\n }\n\n const lang = await this.loadLanguage(language);\n if (!lang) {\n return [];\n }\n\n const query = this.queries.get(language);\n if (!query) {\n return [];\n }\n\n try {\n const sourceCode = await fs.readFile(filePath, 'utf-8');\n\n this.parser.setLanguage(lang);\n const tree = this.parser.parse(sourceCode);\n\n if (!tree) {\n return [];\n }\n\n const tags = this.extractTags(tree.rootNode, query, filePath, lang, rootDir);\n return tags;\n } catch (error) {\n logger.error(`[TreeSitterParser] Error parsing file ${filePath}:`, error);\n return [];\n }\n }\n\n private extractTags(node: SyntaxNode, query: string, filePath: string, language: Language, rootDir?: string): Tag[] {\n const tags: Tag[] = [];\n\n try {\n const queryObj = new Query(language, query);\n const matches = queryObj.matches(node);\n\n logger.debug(`[TreeSitterParser] Found ${matches.length} matches in ${filePath}`);\n\n // Compute relative path if rootDir is provided\n const relFname = rootDir ? path.relative(rootDir, filePath) : filePath;\n\n for (const match of matches) {\n for (const capture of match.captures) {\n // Only process captures that contain the actual name (name.definition.* or name.reference.*)\n // Skip captures that are just markers for the entire definition (@definition.* or @reference.*)\n if (!capture.name.startsWith('name.')) {\n continue;\n }\n\n const name = capture.node.text;\n const kind = this.determineKind(capture.name);\n const line = capture.node.startPosition.row;\n\n logger.debug(`[TreeSitterParser] Found tag: ${name} (${kind}) at line ${line}`);\n\n tags.push({\n rel_fname: relFname,\n fname: filePath,\n line,\n name,\n kind,\n });\n }\n }\n } catch (error) {\n logger.error(`[TreeSitterParser] Error extracting tags from ${filePath}:`, error);\n }\n\n return tags;\n }\n\n private determineKind(captureName: string): 'def' | 'ref' {\n if (captureName.includes('definition')) {\n return 'def';\n }\n return 'ref';\n }\n}\n", "import * as fs from 'fs/promises';\nimport * as path from 'path';\nimport * as os from 'os';\n\nimport logger from './logger';\n\nconst LANGUAGE_WASM_MAP: Record<string, { url: string; file: string }> = {\n python: {\n url: 'https://unpkg.com/tree-sitter-python/tree-sitter-python.wasm',\n file: 'tree-sitter-python.wasm',\n },\n javascript: {\n url: 'https://unpkg.com/tree-sitter-javascript/tree-sitter-javascript.wasm',\n file: 'tree-sitter-javascript.wasm',\n },\n typescript: {\n url: 'https://unpkg.com/tree-sitter-typescript/tree-sitter-typescript.wasm',\n file: 'tree-sitter-typescript.wasm',\n },\n tsx: {\n url: 'https://unpkg.com/tree-sitter-typescript/tree-sitter-tsx.wasm',\n file: 'tree-sitter-tsx.wasm',\n },\n java: {\n url: 'https://unpkg.com/tree-sitter-java/tree-sitter-java.wasm',\n file: 'tree-sitter-java.wasm',\n },\n go: {\n url: 'https://unpkg.com/tree-sitter-go/tree-sitter-go.wasm',\n file: 'tree-sitter-go.wasm',\n },\n rust: {\n url: 'https://unpkg.com/tree-sitter-rust/tree-sitter-rust.wasm',\n file: 'tree-sitter-rust.wasm',\n },\n c: {\n url: 'https://unpkg.com/tree-sitter-c/tree-sitter-c.wasm',\n file: 'tree-sitter-c.wasm',\n },\n cpp: {\n url: 'https://unpkg.com/tree-sitter-cpp/tree-sitter-cpp.wasm',\n file: 'tree-sitter-cpp.wasm',\n },\n ruby: {\n url: 'https://unpkg.com/tree-sitter-ruby/tree-sitter-ruby.wasm',\n file: 'tree-sitter-ruby.wasm',\n },\n php: {\n url: 'https://unpkg.com/tree-sitter-php/tree-sitter-php.wasm',\n file: 'tree-sitter-php.wasm',\n },\n scala: {\n url: 'https://unpkg.com/tree-sitter-scala/tree-sitter-scala.wasm',\n file: 'tree-sitter-scala.wasm',\n },\n dart: {\n url: 'https://unpkg.com/tree-sitter-dart/tree-sitter-dart.wasm',\n file: 'tree-sitter-dart.wasm',\n },\n ocaml: {\n url: 'https://unpkg.com/tree-sitter-ocaml/tree-sitter-ocaml.wasm',\n file: 'tree-sitter-ocaml.wasm',\n },\n ocaml_interface: {\n url: 'https://unpkg.com/tree-sitter-ocaml/tree-sitter-ocaml_interface.wasm',\n file: 'tree-sitter-ocaml_interface.wasm',\n },\n c_sharp: {\n url: 'https://unpkg.com/tree-sitter-c-sharp/tree-sitter-c_sharp.wasm',\n file: 'tree-sitter-c_sharp.wasm',\n },\n haskell: {\n url: 'https://unpkg.com/tree-sitter-haskell/tree-sitter-haskell.wasm',\n file: 'tree-sitter-haskell.wasm',\n },\n julia: {\n url: 'https://unpkg.com/tree-sitter-julia/tree-sitter-julia.wasm',\n file: 'tree-sitter-julia.wasm',\n },\n};\n\nfunction getCacheDir(): string {\n const platform = os.platform();\n const homeDir = os.homedir();\n\n if (platform === 'darwin') {\n return path.join(homeDir, 'Library', 'Caches', 'aiderdesk', 'tree-sitter');\n } else if (platform === 'win32') {\n return path.join(process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming'), 'aiderdesk', 'tree-sitter');\n } else {\n return path.join(homeDir, '.cache', 'aiderdesk', 'tree-sitter');\n }\n}\n\nexport async function downloadWasmForLanguage(language: string): Promise<Buffer | null> {\n const config = LANGUAGE_WASM_MAP[language];\n if (!config) {\n logger.warn(`No WASM configuration for language: ${language}`);\n return null;\n }\n\n const cacheDir = getCacheDir();\n const wasmPath = path.join(cacheDir, 'wasm', config.file);\n\n try {\n // Try to load from cache first\n try {\n const buffer = await fs.readFile(wasmPath);\n logger.debug(`Loaded WASM for ${language} from cache: ${wasmPath}`);\n return buffer;\n } catch {\n // Not in cache, download it\n }\n\n // Download WASM file\n logger.info(`Downloading WASM for ${language} from ${config.url}`);\n\n const response = await fetch(config.url, { redirect: 'follow' });\n\n if (!response.ok) {\n throw new Error(`Failed to download ${language} WASM: ${response.status} ${response.statusText}`);\n }\n\n const buffer = Buffer.from(await response.arrayBuffer());\n\n // Save to cache\n await fs.mkdir(path.dirname(wasmPath), { recursive: true });\n await fs.writeFile(wasmPath, buffer);\n\n logger.info(`Downloaded and cached WASM for ${language} (${Math.round(buffer.byteLength / 1024)} KB)`);\n\n return buffer;\n } catch (error) {\n logger.error(`Failed to download WASM for ${language}:`, error);\n return null;\n }\n}\n\nexport function getLanguageWasmConfig(language: string): { url: string; file: string } | null {\n return LANGUAGE_WASM_MAP[language] || null;\n}\n\nexport function getSupportedLanguagesForWasm(): string[] {\n return Object.keys(LANGUAGE_WASM_MAP);\n}\n", "/* eslint-disable no-console */\n\nexport interface Logger {\n info: (message: string, ...args: unknown[]) => void;\n warn: (message: string, ...args: unknown[]) => void;\n error: (message: string, ...args: unknown[]) => void;\n debug: (message: string, ...args: unknown[]) => void;\n}\n\nconst defaultLogger: Logger = {\n info: (message: string, ...args: unknown[]) => console.log(`[TreeSitterUtils] ${message}`, ...args),\n warn: (message: string, ...args: unknown[]) => console.warn(`[TreeSitterUtils] ${message}`, ...args),\n error: (message: string, ...args: unknown[]) => console.error(`[TreeSitterUtils] ${message}`, ...args),\n debug: (message: string, ...args: unknown[]) => {\n if (process.env.DEBUG_TREE_SITTER) {\n console.debug(`[TreeSitterUtils] ${message}`, ...args);\n }\n },\n};\n\nlet currentLogger = defaultLogger;\n\nexport function setLogger(logger: Logger): void {\n currentLogger = logger;\n}\n\nexport function getLogger(): Logger {\n return currentLogger;\n}\n\nexport default currentLogger;\n", "import * as path from 'path';\nimport { fileURLToPath } from 'url';\n\n// Support both CommonJS and ESM\nconst getDirname = (): string => {\n // @ts-ignore - __dirname is defined in CommonJS\n if (typeof __dirname !== 'undefined') {\n // @ts-ignore\n return __dirname;\n }\n return path.dirname(fileURLToPath(import.meta.url));\n};\n\nconst dirName = getDirname();\n\nexport const RESOURCES_DIR = path.join(dirName, '..', 'resources');\nexport const QUERIES_DIR = path.join(RESOURCES_DIR, 'queries');\nexport const WASM_DIR = path.join(RESOURCES_DIR, 'wasm');\n", "import { Tag } from './types';\nimport { TreeSitterParser } from './tree-sitter-parser';\nimport { isLanguageSupported } from './language-detector';\nimport { CacheManager } from './cache-manager';\nimport logger from './logger';\n\nexport class SymbolExtractor {\n private cacheManager: CacheManager | null = null;\n\n constructor(private readonly parser: TreeSitterParser) {}\n\n setCacheManager(cacheManager: CacheManager): void {\n this.cacheManager = cacheManager;\n }\n\n async extractTags(files: string[], rootDir?: string): Promise<Tag[]> {\n const allTags: Tag[] = [];\n const supportedFiles = files.filter(isLanguageSupported);\n\n logger.info(`[SymbolExtractor] Extracting tags from ${supportedFiles.length} supported files out of ${files.length} total`);\n\n // Process files in parallel batches to avoid memory issues\n const batchSize = 50;\n for (let i = 0; i < supportedFiles.length; i += batchSize) {\n const batch = supportedFiles.slice(i, i + batchSize);\n const batchTags = await Promise.all(\n batch.map(async (file) => {\n try {\n // Check cache first\n if (this.cacheManager) {\n const currentMtime = await this.cacheManager.getFileMtime(file);\n\n if (currentMtime !== null) {\n const cached = await this.cacheManager.getFileCache(file);\n\n // Use cache if mtime matches\n if (cached && cached.mtime === currentMtime) {\n logger.debug(`[SymbolExtractor] Cache hit for ${file}`);\n // Update relative paths in cached tags if rootDir is provided\n if (rootDir) {\n const path = await import('path');\n const relPath = path.relative(rootDir, file);\n return cached.tags.map((tag) => ({ ...tag, rel_fname: relPath }));\n }\n return cached.tags;\n }\n\n // Parse file and update cache\n const tags = await this.parser.parseFile(file, rootDir);\n await this.cacheManager.setFileCache(file, currentMtime, tags);\n return tags;\n }\n }\n\n // Fallback to parsing without cache\n return await this.parser.parseFile(file, rootDir);\n } catch (error) {\n logger.error(`[SymbolExtractor] Error processing ${file}:`, error);\n return [];\n }\n }),\n );\n allTags.push(...batchTags.flat());\n }\n\n logger.info(`[SymbolExtractor] Extracted ${allTags.length} tags total`);\n return allTags;\n }\n\n filterDefinitions(tags: Tag[]): Tag[] {\n return tags.filter((tag) => tag.kind === 'def');\n }\n\n filterReferences(tags: Tag[]): Tag[] {\n return tags.filter((tag) => tag.kind === 'ref');\n }\n\n groupTagsByFile(tags: Tag[]): Map<string, Tag[]> {\n const grouped = new Map<string, Tag[]>();\n for (const tag of tags) {\n const fileTags = grouped.get(tag.rel_fname) || [];\n fileTags.push(tag);\n grouped.set(tag.rel_fname, fileTags);\n }\n return grouped;\n }\n}\n", "// @ts-ignore - graphology types are incomplete\nimport Graph from 'graphology';\n\nimport { Tag } from './types';\nimport logger from './logger';\n\nexport class GraphBuilder {\n buildDependencyGraph(tags: Tag[]): {\n graph: Graph;\n defines: Map<string, Set<string>>;\n references: Map<string, string[]>;\n } {\n const graph = new Graph({ type: 'directed', allowSelfLoops: false, multi: true });\n\n const defines = new Map<string, Set<string>>();\n const references = new Map<string, string[]>();\n const definitions = new Map<string, Tag[]>();\n\n // Build mappings\n for (const tag of tags) {\n if (tag.kind === 'def') {\n if (!defines.has(tag.name)) {\n defines.set(tag.name, new Set());\n }\n defines.get(tag.name)!.add(tag.rel_fname);\n\n const key = `${tag.rel_fname}:${tag.name}`;\n if (!definitions.has(key)) {\n definitions.set(key, []);\n }\n definitions.get(key)!.push(tag);\n } else if (tag.kind === 'ref') {\n if (!references.has(tag.name)) {\n references.set(tag.name, []);\n }\n references.get(tag.name)!.push(tag.rel_fname);\n }\n }\n\n // Build graph edges\n const idents = new Set(Array.from(defines.keys()).filter((k) => references.has(k)));\n\n for (const ident of Array.from(idents)) {\n const definers = Array.from(defines.get(ident) || []);\n const referencers = references.get(ident) || [];\n\n // Calculate weight multiplier\n let mul = 1.0;\n if (this.isSnakeCase(ident) || this.isKebabCase(ident) || this.isCamelCase(ident)) {\n mul *= 10;\n }\n if (ident.startsWith('_')) {\n mul *= 0.1;\n }\n if (definers.length > 5) {\n mul *= 0.1; // Very common symbol\n }\n\n // Count references per file\n const refCounts = new Map<string, number>();\n for (const ref of referencers) {\n refCounts.set(ref, (refCounts.get(ref) || 0) + 1);\n }\n\n // Add edges\n for (const referencer of referencers) {\n const numRefs = refCounts.get(referencer) || 1;\n const weight = mul * Math.sqrt(numRefs);\n\n for (const definer of definers) {\n if (referencer !== definer) {\n if (!graph.hasNode(referencer)) {\n graph.addNode(referencer);\n }\n if (!graph.hasNode(definer)) {\n graph.addNode(definer);\n }\n\n const edgeKey = `${referencer}->${definer}:${ident}`;\n if (!graph.hasEdge(edgeKey)) {\n graph.addEdgeWithKey(edgeKey, referencer, definer, { weight, ident });\n }\n }\n }\n }\n }\n\n logger.info(`[GraphBuilder] Built graph with ${graph.order} nodes and ${graph.size} edges`);\n\n return { graph, defines, references };\n }\n\n private isSnakeCase(str: string): boolean {\n return /^[a-z][a-z0-9_]*$/.test(str) && str.includes('_');\n }\n\n private isKebabCase(str: string): boolean {\n return /^[a-z][a-z0-9-]*$/.test(str) && str.includes('-');\n }\n\n private isCamelCase(str: string): boolean {\n return /^[a-z][a-zA-Z0-9]*$/.test(str) && /[A-Z]/.test(str);\n }\n}\n", "// @ts-ignore - graphology types are incomplete\nimport Graph from 'graphology';\n// @ts-ignore - graphology-metrics types are incomplete\nimport pagerank from 'graphology-metrics/centrality/pagerank';\n\nimport { RankedDefinition, Tag } from './types';\nimport logger from './logger';\n\nexport class PageRankCalculator {\n calculate(graph: Graph, tags: Tag[], mentionedFiles?: Set<string>, mentionedIdents?: Set<string>): RankedDefinition[] {\n if (graph.order === 0) {\n return [];\n }\n\n // Build personalization vector\n const personalization: Record<string, number> = {};\n const nodes = graph.nodes();\n const personalize = nodes.length > 0 ? 100 / nodes.length : 0;\n\n for (const node of nodes) {\n let score = 0;\n if (mentionedFiles?.has(node)) {\n score += personalize;\n }\n if (mentionedIdents) {\n // Check if any mentioned ident is defined in this file\n const fileTags = tags.filter((t) => t.rel_fname === node && t.kind === 'def');\n if (fileTags.some((t) => mentionedIdents.has(t.name))) {\n score += personalize;\n }\n }\n if (score > 0) {\n personalization[node] = score;\n }\n }\n\n try {\n // Calculate PageRank\n const pagerankOptions: Record<string, unknown> = {\n alpha: 0.85,\n maxIterations: 100,\n tolerance: 1e-6,\n };\n\n if (Object.keys(personalization).length > 0) {\n pagerankOptions.personalization = personalization;\n }\n\n const ranks = pagerank(graph, pagerankOptions as Parameters<typeof pagerank>[1]);\n\n // Distribute rank across definitions\n const rankedDefinitions: RankedDefinition[] = [];\n const definitions = tags.filter((t) => t.kind === 'def');\n\n for (const def of definitions) {\n const nodeRank = ranks[def.rel_fname] || 0;\n\n // Calculate edge contribution\n let edgeRank = nodeRank;\n if (graph.hasNode(def.rel_fname)) {\n graph.forEachOutboundEdge(def.rel_fname, (edge) => {\n const weight = graph.getEdgeAttribute(edge, 'weight') as number;\n const totalWeight = this.getTotalOutboundWeight(graph, def.rel_fname);\n if (totalWeight > 0) {\n edgeRank += nodeRank * (weight / totalWeight);\n }\n });\n }\n\n rankedDefinitions.push({\n rel_fname: def.rel_fname,\n name: def.name,\n rank: edgeRank,\n line: def.line,\n });\n }\n\n // Sort by rank\n rankedDefinitions.sort((a, b) => b.rank - a.rank);\n\n logger.info(`[PageRankCalculator] Calculated ranks for ${rankedDefinitions.length} definitions`);\n\n return rankedDefinitions;\n } catch (error) {\n logger.error('[PageRankCalculator] Error calculating PageRank:', error);\n return [];\n }\n }\n\n private getTotalOutboundWeight(graph: Graph, node: string): number {\n if (!graph.hasNode(node)) {\n return 0;\n }\n let total = 0;\n graph.forEachOutboundEdge(node, (edge) => {\n total += (graph.getEdgeAttribute(edge, 'weight') as number) || 1;\n });\n return total;\n }\n}\n", "import * as fs from 'fs/promises';\n\nimport { RankedDefinition } from './types';\nimport logger from './logger';\n\nexport class TreeRenderer {\n async render(rankedDefinitions: RankedDefinition[], chatFiles: Set<string>, maxLines?: number): Promise<string> {\n // Filter out chat files\n const filtered = rankedDefinitions.filter((def) => !chatFiles.has(def.rel_fname));\n\n // Group by file\n const byFile = new Map<string, RankedDefinition[]>();\n for (const def of filtered) {\n const fileDefs = byFile.get(def.rel_fname) || [];\n fileDefs.push(def);\n byFile.set(def.rel_fname, fileDefs);\n }\n\n // Sort files by highest rank in file\n const sortedFiles = Array.from(byFile.entries()).sort((a, b) => {\n const maxRankA = Math.max(...a[1].map((d) => d.rank));\n const maxRankB = Math.max(...b[1].map((d) => d.rank));\n return maxRankB - maxRankA;\n });\n\n const totalFiles = sortedFiles.length;\n\n // If no maxLines specified, render everything\n if (!maxLines) {\n return this.renderAllFiles(sortedFiles);\n }\n\n // If more files than maxLines, just list filenames\n if (totalFiles > maxLines) {\n return this.renderFileListOnly(sortedFiles, maxLines);\n }\n\n // Calculate lines per file (at least 2 lines per file: 1 for content + 1 for \"...\" if truncated)\n // Account for the filename line (1 line per file)\n const headerLines = totalFiles;\n const availableLines = maxLines - headerLines;\n const linesPerFile = Math.max(1, Math.floor(availableLines / totalFiles));\n\n return this.renderWithLineLimit(sortedFiles, linesPerFile);\n }\n\n private async renderAllFiles(sortedFiles: [string, RankedDefinition[]][]): Promise<string> {\n let output = '';\n for (const [file, definitions] of sortedFiles) {\n output += `\\n${file}:\\n`;\n\n // Sort definitions by line number\n definitions.sort((a, b) => a.line - b.line);\n\n // Get unique lines and render\n const lines = Array.from(new Set(definitions.map((d) => d.line)));\n const treeLines = await this.renderFileTree(file, lines, Infinity);\n output += treeLines;\n }\n\n return output.trim();\n }\n\n private renderFileListOnly(sortedFiles: [string, RankedDefinition[]][], maxLines: number): string {\n let output = '';\n const filesToShow = sortedFiles.slice(0, maxLines - 1); // Reserve 1 line for \"...\"\n\n for (const [file] of filesToShow) {\n output += `${file}\\n`;\n }\n\n if (sortedFiles.length > filesToShow.length) {\n output += '...\\n';\n }\n\n return output.trim();\n }\n\n private async renderWithLineLimit(sortedFiles: [string, RankedDefinition[]][], linesPerFile: number): Promise<string> {\n let output = '';\n\n for (const [file, definitions] of sortedFiles) {\n // Sort definitions by rank (highest first) then by line number\n definitions.sort((a, b) => {\n if (a.rank !== b.rank) {\n return b.rank - a.rank;\n }\n return a.line - b.line;\n });\n\n // Get unique lines, limited to linesPerFile\n const uniqueLines = Array.from(new Set(definitions.map((d) => d.line)));\n const limitedLines = uniqueLines.slice(0, linesPerFile);\n const isTruncated = uniqueLines.length > linesPerFile;\n\n output += `${file}:\\n`;\n\n const treeLines = await this.renderFileTree(file, limitedLines, linesPerFile, isTruncated);\n output += treeLines;\n }\n\n return output.trim();\n }\n\n private async renderFileTree(filePath: string, lines: number[], maxLines: number, isTruncated: boolean = false): Promise<string> {\n if (lines.length === 0) {\n return '';\n }\n\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n const fileLines = content.split('\\n');\n\n let output = '';\n const maxContentLines = isTruncated ? maxLines - 1 : maxLines;\n const linesToRender = lines.slice(0, maxContentLines);\n\n for (let i = 0; i < linesToRender.length; i++) {\n const lineNum = linesToRender[i];\n const lineContent = fileLines[lineNum]?.trim() || '';\n\n if (lineContent) {\n // Truncate long lines\n const truncated = lineContent.length > 100 ? lineContent.substring(0, 97) + '...' : lineContent;\n\n // Determine if this is the last line\n const isLast = i === linesToRender.length - 1 && !isTruncated;\n const prefix = isLast ? '\u2514\u2500\u2500 ' : '\u251C\u2500\u2500 ';\n output += `${prefix}${truncated}\\n`;\n }\n }\n\n // Add truncation indicator\n if (isTruncated) {\n output += '\u2514\u2500\u2500 ...\\n';\n }\n\n return output;\n } catch (error) {\n logger.error(`[TreeRenderer] Error reading file ${filePath}:`, error);\n return '';\n }\n }\n}\n", "import { DatabaseSync } from 'node:sqlite';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\nimport * as os from 'os';\n\nimport { Tag } from './types';\nimport logger from './logger';\n\nfunction getCacheDbPath(): string {\n const platform = os.platform();\n const homeDir = os.homedir();\n\n let cacheDir: string;\n if (platform === 'darwin') {\n cacheDir = path.join(homeDir, 'Library', 'Caches', 'aiderdesk', 'tree-sitter');\n } else if (platform === 'win32') {\n cacheDir = path.join(process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming'), 'aiderdesk', 'tree-sitter');\n } else {\n cacheDir = path.join(homeDir, '.cache', 'aiderdesk', 'tree-sitter');\n }\n\n return path.join(cacheDir, 'cache.db');\n}\n\nexport class CacheManager {\n private db: DatabaseSync | null = null;\n private dbPath: string;\n\n constructor(dbPath?: string) {\n this.dbPath = dbPath || getCacheDbPath();\n }\n\n async initialize(): Promise<void> {\n try {\n await fs.mkdir(path.dirname(this.dbPath), { recursive: true });\n this.db = new DatabaseSync(this.dbPath);\n\n const createTableSQL = `\n CREATE TABLE IF NOT EXISTS file_cache (\n file_path TEXT PRIMARY KEY,\n mtime INTEGER NOT NULL,\n tags TEXT NOT NULL,\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME DEFAULT CURRENT_TIMESTAMP\n )\n `;\n\n this.db.exec(createTableSQL);\n logger.info(`[CacheManager] Cache database initialized at ${this.dbPath}`);\n } catch (error) {\n logger.error('[CacheManager] Failed to initialize cache database:', error);\n this.db = null;\n }\n }\n\n async getFileCache(filePath: string): Promise<{ tags: Tag[]; mtime: number } | null> {\n if (!this.db) {\n return null;\n }\n\n try {\n const sql = 'SELECT mtime, tags FROM file_cache WHERE file_path = ?';\n const stmt = this.db.prepare(sql);\n const result = stmt.get(filePath) as { mtime: number; tags: string } | undefined;\n\n if (result) {\n const tags = JSON.parse(result.tags) as Tag[];\n return { tags, mtime: result.mtime };\n }\n\n return null;\n } catch (error) {\n logger.error(`[CacheManager] Failed to get cache for ${filePath}:`, error);\n return null;\n }\n }\n\n async setFileCache(filePath: string, mtime: number, tags: Tag[]): Promise<void> {\n if (!this.db) {\n return;\n }\n\n try {\n const sql = `\n INSERT INTO file_cache (file_path, mtime, tags, updated_at)\n VALUES (?, ?, ?, CURRENT_TIMESTAMP)\n ON CONFLICT(file_path) DO UPDATE SET\n mtime = excluded.mtime,\n tags = excluded.tags,\n updated_at = CURRENT_TIMESTAMP\n `;\n\n const stmt = this.db.prepare(sql);\n stmt.run(filePath, mtime, JSON.stringify(tags));\n logger.debug(`[CacheManager] Cached ${tags.length} tags for ${filePath}`);\n } catch (error) {\n logger.error(`[CacheManager] Failed to set cache for ${filePath}:`, error);\n }\n }\n\n async getFileMtime(filePath: string): Promise<number | null> {\n try {\n const stats = await fs.stat(filePath);\n return stats.mtimeMs;\n } catch (error) {\n logger.error(`[CacheManager] Failed to get mtime for ${filePath}:`, error);\n return null;\n }\n }\n\n async clearCache(): Promise<void> {\n if (!this.db) {\n return;\n }\n\n try {\n const sql = 'DELETE FROM file_cache';\n this.db.exec(sql);\n logger.info('[CacheManager] Cache cleared');\n } catch (error) {\n logger.error('[CacheManager] Failed to clear cache:', error);\n }\n }\n\n close(): void {\n if (this.db) {\n this.db.close();\n this.db = null;\n logger.info('[CacheManager] Cache database closed');\n }\n }\n}\n", "import * as path from 'path';\n\nimport { glob } from 'glob';\nimport { simpleGit } from 'simple-git';\n\nimport logger from './logger.js';\n\nconst DEFAULT_IGNORE_PATTERNS = [\n 'node_modules/**',\n '.git/**',\n 'dist/**',\n 'build/**',\n '.next/**',\n 'out/**',\n 'coverage/**',\n '*.min.js',\n '*.min.css',\n '.DS_Store',\n 'Thumbs.db',\n '*.log',\n '*.lock',\n 'package-lock.json',\n 'yarn.lock',\n 'pnpm-lock.yaml',\n];\n\nconst isGitRepository = async (baseDir: string): Promise<boolean> => {\n try {\n const git = simpleGit(baseDir);\n await git.revparse(['--git-dir']);\n return true;\n } catch {\n return false;\n }\n};\n\nconst getAllFilesFromGit = async (baseDir: string): Promise<string[]> => {\n try {\n const git = simpleGit(baseDir);\n const result = await git.raw(['ls-files', '-z']);\n const files = result.split('\\0').filter(Boolean);\n logger.debug(`Retrieved ${files.length} tracked files from Git`);\n // Return absolute paths\n return files.map((file) => path.resolve(baseDir, file));\n } catch (gitError) {\n logger.warn('Failed to get tracked files from Git, falling back to filesystem', gitError);\n return [];\n }\n};\n\nconst getAllFilesFromFS = async (baseDir: string, ignore: string[]): Promise<string[]> => {\n try {\n const pattern = path.join(baseDir, '**/*').replace(/\\\\/g, '/');\n const files = await glob(pattern, {\n nodir: true,\n absolute: true,\n dot: false,\n ignore,\n });\n\n logger.debug(`Retrieved ${files.length} files from filesystem`);\n return files;\n } catch (error) {\n logger.error('Failed to get files from filesystem:', error);\n return [];\n }\n};\n\nconst matchesPattern = (filePath: string, pattern: string): boolean => {\n // Convert glob pattern to regex for simple matching\n const regexPattern = pattern\n .replace(/\\*\\*/g, '<<DOUBLE_STAR>>')\n .replace(/\\*/g, '[^/]*')\n .replace(/<<DOUBLE_STAR>>/g, '.*')\n .replace(/\\?/g, '[^/]');\n const regex = new RegExp(regexPattern);\n return regex.test(filePath);\n};\n\nconst filterByExcludePatterns = (files: string[], excludePatterns: string[], baseDir: string): string[] => {\n return files.filter((file) => {\n const relative = path.relative(baseDir, file).replace(/\\\\/g, '/');\n return !excludePatterns.some((pattern) => matchesPattern(relative, pattern));\n });\n};\n\nexport const getAllFiles = async (baseDir: string, excludePatterns: string[] = []): Promise<string[]> => {\n const allIgnorePatterns = [...DEFAULT_IGNORE_PATTERNS, ...excludePatterns];\n\n try {\n // Try git first if it's a git repository\n if (await isGitRepository(baseDir)) {\n const gitFiles = await getAllFilesFromGit(baseDir);\n if (gitFiles.length > 0) {\n // Filter by exclude patterns\n return filterByExcludePatterns(gitFiles, excludePatterns, baseDir);\n }\n }\n\n // Fallback to filesystem scanning\n const fsFiles = await getAllFilesFromFS(baseDir, allIgnorePatterns);\n\n // Filter by exclude patterns\n return filterByExcludePatterns(fsFiles, excludePatterns, baseDir);\n } catch (error) {\n logger.error('Failed to get files:', error);\n return [];\n }\n};\n", "import { TreeSitterParser } from './tree-sitter-parser';\nimport { SymbolExtractor } from './symbol-extractor';\nimport { GraphBuilder } from './graph-builder';\nimport { PageRankCalculator } from './pagerank';\nimport { TreeRenderer } from './tree-renderer';\nimport { CacheManager } from './cache-manager';\nimport { getAllFiles } from './file-utils';\nimport { RepoMapOptions, SymbolOptions, Tag, Symbol, ParseResult } from './types';\nimport logger from './logger';\n\nexport class TreeSitterAnalyzer {\n private readonly parser: TreeSitterParser;\n private readonly symbolExtractor: SymbolExtractor;\n private readonly graphBuilder: GraphBuilder;\n private readonly pageRankCalculator: PageRankCalculator;\n private readonly treeRenderer: TreeRenderer;\n private readonly cacheManager: CacheManager;\n private initialized = false;\n\n constructor() {\n this.parser = new TreeSitterParser();\n this.cacheManager = new CacheManager();\n this.symbolExtractor = new SymbolExtractor(this.parser);\n this.symbolExtractor.setCacheManager(this.cacheManager);\n this.graphBuilder = new GraphBuilder();\n this.pageRankCalculator = new PageRankCalculator();\n this.treeRenderer = new TreeRenderer();\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) {\n return;\n }\n\n await this.parser.initialize();\n await this.cacheManager.initialize();\n this.initialized = true;\n logger.info('[TreeSitterAnalyzer] Initialized');\n }\n\n async getRepoMap(options: RepoMapOptions): Promise<string> {\n if (!this.initialized) {\n await this.initialize();\n }\n\n const { root, files, excludePatterns = [], mentionedFiles = new Set(), mentionedIdents = new Set(), chatFiles = new Set(), maxLines } = options;\n\n try {\n // Get files to process\n let filesToProcess: string[];\n if (files && files.length > 0) {\n filesToProcess = files;\n } else {\n filesToProcess = await getAllFiles(root, excludePatterns);\n }\n\n logger.info(`[TreeSitterAnalyzer] Processing ${filesToProcess.length} files for repository map`);\n\n // Extract tags from all files\n const tags = await this.symbolExtractor.extractTags(filesToProcess, root);\n\n if (tags.length === 0) {\n return '';\n }\n\n // Build dependency graph\n const { graph, defines: _defines, references: _references } = this.graphBuilder.buildDependencyGraph(tags);\n\n // Calculate PageRank\n const rankedDefinitions = this.pageRankCalculator.calculate(graph, tags, mentionedFiles, mentionedIdents);\n\n // Render tree\n const output = await this.treeRenderer.render(rankedDefinitions, chatFiles, maxLines);\n\n logger.info(`[TreeSitterAnalyzer] Generated repository map with ${rankedDefinitions.length} definitions`);\n\n return output;\n } catch (error) {\n logger.error('[TreeSitterAnalyzer] Error generating repository map:', error);\n return '';\n }\n }\n\n async extractSymbols(filePaths: string[], options?: SymbolOptions): Promise<Symbol[]> {\n if (!this.initialized) {\n await this.initialize();\n }\n\n const useCache = options?.useCache !== false;\n\n try {\n // Temporarily disable cache if requested\n const originalCacheManager = useCache ? this.cacheManager : null;\n if (!useCache) {\n this.symbolExtractor.setCacheManager(null as any);\n }\n\n const tags = await this.symbolExtractor.extractTags(filePaths, options?.rootDir);\n\n // Restore cache manager\n if (!useCache) {\n this.symbolExtractor.setCacheManager(this.cacheManager);\n }\n\n // Convert tags to symbols\n const symbols: Symbol[] = tags.map((tag) => ({\n name: tag.name,\n kind: tag.kind,\n line: tag.line,\n file: tag.fname,\n relativeFile: tag.rel_fname,\n }));\n\n logger.info(`[TreeSitterAnalyzer] Extracted ${symbols.length} symbols from ${filePaths.length} files`);\n\n return symbols;\n } catch (error) {\n logger.error('[TreeSitterAnalyzer] Error extracting symbols:', error);\n return [];\n }\n }\n\n async parseFile(filePath: string): Promise<ParseResult> {\n if (!this.initialized) {\n await this.initialize();\n }\n\n const { detectLanguage } = await import('./language-detector');\n const language = detectLanguage(filePath) || 'unknown';\n\n const tags = await this.parser.parseFile(filePath);\n\n return {\n tags,\n file: filePath,\n language,\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCO,SAAS,eAAe,UAAiC;AAC9D,QAAM,MAAW,aAAQ,QAAQ,EAAE,YAAY;AAC/C,SAAO,aAAa,GAAG,KAAK;AAC9B;AAEO,SAAS,oBAAoB,UAA2B;AAC7D,SAAO,eAAe,QAAQ,MAAM;AACtC;AAEO,SAAS,yBAAmC;AACjD,SAAO,OAAO,KAAK,YAAY;AACjC;AAEO,SAAS,wBAAkC;AAChD,SAAO,CAAC,GAAG,IAAI,IAAI,OAAO,OAAO,YAAY,CAAC,CAAC;AACjD;AAlDA,UAEM;AAFN;AAAA;AAAA;AAAA,WAAsB;AAEtB,IAAM,eAAuC;AAAA,MAC3C,OAAO;AAAA,MACP,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,QAAQ;AAAA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C,UAAM,OAAO,MAAM,KAAK,OAAO,UAAU,QAAQ;AAEjD,WAAO;AAAA,MACL;AAAA,MACA,MAAM;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACF;;;AX7HA;AAQA,IAAI,kBAA6C;AAEjD,eAAe,cAA2C;AACxD,MAAI,CAAC,iBAAiB;AACpB,sBAAkB,IAAI,mBAAmB;AACzC,UAAM,gBAAgB,WAAW;AAAA,EACnC;AACA,SAAO;AACT;AAQA,eAAsB,eAAe,WAAqB,SAAgF;AACxI,QAAM,WAAW,MAAM,YAAY;AACnC,SAAO,SAAS,eAAe,WAAW,OAAO;AACnD;AAQA,eAAsB,WAAW,MAAc,SAA2E;AACxH,QAAM,WAAW,MAAM,YAAY;AACnC,SAAO,SAAS,WAAW,EAAE,GAAG,SAAS,KAAK,CAAC;AACjD;",
|
|
6
|
+
"names": ["fs", "path", "path", "platform", "buffer", "path", "path", "Graph", "pagerank", "fs", "fs", "path", "os", "platform", "path", "relative", "detectLanguage"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function detectLanguage(filePath: string): string | null;
|
|
2
|
+
export declare function isLanguageSupported(filePath: string): boolean;
|
|
3
|
+
export declare function getSupportedExtensions(): string[];
|
|
4
|
+
export declare function getSupportedLanguages(): string[];
|
|
5
|
+
//# sourceMappingURL=language-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-detector.d.ts","sourceRoot":"","sources":["../src/language-detector.ts"],"names":[],"mappings":"AAmCA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG9D;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
3
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
4
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
5
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
6
|
+
}
|
|
7
|
+
declare let currentLogger: Logger;
|
|
8
|
+
export declare function setLogger(logger: Logger): void;
|
|
9
|
+
export declare function getLogger(): Logger;
|
|
10
|
+
export default currentLogger;
|
|
11
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACtD;AAaD,QAAA,IAAI,aAAa,QAAgB,CAAC;AAElC,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Graph from 'graphology';
|
|
2
|
+
import { RankedDefinition, Tag } from './types';
|
|
3
|
+
export declare class PageRankCalculator {
|
|
4
|
+
calculate(graph: Graph, tags: Tag[], mentionedFiles?: Set<string>, mentionedIdents?: Set<string>): RankedDefinition[];
|
|
5
|
+
private getTotalOutboundWeight;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=pagerank.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagerank.d.ts","sourceRoot":"","sources":["../src/pagerank.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAC;AAI/B,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAGhD,qBAAa,kBAAkB;IAC7B,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,gBAAgB,EAAE;IAgFrH,OAAO,CAAC,sBAAsB;CAU/B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tag } from './types';
|
|
2
|
+
import { TreeSitterParser } from './tree-sitter-parser';
|
|
3
|
+
import { CacheManager } from './cache-manager';
|
|
4
|
+
export declare class SymbolExtractor {
|
|
5
|
+
private readonly parser;
|
|
6
|
+
private cacheManager;
|
|
7
|
+
constructor(parser: TreeSitterParser);
|
|
8
|
+
setCacheManager(cacheManager: CacheManager): void;
|
|
9
|
+
extractTags(files: string[], rootDir?: string): Promise<Tag[]>;
|
|
10
|
+
filterDefinitions(tags: Tag[]): Tag[];
|
|
11
|
+
filterReferences(tags: Tag[]): Tag[];
|
|
12
|
+
groupTagsByFile(tags: Tag[]): Map<string, Tag[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=symbol-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-extractor.d.ts","sourceRoot":"","sources":["../src/symbol-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,qBAAa,eAAe;IAGd,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,YAAY,CAA6B;gBAEpB,MAAM,EAAE,gBAAgB;IAErD,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAI3C,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAsDpE,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE;IAIrC,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE;IAIpC,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;CASjD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RankedDefinition } from './types';
|
|
2
|
+
export declare class TreeRenderer {
|
|
3
|
+
render(rankedDefinitions: RankedDefinition[], chatFiles: Set<string>, maxLines?: number): Promise<string>;
|
|
4
|
+
private renderAllFiles;
|
|
5
|
+
private renderFileListOnly;
|
|
6
|
+
private renderWithLineLimit;
|
|
7
|
+
private renderFileTree;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=tree-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-renderer.d.ts","sourceRoot":"","sources":["../src/tree-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C,qBAAa,YAAY;IACjB,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAwCjG,cAAc;IAiB5B,OAAO,CAAC,kBAAkB;YAeZ,mBAAmB;YA0BnB,cAAc;CAuC7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RepoMapOptions, SymbolOptions, Symbol, ParseResult } from './types';
|
|
2
|
+
export declare class TreeSitterAnalyzer {
|
|
3
|
+
private readonly parser;
|
|
4
|
+
private readonly symbolExtractor;
|
|
5
|
+
private readonly graphBuilder;
|
|
6
|
+
private readonly pageRankCalculator;
|
|
7
|
+
private readonly treeRenderer;
|
|
8
|
+
private readonly cacheManager;
|
|
9
|
+
private initialized;
|
|
10
|
+
constructor();
|
|
11
|
+
initialize(): Promise<void>;
|
|
12
|
+
getRepoMap(options: RepoMapOptions): Promise<string>;
|
|
13
|
+
extractSymbols(filePaths: string[], options?: SymbolOptions): Promise<Symbol[]>;
|
|
14
|
+
parseFile(filePath: string): Promise<ParseResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=tree-sitter-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-sitter-analyzer.d.ts","sourceRoot":"","sources":["../src/tree-sitter-analyzer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAO,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGlF,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,WAAW,CAAS;;IAYtB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IA2CpD,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAuC/E,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAgBxD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Tag } from './types';
|
|
2
|
+
export declare class TreeSitterParser {
|
|
3
|
+
private parser;
|
|
4
|
+
private languages;
|
|
5
|
+
private queries;
|
|
6
|
+
private initialized;
|
|
7
|
+
initialize(): Promise<void>;
|
|
8
|
+
private loadLanguage;
|
|
9
|
+
parseFile(filePath: string, rootDir?: string): Promise<Tag[]>;
|
|
10
|
+
private extractTags;
|
|
11
|
+
private determineKind;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=tree-sitter-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-sitter-parser.d.ts","sourceRoot":"","sources":["../src/tree-sitter-parser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAS9B,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,WAAW,CAAS;IAEtB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAiCnB,YAAY;IAqBpB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IA0CnE,OAAO,CAAC,WAAW;IA0CnB,OAAO,CAAC,aAAa;CAMtB"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface Tag {
|
|
2
|
+
rel_fname: string;
|
|
3
|
+
fname: string;
|
|
4
|
+
line: number;
|
|
5
|
+
name: string;
|
|
6
|
+
kind: 'def' | 'ref';
|
|
7
|
+
}
|
|
8
|
+
export interface Symbol {
|
|
9
|
+
name: string;
|
|
10
|
+
kind: 'def' | 'ref';
|
|
11
|
+
line: number;
|
|
12
|
+
file: string;
|
|
13
|
+
relativeFile: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RepoMapOptions {
|
|
16
|
+
root: string;
|
|
17
|
+
files?: string[];
|
|
18
|
+
excludePatterns?: string[];
|
|
19
|
+
mentionedFiles?: Set<string>;
|
|
20
|
+
mentionedIdents?: Set<string>;
|
|
21
|
+
chatFiles?: Set<string>;
|
|
22
|
+
maxLines?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface SymbolOptions {
|
|
25
|
+
useCache?: boolean;
|
|
26
|
+
rootDir?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GraphEdge {
|
|
29
|
+
source: string;
|
|
30
|
+
target: string;
|
|
31
|
+
weight: number;
|
|
32
|
+
ident: string;
|
|
33
|
+
}
|
|
34
|
+
export interface RankedDefinition {
|
|
35
|
+
rel_fname: string;
|
|
36
|
+
name: string;
|
|
37
|
+
rank: number;
|
|
38
|
+
line: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ParseResult {
|
|
41
|
+
tags: Tag[];
|
|
42
|
+
file: string;
|
|
43
|
+
language: string;
|
|
44
|
+
}
|
|
45
|
+
export interface LanguageConfig {
|
|
46
|
+
name: string;
|
|
47
|
+
extensions: string[];
|
|
48
|
+
wasmUrl: string;
|
|
49
|
+
wasmFile: string;
|
|
50
|
+
}
|
|
51
|
+
export interface Logger {
|
|
52
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
53
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
54
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
55
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.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AI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACtD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function downloadWasmForLanguage(language: string): Promise<Buffer | null>;
|
|
2
|
+
export declare function getLanguageWasmConfig(language: string): {
|
|
3
|
+
url: string;
|
|
4
|
+
file: string;
|
|
5
|
+
} | null;
|
|
6
|
+
export declare function getSupportedLanguagesForWasm(): string[];
|
|
7
|
+
//# sourceMappingURL=wasm-downloader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-downloader.d.ts","sourceRoot":"","sources":["../src/wasm-downloader.ts"],"names":[],"mappings":"AA8FA,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA0CtF;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAE5F;AAED,wBAAgB,4BAA4B,IAAI,MAAM,EAAE,CAEvD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aiderdesk/tree-sitter-utils",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Tree-sitter utilities for code analysis, symbol extraction, and repository mapping",
|
|
5
|
+
"author": "Hotovo",
|
|
6
|
+
"homepage": "https://aiderdesk.hotovo.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/hotovo/aider-desk.git",
|
|
10
|
+
"directory": "packages/tree-sitter-utils"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/hotovo/aider-desk/issues"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"resources",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc --emitDeclarationOnly --declaration && esbuild src/index.ts --bundle --platform=node --packages=external --format=cjs --outfile=dist/index.js --sourcemap",
|
|
31
|
+
"build:check": "tsc --noEmit",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"tree-sitter",
|
|
37
|
+
"code-analysis",
|
|
38
|
+
"symbol-extraction",
|
|
39
|
+
"repository-map",
|
|
40
|
+
"pagerank",
|
|
41
|
+
"ast",
|
|
42
|
+
"parsing"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"glob": "^13.0.6",
|
|
46
|
+
"graphology": "^0.26.0",
|
|
47
|
+
"graphology-metrics": "^2.4.0",
|
|
48
|
+
"simple-git": "^3.32.3",
|
|
49
|
+
"web-tree-sitter": "^0.26.6"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^22.13.4",
|
|
53
|
+
"esbuild": "^0.25.0",
|
|
54
|
+
"typescript": "^5.5.4"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=18.0.0"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(struct_specifier name: (type_identifier) @name.definition.class body:(_)) @definition.class
|
|
2
|
+
|
|
3
|
+
(declaration type: (union_specifier name: (type_identifier) @name.definition.class)) @definition.class
|
|
4
|
+
|
|
5
|
+
(function_declarator declarator: (identifier) @name.definition.function) @definition.function
|
|
6
|
+
|
|
7
|
+
(type_definition declarator: (type_identifier) @name.definition.type) @definition.type
|
|
8
|
+
|
|
9
|
+
(enum_specifier name: (type_identifier) @name.definition.type) @definition.type
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
(class_declaration
|
|
2
|
+
name: (identifier) @name.definition.class
|
|
3
|
+
) @definition.class
|
|
4
|
+
|
|
5
|
+
(class_declaration
|
|
6
|
+
bases: (base_list (_) @name.reference.class)
|
|
7
|
+
) @reference.class
|
|
8
|
+
|
|
9
|
+
(interface_declaration
|
|
10
|
+
name: (identifier) @name.definition.interface
|
|
11
|
+
) @definition.interface
|
|
12
|
+
|
|
13
|
+
(interface_declaration
|
|
14
|
+
bases: (base_list (_) @name.reference.interface)
|
|
15
|
+
) @reference.interface
|
|
16
|
+
|
|
17
|
+
(method_declaration
|
|
18
|
+
name: (identifier) @name.definition.method
|
|
19
|
+
) @definition.method
|
|
20
|
+
|
|
21
|
+
(object_creation_expression
|
|
22
|
+
type: (identifier) @name.reference.class
|
|
23
|
+
) @reference.class
|
|
24
|
+
|
|
25
|
+
(type_parameter_constraints_clause
|
|
26
|
+
target: (identifier) @name.reference.class
|
|
27
|
+
) @reference.class
|
|
28
|
+
|
|
29
|
+
(type_constraint
|
|
30
|
+
type: (identifier) @name.reference.class
|
|
31
|
+
) @reference.class
|
|
32
|
+
|
|
33
|
+
(variable_declaration
|
|
34
|
+
type: (identifier) @name.reference.class
|
|
35
|
+
) @reference.class
|
|
36
|
+
|
|
37
|
+
(invocation_expression
|
|
38
|
+
function:
|
|
39
|
+
(member_access_expression
|
|
40
|
+
name: (identifier) @name.reference.send
|
|
41
|
+
)
|
|
42
|
+
) @reference.send
|
|
43
|
+
|
|
44
|
+
(namespace_declaration
|
|
45
|
+
name: (identifier) @name.definition.module
|
|
46
|
+
) @definition.module
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
(struct_specifier name: (type_identifier) @name.definition.class body:(_)) @definition.class
|
|
2
|
+
|
|
3
|
+
(declaration type: (union_specifier name: (type_identifier) @name.definition.class)) @definition.class
|
|
4
|
+
|
|
5
|
+
(function_declarator declarator: (identifier) @name.definition.function) @definition.function
|
|
6
|
+
|
|
7
|
+
(function_declarator declarator: (field_identifier) @name.definition.function) @definition.function
|
|
8
|
+
|
|
9
|
+
(function_declarator declarator: (qualified_identifier scope: (namespace_identifier) @scope name: (identifier) @name.definition.method)) @definition.method
|
|
10
|
+
|
|
11
|
+
(type_definition declarator: (type_identifier) @name.definition.type) @definition.type
|
|
12
|
+
|
|
13
|
+
(enum_specifier name: (type_identifier) @name.definition.type) @definition.type
|
|
14
|
+
|
|
15
|
+
(class_specifier name: (type_identifier) @name.definition.class) @definition.class
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
(class_definition
|
|
2
|
+
name: (identifier) @name.definition.class) @definition.class
|
|
3
|
+
|
|
4
|
+
(method_signature
|
|
5
|
+
(function_signature)) @definition.method
|
|
6
|
+
|
|
7
|
+
(type_alias
|
|
8
|
+
(type_identifier) @name.definition.type) @definition.type
|
|
9
|
+
|
|
10
|
+
(method_signature
|
|
11
|
+
(getter_signature
|
|
12
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
13
|
+
|
|
14
|
+
(method_signature
|
|
15
|
+
(setter_signature
|
|
16
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
17
|
+
|
|
18
|
+
(method_signature
|
|
19
|
+
(function_signature
|
|
20
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
21
|
+
|
|
22
|
+
(method_signature
|
|
23
|
+
(factory_constructor_signature
|
|
24
|
+
(identifier) @name.definition.method)) @definition.method
|
|
25
|
+
|
|
26
|
+
(method_signature
|
|
27
|
+
(constructor_signature
|
|
28
|
+
name: (identifier) @name.definition.method)) @definition.method
|
|
29
|
+
|
|
30
|
+
(method_signature
|
|
31
|
+
(operator_signature)) @definition.method
|
|
32
|
+
|
|
33
|
+
(method_signature) @definition.method
|
|
34
|
+
|
|
35
|
+
(mixin_declaration
|
|
36
|
+
(mixin)
|
|
37
|
+
(identifier) @name.definition.mixin) @definition.mixin
|
|
38
|
+
|
|
39
|
+
(extension_declaration
|
|
40
|
+
name: (identifier) @name.definition.extension) @definition.extension
|
|
41
|
+
|
|
42
|
+
(enum_declaration
|
|
43
|
+
name: (identifier) @name.definition.enum) @definition.enum
|
|
44
|
+
|
|
45
|
+
(function_signature
|
|
46
|
+
name: (identifier) @name.definition.function) @definition.function
|
|
47
|
+
|
|
48
|
+
(new_expression
|
|
49
|
+
(type_identifier) @name.reference.class) @reference.class
|
|
50
|
+
|
|
51
|
+
(initialized_variable_definition
|
|
52
|
+
name: (identifier)
|
|
53
|
+
value: (identifier) @name.reference.class
|
|
54
|
+
value: (selector
|
|
55
|
+
"!"?
|
|
56
|
+
(argument_part
|
|
57
|
+
(arguments
|
|
58
|
+
(argument)*))?)?) @reference.class
|
|
59
|
+
|
|
60
|
+
(assignment_expression
|
|
61
|
+
left: (assignable_expression
|
|
62
|
+
(identifier)
|
|
63
|
+
(unconditional_assignable_selector
|
|
64
|
+
"."
|
|
65
|
+
(identifier) @name.reference.call))) @reference.call
|
|
66
|
+
|
|
67
|
+
(assignment_expression
|
|
68
|
+
left: (assignable_expression
|
|
69
|
+
(identifier)
|
|
70
|
+
(conditional_assignable_selector
|
|
71
|
+
"?."
|
|
72
|
+
(identifier) @name.reference.call))) @reference.call
|
|
73
|
+
|
|
74
|
+
((identifier) @name
|
|
75
|
+
(selector
|
|
76
|
+
"!"?
|
|
77
|
+
(conditional_assignable_selector
|
|
78
|
+
"?." (identifier) @name.reference.call)?
|
|
79
|
+
(unconditional_assignable_selector
|
|
80
|
+
"."? (identifier) @name.reference.call)?
|
|
81
|
+
(argument_part
|
|
82
|
+
(arguments
|
|
83
|
+
(argument)*))?)*
|
|
84
|
+
(cascade_section
|
|
85
|
+
(cascade_selector
|
|
86
|
+
(identifier)) @name.reference.call
|
|
87
|
+
(argument_part
|
|
88
|
+
(arguments
|
|
89
|
+
(argument)*))?)?) @reference.call
|
|
90
|
+
|
|
91
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
;; defun/defsubst
|
|
2
|
+
(function_definition name: (symbol) @name.definition.function) @definition.function
|
|
3
|
+
|
|
4
|
+
;; Treat macros as function definitions for the sake of TAGS.
|
|
5
|
+
(macro_definition name: (symbol) @name.definition.function) @definition.function
|
|
6
|
+
|
|
7
|
+
;; Match function calls
|
|
8
|
+
(list (symbol) @name.reference.function) @reference.function
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
; Definitions
|
|
2
|
+
|
|
3
|
+
; * modules and protocols
|
|
4
|
+
(call
|
|
5
|
+
target: (identifier) @ignore
|
|
6
|
+
(arguments (alias) @name.definition.module)
|
|
7
|
+
(#match? @ignore "^(defmodule|defprotocol)$")) @definition.module
|
|
8
|
+
|
|
9
|
+
; * functions/macros
|
|
10
|
+
(call
|
|
11
|
+
target: (identifier) @ignore
|
|
12
|
+
(arguments
|
|
13
|
+
[
|
|
14
|
+
; zero-arity functions with no parentheses
|
|
15
|
+
(identifier) @name.definition.function
|
|
16
|
+
; regular function clause
|
|
17
|
+
(call target: (identifier) @name.definition.function)
|
|
18
|
+
; function clause with a guard clause
|
|
19
|
+
(binary_operator
|
|
20
|
+
left: (call target: (identifier) @name.definition.function)
|
|
21
|
+
operator: "when")
|
|
22
|
+
])
|
|
23
|
+
(#match? @ignore "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @definition.function
|
|
24
|
+
|
|
25
|
+
; References
|
|
26
|
+
|
|
27
|
+
; ignore calls to kernel/special-forms keywords
|
|
28
|
+
(call
|
|
29
|
+
target: (identifier) @ignore
|
|
30
|
+
(#match? @ignore "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defmodule|defprotocol|defimpl|defstruct|defexception|defoverridable|alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
|
|
31
|
+
|
|
32
|
+
; ignore module attributes
|
|
33
|
+
(unary_operator
|
|
34
|
+
operator: "@"
|
|
35
|
+
operand: (call
|
|
36
|
+
target: (identifier) @ignore))
|
|
37
|
+
|
|
38
|
+
; * function call
|
|
39
|
+
(call
|
|
40
|
+
target: [
|
|
41
|
+
; local
|
|
42
|
+
(identifier) @name.reference.call
|
|
43
|
+
; remote
|
|
44
|
+
(dot
|
|
45
|
+
right: (identifier) @name.reference.call)
|
|
46
|
+
]) @reference.call
|
|
47
|
+
|
|
48
|
+
; * pipe into function call
|
|
49
|
+
(binary_operator
|
|
50
|
+
operator: "|>"
|
|
51
|
+
right: (identifier) @name.reference.call) @reference.call
|
|
52
|
+
|
|
53
|
+
; * modules
|
|
54
|
+
(alias) @name.reference.module @reference.module
|