diff --git a/assets/css/file-type-icons.css b/assets/css/file-type-icons.css index 1fd378d..7dd94fd 100644 --- a/assets/css/file-type-icons.css +++ b/assets/css/file-type-icons.css @@ -1,5 +1,5 @@ /* Additional file types */ -.ext-c:before {background-position: -48px 0 !important;} +.ext-c:before, .ext-h:before {background-position: -48px 0 !important;} .ext-cpp:before, .ext-ino:before {background-position: -64px 0 !important;} .ext-cs:before {background-position: -80px 0 !important;} .ext-coffee:before {background-position: -96px 0 !important;} diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index 8c5c04d..897f280 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -1526,6 +1526,7 @@ var ICEcoder = { : fileExt === "erl" ? "Erlang" : fileExt === "jl" ? "Julia" : fileExt === "c" ? "C" + : fileExt === "h" ? "C" : fileExt === "cpp" ? "C++" : fileExt === "ino" ? "C++" : fileExt === "cs" ? "C#" diff --git a/assets/js/language-modes-partial.js b/assets/js/language-modes-partial.js index 4fc4d0b..f6b3130 100644 --- a/assets/js/language-modes-partial.js +++ b/assets/js/language-modes-partial.js @@ -21,6 +21,7 @@ var mode = : fileExt == "java" ? "text/x-java" : fileExt == "jl" ? "text/x-julia" : fileExt == "c" ? "text/x-csrc" + : fileExt == "h" ? "text/x-csrc" : fileExt == "cpp" ? "text/x-c++src" : fileExt == "ino" ? "text/x-c++src" : fileExt == "cs" ? "text/x-csharp" diff --git a/lib/indexer.php b/lib/indexer.php index 5241250..12a589d 100644 --- a/lib/indexer.php +++ b/lib/indexer.php @@ -3,7 +3,7 @@ include "headers.php"; include "settings.php"; // File extensions to look for functions & classes in -$indexableFileExts = ["php", "js", "coffee", "ts", "rb", "py", "mpy", "sql", "erl", "java", "jl", "c", "cpp", "ino", "cs", "go", "lua", "pl"]; +$indexableFileExts = ["php", "js", "coffee", "ts", "rb", "py", "mpy", "sql", "erl", "java", "jl", "c", "h", "cpp", "ino", "cs", "go", "lua", "pl"]; // Fallback for prevIndexData to start off initially $prevIndexData = []; @@ -91,7 +91,7 @@ function phpGrep($path, $base) { (($filePathExt === "py" || $filePathExt === "mpy" || $filePathExt === "rb") && strpos($line, "def") !== false && strpos($line, "def") < strpos($line, "(")) || (($filePathExt === "js" || $filePathExt === "ts") && strpos($line, "=>") !== false) || (($filePathExt === "erl" || $filePathExt === "coffee") && strpos($line, "->") !== false) || - (($filePathExt === "c" || $filePathExt === "cpp") && strpos($line, "{") !== false && strpos($line, "{") > strpos($line, "(")) || + (($filePathExt === "c" || $filePathExt === "h" || $filePathExt === "cpp" || $filePathExt === "ino") && strpos($line, "{") !== false && strpos($line, "{") > strpos($line, "(")) || ($filePathExt === "go" && strpos($line, "func") !== false && strpos($line, "func") < strpos($line, "(")) || // ...or if the line contains "function" before opening parens... (strpos($line, "function") !== false && strpos($line, "function") < strpos($line, "("))