-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial work on AI plugin for CodeLite
- Loading branch information
Showing
7 changed files
with
191 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
////////////////////////////////////////////////////////////////////////////// | ||
////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// copyright : (C) 2008 by Eran Ifrah | ||
// file name : codeformatter.cpp | ||
// | ||
// ------------------------------------------------------------------------- | ||
// A | ||
// _____ _ _ _ _ | ||
// / __ \ | | | | (_) | | ||
// | / \/ ___ __| | ___| | _| |_ ___ | ||
// | | / _ \ / _ |/ _ \ | | | __/ _ ) | ||
// | \__/\ (_) | (_| | __/ |___| | || __/ | ||
// \____/\___/ \__,_|\___\_____/_|\__\___| | ||
// | ||
// F i l e | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
////////////////////////////////////////////////////////////////////////////// | ||
////////////////////////////////////////////////////////////////////////////// | ||
#include "AssistanceAI.hpp" | ||
|
||
#include "clKeyboardManager.h" | ||
#include "globals.h" | ||
#include "macromanager.h" | ||
|
||
#include <wx/app.h> //wxInitialize/wxUnInitialize | ||
#include <wx/ffile.h> | ||
#include <wx/filename.h> | ||
#include <wx/log.h> | ||
#include <wx/menu.h> | ||
#include <wx/msgdlg.h> | ||
#include <wx/progdlg.h> | ||
#include <wx/wupdlock.h> | ||
#include <wx/xrc/xmlres.h> | ||
|
||
namespace | ||
{ | ||
AssistanceAI* thePlugin = NULL; | ||
} | ||
|
||
// Allocate the code formatter on the heap, it will be freed by | ||
// the application | ||
CL_PLUGIN_API IPlugin* CreatePlugin(IManager* manager) | ||
{ | ||
if (thePlugin == 0) { | ||
thePlugin = new AssistanceAI(manager); | ||
} | ||
return thePlugin; | ||
} | ||
|
||
CL_PLUGIN_API PluginInfo* GetPluginInfo() | ||
{ | ||
static PluginInfo info; | ||
info.SetAuthor("Eran Ifrah"); | ||
info.SetName("AssistanceAI"); | ||
info.SetDescription(_("A built-in AI assistance")); | ||
info.SetVersion("v1.0"); | ||
return &info; | ||
} | ||
|
||
CL_PLUGIN_API int GetPluginInterfaceVersion() { return PLUGIN_INTERFACE_VERSION; } | ||
|
||
AssistanceAI::AssistanceAI(IManager* manager) | ||
: IPlugin(manager) | ||
{ | ||
m_longName = _("A built-in AI assistance"); | ||
m_shortName = _("A built-in AI assistance"); | ||
|
||
clKeyboardManager::Get()->AddAccelerator(_("Assistance AI"), | ||
{ { "show_ai_chat", _("Show AI Chat Window"), "Ctrl-Shift-I" } }); | ||
} | ||
|
||
AssistanceAI::~AssistanceAI() {} | ||
|
||
void AssistanceAI::CreateToolBar(clToolBarGeneric* toolbar) { wxUnusedVar(toolbar); } | ||
|
||
void AssistanceAI::CreatePluginMenu(wxMenu* pluginsMenu) { wxUnusedVar(pluginsMenu); } | ||
|
||
void AssistanceAI::HookPopupMenu(wxMenu* menu, MenuType type) | ||
{ | ||
wxUnusedVar(type); | ||
wxUnusedVar(menu); | ||
} | ||
|
||
void AssistanceAI::UnPlug() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
////////////////////////////////////////////////////////////////////////////// | ||
////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// copyright : (C) 2024 by Eran Ifrah | ||
// file name : AssistanceAI.h | ||
// | ||
// ------------------------------------------------------------------------- | ||
// A | ||
// _____ _ _ _ _ | ||
// / __ \ | | | | (_) | | ||
// | / \/ ___ __| | ___| | _| |_ ___ | ||
// | | / _ \ / _ |/ _ \ | | | __/ _ ) | ||
// | \__/\ (_) | (_| | __/ |___| | || __/ | ||
// \____/\___/ \__,_|\___\_____/_|\__\___| | ||
// | ||
// F i l e | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
////////////////////////////////////////////////////////////////////////////// | ||
////////////////////////////////////////////////////////////////////////////// | ||
#pragma once | ||
|
||
#include "cl_command_event.h" | ||
#include "plugin.h" | ||
|
||
class AssistanceAI : public IPlugin | ||
{ | ||
public: | ||
AssistanceAI(IManager* manager); | ||
virtual ~AssistanceAI(); | ||
virtual void CreateToolBar(clToolBarGeneric* toolbar); | ||
virtual void CreatePluginMenu(wxMenu* pluginsMenu); | ||
virtual void HookPopupMenu(wxMenu* menu, MenuType type); | ||
virtual void UnPlug(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# set the plugin name here | ||
set(PLUGIN_NAME "AssistanceAI") | ||
|
||
# Our project is called 'plugin' this is how it will be called in visual studio, and in our makefiles. | ||
project(${PLUGIN_NAME}) | ||
|
||
# It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'. | ||
|
||
# wxWidgets include (this will do all the magic to configure everything) | ||
include("${wxWidgets_USE_FILE}") | ||
|
||
# Include paths | ||
include_directories("${CL_SRC_ROOT}/Plugin" "${CL_SRC_ROOT}/sdk/wxsqlite3/include" "${CL_SRC_ROOT}/CodeLite" | ||
"${CL_SRC_ROOT}/CodeLite/ssh" "${CL_SRC_ROOT}/PCH" "${CL_SRC_ROOT}/Interfaces") | ||
|
||
add_definitions(-DWXUSINGDLL_WXSQLITE3) | ||
add_definitions(-DWXUSINGDLL_CL) | ||
add_definitions(-DWXUSINGDLL_SDK) | ||
add_definitions(-DASTYLE_LIB) | ||
|
||
if(USE_PCH AND NOT MINGW) | ||
add_definitions(-include "${CL_PCH_FILE}") | ||
add_definitions(-Winvalid-pch) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") | ||
endif() | ||
|
||
if(APPLE) | ||
add_definitions(-fPIC) | ||
endif() | ||
|
||
file(GLOB SRCS "*.cpp") | ||
|
||
# Define the output | ||
add_library(${PLUGIN_NAME} SHARED ${SRCS}) | ||
|
||
target_precompile_headers(${PLUGIN_NAME} REUSE_FROM PCH) | ||
|
||
# Remove the "lib" prefix from the plugin name | ||
set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") | ||
target_link_libraries(${PLUGIN_NAME} ${LINKER_OPTIONS} ${wxWidgets_LIBRARIES} libcodelite plugin) | ||
|
||
cl_install_plugin(${PLUGIN_NAME}) | ||
cl_install_file_shared(${CL_SRC_ROOT}/Runtime/astyle.sample) | ||
cl_install_file_shared(${CL_SRC_ROOT}/Runtime/php.sample) | ||
|
||
if(MINGW) | ||
# install clang-format | ||
msys_install_clang64_tool(clang-format.exe ${CL_INSTALL_BIN}) | ||
endif() |