加个文件扩展名判断,避免打开不支持的格式,显示乱码。(这个时候应该是需要打开空白窗口记录其他文本)
$= {files}.Any(file => new[] {
// Text / Log / Config
".txt", ".text", ".wtx", ".doc", ".log", ".asc", ".map", ".bnf", ".nfo", ".diz",
".conf", ".cfg", ".cnf", ".htaccess", ".properties", ".prefs", ".iface", ".prop", ".po", ".te", ".ini", ".inf", ".reg", ".oem", ".sif", ".url", ".sed", ".theme", ".clw", ".abnf",
// C / C++
".c", ".cpp", ".cxx", ".cc", ".h", ".hpp", ".cppm", ".hxx", ".hh", ".inl", ".ixx", ".pch", ".idl", ".odl", ".midl", ".m", ".mm", ".xpm", ".cl", ".cu", ".cuh",
// C# / .NET
".cs", ".csx", ".vala", ".vapi", ".il", ".rc", ".rc2", ".rct", ".rh", ".dlg", ".resx",
// Java / Kotlin / Groovy / Scala
".java", ".jad", ".aidl", ".bsh", ".kt", ".kts", ".groovy", ".gvy", ".gy", ".gsh", ".gpp", ".grunit", ".scala", ".sbt", ".jar",
// Web (HTML/CSS/JS/TS/PHP)
".html", ".htm", ".shtml", ".xhtml", ".asp", ".aspx", ".jsp", ".rhtml", ".vue", ".hbs", ".svelte", ".mht", ".htd", ".htt", ".hta", ".htc", ".cfm", ".tpl", ".jd",
".css", ".scss", ".less", ".hss", ".wxss",
".js", ".jse", ".jsm", ".jsx", ".cjs", ".mjs", ".qs", ".ts", ".tsx", ".cts", ".mts", ".ets", ".osts",
".php", ".phps", ".phpt", ".phtml", ".php_cs", ".eyecode",
// Python / Ruby / Perl / Lua
".py", ".pyw", ".pyx", ".pxd", ".pxi", ".pyi", ".py3", ".pth", ".boo", ".empy", ".cobra", ".gs",
".rb", ".ruby", ".rbw", ".rake", ".rjs", ".gemspec", ".podspec", ".cr",
".pl", ".pm", ".cgi", ".pod", ".plx", ".stp",
".lua", ".wlua", ".nse", ".luadoc", ".luax",
// XML / JSON / YAML / TOML
".xml", ".xsl", ".xslt", ".xsd", ".dtd", ".rss", ".svg", ".xul", ".axl", ".rdf", ".xaml", ".plist", ".pom", ".xrc", ".fbp", ".wxml", ".web.config",
".json", ".har", ".ipynb", ".wxcp", ".jshintrc", ".eslintrc", ".babelrc", ".prettierrc", ".stylelintrc", ".jsonld", ".jsonc", ".json5", ".jsonl", ".arcconfig", ".arclint", ".jscop",
".yml", ".yaml", ".clang-format", ".clang-tidy", ".clangd", ".mir", ".apinotes", ".ifs", ".gyp", ".gypi",
".toml", ".lock",
// Shell / Batch / PowerShell / Makefile
".sh", ".csh", ".zsh", ".bash", ".tcsh", ".m4", ".in", ".ac", ".bat", ".cmd", ".ps1", ".psc1", ".psd1", ".psm1",
".mak", ".make", ".mk", ".dsp", ".dsw", ".am", ".pro", ".pri", ".gmk", ".ninja",
// Markdown / LaTeX / Documentation
".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".litcoffee", ".rmd",
".tex", ".latex", ".sty", ".cls", ".tpx", ".bbl", ".bib", ".ltx", ".dtx", ".ins", ".toc", ".info", ".rd", ".texi", ".texinfo", ".txi",
// Other Languages (Go, Rust, Swift, D, Nim, etc.)
".go", ".gop", ".ql", ".rs", ".swift", ".d", ".di", ".dd", ".dart", ".nim", ".nimble", ".nims", ".nimrod", ".zig",
".f", ".for", ".ftn", ".fpp", ".f90", ".f95", ".f03", ".f08", ".f18", ".f77", ".f2k", ".hf", ".cuf",
".fs", ".fsi", ".fsx", ".fsscript", ".fsl", ".fsy",
".hs", ".lhs", ".hx", ".jl", ".lisp", ".el", ".lsp", ".clj", ".cljs", ".scm", ".ml", ".mli", ".mll", ".mly", ".sml",
".pas", ".dpr", ".dpk", ".dfm", ".pp", ".lfm", ".lpr", ".fpd",
".r", ".reb", ".red", ".reds", ".sas", ".sps", ".tcl", ".itcl", ".tm",
".v", ".vh", ".sv", ".svh", ".vhd", ".vhdl", ".verilog",
".vb", ".bas", ".frm", ".ctl", ".pag", ".dsr", ".dob", ".vbs", ".dsm",
".asm", ".s", ".sx", ".cod", ".a51",
".erl", ".hrl", ".ex", ".exs",
// Misc
".sql", ".mysql", ".hsql", ".diff", ".patch", ".cmake", ".ctest", ".gn", ".gni", ".gradle", ".dot", ".gv", ".iss", ".isl", ".islu", ".jam", ".ll",
".mlir", ".cir", ".fir", ".sil", ".nsi", ".nsh", ".nlf", ".au3", ".ahk", ".ia", ".scriptlet", ".avs", ".avsi", ".awk", ".bzl", ".bazel", ".mojo",
".cdb", ".cj", ".diag", ".inp", ".as", ".asy", ".wat", ".wast", ".whs", ".csv", ".tsv",
// Specific Filenames (handled by EndsWith, check covers whole name)
"makefile", "rakefile", "gemfile", "podfile", "jamfile", "jamroot", "cmakelists.txt", "cmakecache.txt",
"dockerfile", "vagrantfile", "build", "apkbuild", "pkgbuild", "mozconfig", "cargo.lock",
".bashrc", ".bash_profile", ".profile", ".zshrc", ".vimrc", ".gvimrc", ".exrc", ".netrc", ".rhistory", ".rprofile", ".pylintrc"
}.Any(ext => file.EndsWith(ext, StringComparison.OrdinalIgnoreCase)))