mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
HackStudio: Hookup git commit message detection and highlighting
This commit is contained in:
parent
974e36e7a9
commit
89592601b6
4 changed files with 24 additions and 6 deletions
|
@ -5,11 +5,16 @@
|
|||
*/
|
||||
|
||||
#include "Language.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
Language language_from_file_extension(const String& extension)
|
||||
Language language_from_file(const LexicalPath& file)
|
||||
{
|
||||
if (file.title() == "COMMIT_EDITMSG")
|
||||
return Language::GitCommit;
|
||||
|
||||
auto extension = file.extension();
|
||||
VERIFY(!extension.starts_with("."));
|
||||
if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++"
|
||||
|| extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++")
|
||||
|
@ -40,12 +45,18 @@ Language language_from_name(const String& name)
|
|||
return Language::JavaScript;
|
||||
if (name == "Shell")
|
||||
return Language::Shell;
|
||||
if (name == "GitCommit")
|
||||
return Language::GitCommit;
|
||||
|
||||
return Language::Unknown;
|
||||
}
|
||||
|
||||
String language_name_from_file_extension(const String& extension)
|
||||
String language_name_from_file(const LexicalPath& file)
|
||||
{
|
||||
if (file.title() == "COMMIT_EDITMSG")
|
||||
return "GitCommit";
|
||||
|
||||
auto extension = file.extension();
|
||||
VERIFY(!extension.starts_with("."));
|
||||
if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++"
|
||||
|| extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue