MCPcopy Index your code
hub / github.com/docker/docker-agent / isTextExtension

Function isTextExtension

pkg/chat/chat.go:273–352  ·  view source on GitHub ↗

isTextExtension returns true for file extensions known to be text-based. This includes programming languages, config files, markup, and data formats.

(ext string)

Source from the content-addressed store, hash-verified

271// isTextExtension returns true for file extensions known to be text-based.
272// This includes programming languages, config files, markup, and data formats.
273func isTextExtension(ext string) bool {
274 switch ext {
275 // Plain text and documentation
276 case ".txt", ".text", ".log",
277 ".md", ".markdown", ".mdown", ".mkd", ".mdx",
278 ".rst", ".adoc", ".asciidoc",
279 ".org", ".wiki", ".tex", ".latex",
280 // Web
281 ".html", ".htm", ".xhtml", ".css", ".scss", ".sass", ".less",
282 ".js", ".jsx", ".mjs", ".cjs",
283 ".ts", ".tsx", ".mts", ".cts",
284 ".vue", ".svelte", ".astro",
285 // Programming languages
286 ".go", ".py", ".pyi", ".pyw",
287 ".rb", ".rbw",
288 ".rs",
289 ".java", ".kt", ".kts", ".groovy", ".scala", ".clj", ".cljs",
290 ".c", ".h", ".cpp", ".cc", ".cxx", ".hpp", ".hxx", ".hh",
291 ".cs", ".fs", ".fsx",
292 ".swift", ".m", ".mm",
293 ".r", ".R",
294 ".lua",
295 ".pl", ".pm", ".perl",
296 ".php",
297 ".ex", ".exs",
298 ".erl", ".hrl",
299 ".hs", ".lhs",
300 ".ml", ".mli",
301 ".nim",
302 ".zig",
303 ".v", ".sv",
304 ".dart",
305 ".jl",
306 ".d",
307 ".pas", ".pp",
308 ".lisp", ".cl", ".el",
309 ".tcl",
310 ".awk",
311 ".sql",
312 // Shell and scripting
313 ".sh", ".bash", ".zsh", ".fish", ".ksh", ".csh",
314 ".ps1", ".psm1", ".psd1",
315 ".bat", ".cmd",
316 // Data and config formats
317 ".json", ".jsonl", ".ndjson", ".json5", ".jsonc",
318 ".yaml", ".yml",
319 ".toml",
320 ".xml", ".xsl", ".xslt", ".xsd", ".dtd",
321 ".csv", ".tsv",
322 ".ini", ".cfg", ".conf", ".config",
323 ".env", ".envrc",
324 ".properties",
325 ".plist",
326 ".hcl", ".tf", ".tfvars",
327 // Build and project files
328 ".makefile", ".mk",
329 ".cmake",
330 ".gradle",

Callers 2

DetectMimeTypeFunction · 0.85
IsTextFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected