mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 17:05:10 +00:00
HackStudio: Rethink the "project" concept to be about a directory
Instead of having .hsp files that determine which files are members of a project, a project is now an entire directory tree instead. This feels a lot less cumbersome to work with, and removes a fair amount of busywork that would otherwise be expected from the user. This patch refactors large parts of HackStudio to implement the new way of thinking. I've probably missed some details here and there, but generally I think it's pretty OK.
This commit is contained in:
parent
5d0fda3d39
commit
dd3e6451ac
6 changed files with 86 additions and 468 deletions
|
@ -465,7 +465,7 @@ void Editor::set_document(GUI::TextDocument& doc)
|
|||
switch (code_document.language()) {
|
||||
case Language::Cpp:
|
||||
set_syntax_highlighter(make<GUI::CppSyntaxHighlighter>());
|
||||
m_language_client = get_language_client<LanguageClients::Cpp::ServerConnection>(project().root_directory());
|
||||
m_language_client = get_language_client<LanguageClients::Cpp::ServerConnection>(project().root_path());
|
||||
break;
|
||||
case Language::JavaScript:
|
||||
set_syntax_highlighter(make<GUI::JSSyntaxHighlighter>());
|
||||
|
@ -475,16 +475,15 @@ void Editor::set_document(GUI::TextDocument& doc)
|
|||
break;
|
||||
case Language::Shell:
|
||||
set_syntax_highlighter(make<GUI::ShellSyntaxHighlighter>());
|
||||
m_language_client = get_language_client<LanguageClients::Shell::ServerConnection>(project().root_directory());
|
||||
m_language_client = get_language_client<LanguageClients::Shell::ServerConnection>(project().root_path());
|
||||
break;
|
||||
default:
|
||||
set_syntax_highlighter(nullptr);
|
||||
}
|
||||
|
||||
if (m_language_client) {
|
||||
auto full_file_path = String::formatted("{}/{}", project().root_directory(), code_document.file_path());
|
||||
dbg() << "Opening " << full_file_path;
|
||||
int fd = open(full_file_path.characters(), O_RDONLY | O_NOCTTY);
|
||||
dbgln("Opening {}", code_document.file_path());
|
||||
int fd = open(code_document.file_path().string().characters(), O_RDONLY | O_NOCTTY);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue