diff --git a/bin/assets/plugins/lspclient.json b/bin/assets/plugins/lspclient.json index f717fcb8d..311a70b10 100644 --- a/bin/assets/plugins/lspclient.json +++ b/bin/assets/plugins/lspclient.json @@ -360,6 +360,13 @@ "url": "https://github.com/ocaml/ocaml-lsp", "command": "ocamllsp", "file_patterns": ["%.ml$", "%.mli$"] + }, + { + "language": "julia", + "name": "LanguageServer.jl", + "url": "https://github.com/julia-vscode/LanguageServer.jl", + "command": "julia --project=\"$HOME/.julia/packages/LanguageServer/Fwm1f/src/LanguageServer.jl\" -e \"using LanguageServer; runserver()\"", + "file_patterns": ["%.jl"] } ] } diff --git a/include/eepp/system/sys.hpp b/include/eepp/system/sys.hpp index 5ba9e5020..e7eeeee8b 100644 --- a/include/eepp/system/sys.hpp +++ b/include/eepp/system/sys.hpp @@ -133,6 +133,9 @@ class EE_API Sys { /** @returns The target destination of a windows shortcut path (.lnk files) */ static std::string getShortcutTarget( const std::string& lnkFilePath ); + + /** @returns The user home directory */ + static std::string getUserDirectory(); }; }} // namespace EE::System diff --git a/src/eepp/system/process.cpp b/src/eepp/system/process.cpp index aa91f4115..eee880d73 100644 --- a/src/eepp/system/process.cpp +++ b/src/eepp/system/process.cpp @@ -106,7 +106,7 @@ Process::~Process() { bool Process::create( const std::string& command, Uint32 options, const std::unordered_map& environment, const std::string& workingDirectory ) { - std::vector cmdArr = String::split( command, " ", "", "\"", true ); + std::vector cmdArr = parseArgs( command ); if ( cmdArr.empty() ) return false; std::string cmd( cmdArr[0] ); diff --git a/src/eepp/system/sys.cpp b/src/eepp/system/sys.cpp index 7e40e88c9..e0b532cec 100644 --- a/src/eepp/system/sys.cpp +++ b/src/eepp/system/sys.cpp @@ -1619,4 +1619,24 @@ std::string Sys::getShortcutTarget( const std::string& lnkFilePath ) { return ""; } +std::string Sys::getUserDirectory() { +#ifdef _WIN32 + // On Windows, use USERPROFILE or HOMEDRIVE + HOMEPATH + const char* userProfile = std::getenv( "USERPROFILE" ); + if ( userProfile ) { + return std::string( userProfile ); + } else { + // Fallback to HOMEDRIVE + HOMEPATH + const char* homeDrive = std::getenv( "HOMEDRIVE" ); + const char* homePath = std::getenv( "HOMEPATH" ); + if ( homeDrive && homePath ) + return std::string( homeDrive ) + homePath; + } + return ""; +#else + // On Unix-based systems, use HOME + return std::string{ std::getenv( "HOME" ) }; +#endif +} + }} // namespace EE::System diff --git a/src/eepp/window/window.cpp b/src/eepp/window/window.cpp index d7d7a0726..252acb907 100644 --- a/src/eepp/window/window.cpp +++ b/src/eepp/window/window.cpp @@ -464,20 +464,18 @@ void Window::sendVideoResizeCb() { } void Window::logSuccessfulInit( const std::string& BackendName ) { - std::string msg( - "Engine Initialized Succesfully.\n\tVersion: " + Version::getVersionName() + - " (codename: \"" + Version::getCodename() + "\")" + - "\n\tBuild time: " + Version::getBuildTime() + "\n\tPlatform: " + Sys::getPlatform() + - "\n\tOS: " + Sys::getOSName( true ) + "\n\tArch: " + Sys::getOSArchitecture() + - "\n\tCPU Cores: " + String::toString( Sys::getCPUCount() ) + - "\n\tProcess Path: " + Sys::getProcessPath() + "\n\tCurrent Working Directory: " + - FileSystem::getCurrentWorkingDirectory() + "\n\tDisk Free Space: " + - FileSystem::sizeToString( FileSystem::getDiskFreeSpace( Sys::getProcessPath() ) ) + - "\n\tWindow/Input Backend: " + BackendName + "\n\tGL Backend: " + GLi->versionStr() + - "\n\tGL Vendor: " + GLi->getVendor() + "\n\tGL Renderer: " + GLi->getRenderer() + - "\n\tGL Version: " + GLi->getVersion() + "\n\tGL Shading Language Version: " + - GLi->getShadingLanguageVersion() + "\n\tResolution: " + String::toString( getWidth() ) + - "x" + String::toString( getHeight() ) ); + std::string msg( String::format( + "Engine Initialized Succesfully.\n\tVersion: %s (codename: \"%s\")\n\tBuild time: " + "%s\n\tPlatform: %s\n\tOS: %s\n\tArch: %s\n\tCPU Cores: %d\n\tProcess Path: %s\n\tCurrent " + "Working Directory: %s\n\tHome Directory: %s\n\tDisk Free Space: %s\n\tWindow/Input " + "Backend: %s\n\tGL Backend: %s\n\tGL Vendor: %s\n\tGL Renderer: %s\n\tGL Version: " + "%s\n\tGL Shading Language Version: %s\n\tResolution: %dx%d", + Version::getVersionName(), Version::getCodename(), Version::getBuildTime(), + Sys::getPlatform(), Sys::getOSName( true ), Sys::getOSArchitecture(), Sys::getCPUCount(), + Sys::getProcessPath(), FileSystem::getCurrentWorkingDirectory(), Sys::getUserDirectory(), + FileSystem::sizeToString( FileSystem::getDiskFreeSpace( Sys::getProcessPath() ) ), + BackendName, GLi->versionStr(), GLi->getVendor(), GLi->getRenderer(), GLi->getVersion(), + GLi->getShadingLanguageVersion(), getWidth(), getHeight() ) ); #ifndef EE_SILENT Log::info( msg ); diff --git a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp index fd7525c00..20ee8207d 100644 --- a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp @@ -308,11 +308,14 @@ static LSPURIAndServer getServerURIFromTextDocumentURI( LSPClientServerManager& } static void sanitizeCommand( std::string& cmd, const std::string& workspaceFolder ) { - std::string cpucount( String::toString( Sys::getCPUCount() ) ); + static std::string cpucount( String::toString( Sys::getCPUCount() ) ); + static std::string userdir = Sys::getUserDirectory(); String::replaceAll( cmd, "$NPROC", cpucount ); String::replaceAll( cmd, "${nproc}", cpucount ); String::replaceAll( cmd, "$PROJECTPATH", workspaceFolder ); String::replaceAll( cmd, "${project_root}", workspaceFolder ); + String::replaceAll( cmd, "$HOME", userdir ); + String::replaceAll( cmd, "${home}", userdir ); } LSPPositionAndServer getLSPLocationFromJSON( LSPClientServerManager& manager, const json& data ) {