.h recognized as C, ino added in indexer for C++

This commit is contained in:
mattpass
2021-01-24 16:38:57 +00:00
parent 0793c2fd63
commit 6eee161a74
4 changed files with 5 additions and 3 deletions

View File

@@ -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;}

View File

@@ -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#"

View File

@@ -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"

View File

@@ -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, "("))