fix: make prompts language-agnostic, support all file types

The plugin now properly detects and uses the file's language based on
its extension, rather than focusing on TypeScript.

Changes:
- Updated all system prompts to use {{language}} placeholder
- Removed hardcoded TypeScript references
- Expanded language mappings to support 50+ file extensions:
  - JavaScript/TypeScript (js, ts, jsx, tsx, mjs, cjs)
  - Python (py, pyw, pyx)
  - Systems (c, cpp, rs, go, zig, nim)
  - JVM (java, kt, scala, clj)
  - Web (html, css, scss, vue, svelte)
  - Scripting (lua, rb, php, sh, bash)
  - .NET (cs, fs, vb)
  - Data (json, yaml, toml, sql, graphql)
  - And many more...
This commit is contained in:
2026-01-11 15:33:28 -05:00
parent fe04e624db
commit 8130a78ed5
2 changed files with 98 additions and 32 deletions

View File

@@ -67,19 +67,77 @@ function M.build_context(target_path, prompt_type)
-- Map extension to language
local lang_map = {
-- JavaScript/TypeScript
ts = "TypeScript",
tsx = "TypeScript React",
tsx = "TypeScript React (TSX)",
js = "JavaScript",
jsx = "JavaScript React",
jsx = "JavaScript React (JSX)",
mjs = "JavaScript (ESM)",
cjs = "JavaScript (CommonJS)",
-- Python
py = "Python",
lua = "Lua",
go = "Go",
rs = "Rust",
rb = "Ruby",
java = "Java",
pyw = "Python",
pyx = "Cython",
-- Systems languages
c = "C",
h = "C Header",
cpp = "C++",
hpp = "C++ Header",
cc = "C++",
cxx = "C++",
rs = "Rust",
go = "Go",
-- JVM languages
java = "Java",
kt = "Kotlin",
kts = "Kotlin Script",
scala = "Scala",
clj = "Clojure",
-- Web
html = "HTML",
css = "CSS",
scss = "SCSS",
sass = "Sass",
less = "Less",
vue = "Vue",
svelte = "Svelte",
-- Scripting
lua = "Lua",
rb = "Ruby",
php = "PHP",
pl = "Perl",
sh = "Shell (Bash)",
bash = "Bash",
zsh = "Zsh",
fish = "Fish",
ps1 = "PowerShell",
-- .NET
cs = "C#",
fs = "F#",
vb = "Visual Basic",
-- Data/Config
json = "JSON",
yaml = "YAML",
yml = "YAML",
toml = "TOML",
xml = "XML",
sql = "SQL",
graphql = "GraphQL",
-- Other
swift = "Swift",
dart = "Dart",
ex = "Elixir",
exs = "Elixir Script",
erl = "Erlang",
hs = "Haskell",
ml = "OCaml",
r = "R",
jl = "Julia",
nim = "Nim",
zig = "Zig",
v = "V",
md = "Markdown",
mdx = "MDX",
}
return {