mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
HackStudio: Create Language enum from file extension or language name
This commit is contained in:
parent
1edaefca3a
commit
ba6cbf160b
Notes:
sideshowbarker
2024-07-18 21:41:20 +09:00
Author: https://github.com/itamar8910
Commit: ba6cbf160b
Pull-request: https://github.com/SerenityOS/serenity/pull/5654
Issue: https://github.com/SerenityOS/serenity/issues/5569
Issue: https://github.com/SerenityOS/serenity/issues/5574
Issue: https://github.com/SerenityOS/serenity/issues/5634
4 changed files with 68 additions and 12 deletions
|
@ -42,18 +42,7 @@ CodeDocument::CodeDocument(const String& file_path, Client* client)
|
|||
: TextDocument(client)
|
||||
, m_file_path(file_path)
|
||||
{
|
||||
LexicalPath lexical_path(file_path);
|
||||
|
||||
if (lexical_path.has_extension(".cpp") || lexical_path.has_extension(".h"))
|
||||
m_language = Language::Cpp;
|
||||
else if (lexical_path.has_extension(".js"))
|
||||
m_language = Language::JavaScript;
|
||||
else if (lexical_path.has_extension(".gml"))
|
||||
m_language = Language::GML;
|
||||
else if (lexical_path.has_extension(".ini"))
|
||||
m_language = Language::Ini;
|
||||
else if (lexical_path.has_extension(".sh"))
|
||||
m_language = Language::Shell;
|
||||
m_language = language_from_file_extension(LexicalPath { file_path }.extension());
|
||||
}
|
||||
|
||||
CodeDocument::CodeDocument(Client* client)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue