diff --git a/Lua/Plugins/java.lua b/Lua/Plugins/java.lua new file mode 100644 index 0000000..22c2fd9 --- /dev/null +++ b/Lua/Plugins/java.lua @@ -0,0 +1,134 @@ +highlight("package", "reserved") +highlight("import", "reserved") + +highlight("public", "reserved") +highlight("private", "reserved") +highlight("protected", "reserved") + +highlight("class", "reserved") +highlight("enum", "reserved") +highlight("record", "reserved") +highlight("interface", "reserved") + +highlight("extends", "reserved") +highlight("implements", "reserved") +highlight("module", "reserved") + +highlight("super", "reserved") +highlight("this", "reserved") + +highlight("void", "reserved") +highlight("boolean", "reserved") +highlight("int", "reserved") +highlight("double", "reserved") +highlight("long", "reserved") +highlight("float", "reserved") +highlight("char", "reserved") +highlight("byte", "reserved") +highlight("short", "reserved") + +-- which mf actually uses these +highlight("const", "reserved") +highlight("goto", "reserved") +highlight("strictfp", "reserved") + +highlight("instanceof", "reserved") +highlight("native", "reserved") +highlight("new", "reserved") + +highlight("return", "reserved") + +highlight("final", "reserved") +highlight("static", "reserved") +highlight("transient", "reserved") +highlight("volatile", "reserved") + +highlight_region("\"", "\"", "string") +highlight_region("//", "", "comments", true) +highlight_region("/*", "*/", "comments") + +-- annotation but ofc griddy doesn't let me set keywords outside of default ones +highlight_region("@", "", "comments", true) + +highlight("if", "reserved") +highlight("else", "reserved") + +highlight("do", "reserved") +highlight("while", "reserved") +highlight("for", "reserved") +highlight("continue", "reserved") +highlight("default", "reserved") +highlight("break", "reserved") + +highlight("switch", "reserved") +highlight("case", "reserved") + +highlight("try", "reserved") +highlight("catch", "reserved") +highlight("finally", "reserved") +highlight("throw", "reserved") +highlight("throws", "reserved") + +highlight("false", "binary") +highlight("true", "binary") +highlight("null", "binary") + +highlight("synchronized", "reserved") + +highlight("assert", "reserved") + +highlight("exports", "reserved") +highlight("module", "reserved") +highlight("non-sealed", "reserved") +highlight("open", "reserved") +highlight("opens", "reserved") +highlight("permits", "reserved") +highlight("provides", "reserved") +highlight("requires", "reserved") +highlight("sealed", "reserved") +highlight("to", "reserved") +highlight("transitive", "reserved") +highlight("uses", "reserved") +highlight("var", "reserved") +highlight("when", "reserved") +highlight("with", "reserved") +highlight("yield", "reserved") + +add_comment("boiler plate alert!!!") +add_comment("public static volatile transient transitive synchronized class type language 🗣️🔥") +add_comment("another semicolon please") +add_comment("use a lambda you dumbass") + +function detect_functions(content) + local functionNames = {} + + for line in content:gmatch("[^\r\n]+") do + local pattern = "[%a_][%a%d_<>]*%s+([%a_][%a%d_]*)%s*%(" + local functionName = line:match(pattern) + if functionName then + table.insert(functionNames, functionName); + end + end + + return functionNames +end + +function detect_variables(content) + local variable_names = { + "this", + "super", + "System", + "Object", + "Math", + "Thread", + "Runtime" + } + for line in content:gmatch("[^\r\n]+") do + local pattern = "%f[%a_][%a_][%a%d_<>]*%s+([%a_][%a%d_<>]*)%s*=%s*[^;]+;" + local match = line:match(pattern) + if match then + table.insert(variable_names, match) + end + end + return variable_names +end diff --git a/Lua/Plugins/js.lua b/Lua/Plugins/js.lua index 902797d..ce0daec 100644 --- a/Lua/Plugins/js.lua +++ b/Lua/Plugins/js.lua @@ -100,7 +100,9 @@ add_comment("tip: decrease your chance at errors: Number.MAX_SAFE_INTEGER += Num --- autocomplete function detect_functions(content) - local functionNames = {} + local functionNames = { + "require" + } local lines = {} for line in content:gmatch("[^\r\n]+") do @@ -108,7 +110,7 @@ function detect_functions(content) end for _, line in ipairs(lines) do - if (string.find(line, "function ") or string.find(line, "async ")) and string.find(line, "%(") then + if trim(line):find("^function ") or trim(line):find("^async function ") and string.find(line, "%(") then local functionName = string.match(trim(line):gsub("{", ""), "function%s+(.-)%s*%(") or string.match(trim(line):gsub("{", ""), "async%s+(.-)%s*%(") @@ -120,11 +122,20 @@ function detect_functions(content) end function detect_variables(content) - local variable_names = {} + local variable_names = { + "global", + "process", + "console", + "Buffer", + "__dirname", + "__filename", + "module", + "exports" + } local lines = content:gmatch("[^\r\n]+") for line in lines do - if line:find("let ") or line:find("var ") or line:find("const ") then + if trim(line):find("^let ") or trim(line):find("^var ") or trim(line):find("^const ") then local parts = splitstr(line, "=") if #parts > 0 then local variable_name = trim(splitstr(trim(parts[1]), " ")[2]) diff --git a/Lua/Plugins/json.lua b/Lua/Plugins/json.lua new file mode 100644 index 0000000..0537b1c --- /dev/null +++ b/Lua/Plugins/json.lua @@ -0,0 +1,7 @@ +highlight_region('"', '"', "string") + +add_comment("object notation 💯🔥") +add_comment("lower that scope") +add_comment("🗣️🗣️🗣️ { \"i'm\": \"suiciding\" }") + +-- json doesn't have variables or functions \ No newline at end of file