Я переключился мой код в версию Реми Лебо с помощью директив #pragma start и #pragma exit.
Что теперь происходит, когда я пытаюсь его использовать (см. мой код ниже) ) это:
Когда для CodeGuard установлено значение активно:
- Я нажал F9 -> Проект компилируется хорошо (за исключением [Предупреждение TLIB] Внимание: библиотека слишком велика для размера страницы, перестроена с размером страницы 32)
Запускается второй экземпляр bds.exe (поскольку я установил его в качестве главного приложения) - Во втором экземпляре я попытайтесь установить мой пакет, что приведет к следующей ошибке:
- TMyCodeInsightSymbolList::TMyCodeInsightSymbolList
TMyCodeInsightSymbolList::TMyCodeInsightSymbolList
TMyCodeInsightManager::TMyCodeInsightManager - TMyCodeInsightManager::GetIDString
- TMyCodeInsightManager::GetIDString
- TMyCodeInsightManager::GetIDString
- TMyCodeInsightManager::GetIDString
- TMyCodeInsightManager::GetIDString
Код: Выделить всё
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
this->|
}
Результирующие MessageBoxes:
- TMyCodeInsightManager::HandlesFile
- TMyCodeInsightManager::GetEnabled
- TMyCodeInsightManager::AllowCodeInsight
- TMyCodeInsightManager::EditorTokenValidChars
- TMyCodeInsightManager::PreValidateCodeInsight
- TMyCodeInsightManager::EditorTokenValidChars
- TMyCodeInsightManager::InvokeCodeCompletion< /li>
TMyCodeInsightManager::GetSymbolList - TMyCodeInsightSymbolList::GetCount
- TMyCodeInsightSymbolList::~TMyCodeInsightSymbolList
- TMyCodeInsightSymbolList::~TMyCodeInsightSymbolList
- TMyCodeInsightManager::GetSymbolList
- TMyCodeInsightSymbolList::GetCount
- TMyCodeInsightSymbolList::~TMyCodeInsightSymbolList
- strong>
- TMyCodeInsightManager::GetSymbolList
Ошибка:
{...
Кроме того, в настройках IDE во втором экземпляре в Параметры редактора -> CodeInsight я вижу свой новая запись в ComboBox Тип исходного файла, но когда я выбираю ее, возникает ошибка вне диапазона, поэтому я думаю, что в IDE отсутствуют некоторые записи реестра для моего менеджера завершения или чего-то подобного. Я прав?
Вот мой код:
my_completion.cpp
Код: Выделить всё
#pragma hdrstop
#pragma package(smart_init)
#include "my_codeinsight_manager.h"
static int FCodeManagerIndex = -1;
void DoRegister()
{
_di_IOTACodeInsightServices CIS;
if (BorlandIDEServices->Supports(CIS))
FCodeManagerIndex = CIS->AddCodeInsightManager(new TMyCodeInsightManager);
}
#pragma startup DoRegister
void DoUnregister()
{
_di_IOTACodeInsightServices CIS;
if ((FCodeManagerIndex != -1) && BorlandIDEServices->Supports(CIS))
CIS->RemoveCodeInsightManager(FCodeManagerIndex);
}
#pragma exit DoUnregister
#pragma argsused
extern "C" int _libmain(unsigned long reason)
{
return 1;
}
Код: Выделить всё
#ifndef my_codeinsight_managerH
#define my_codeinsight_managerH
//---------------------------------------------------------------------------
#include
#include
#include
#include "my_codeinsight_symbollist.h"
//---------------------------------------------------------------------------
class TMyCodeInsightManager : public TCppInterfacedObject
{
public:
TMyCodeInsightManager();
virtual __fastcall ~TMyCodeInsightManager();
String __fastcall GetName();
String __fastcall GetIDString();
bool __fastcall GetEnabled();
void __fastcall SetEnabled(bool AValue) ;
TSysCharSet __fastcall EditorTokenValidChars(bool APreValidating);
void __fastcall AllowCodeInsight(bool& Allow, const WideChar AKey);
bool __fastcall PreValidateCodeInsight(const String AStr);
bool __fastcall IsViewerBrowsable(int AIndex);
bool __fastcall GetMultiSelect();
void __fastcall GetSymbolList(_di_IOTACodeInsightSymbolList& ASymbolList);
void __fastcall OnEditorKey(WideChar AKey, bool& ACloseViewer, bool& AAccept);
bool __fastcall HandlesFile(const String AFileName);
String __fastcall GetLongestItem();
void __fastcall GetParameterList(_di_IOTACodeInsightParameterList& AParameterList);
void __fastcall GetCodeInsightType(WideChar AChar, int AElement, TOTACodeInsightType& ACodeInsightType, TOTAInvokeType& AInvokeType);
bool __fastcall InvokeCodeCompletion(TOTAInvokeType AHowInvoked, String& AStr);
bool __fastcall InvokeParameterCodeInsight(TOTAInvokeType AHowInvoked, int& ASelectedIndex);
void __fastcall ParameterCodeInsightAnchorPos(TOTAEditPos& AEdPos);
int __fastcall ParameterCodeInsightParamIndex(const TOTAEditPos& AEdPos);
String __fastcall GetHintText(int AHintLine, int AHintCol);
String __fastcall GetOptionSetName();
bool __fastcall GotoDefinition(String& AFileName, int& ALineNum, int AIndex=0xFFFFFFFF);
void __fastcall Done(bool AAccepted, bool& ADisplayParams);
__property String Name = {read=GetName};
__property bool MultiSelect = {read=GetMultiSelect};
__property bool Enabled = {read=GetEnabled, write=SetEnabled};
/* IOTANotifier */
void __fastcall AfterSave() {}
void __fastcall BeforeSave() {}
void __fastcall Destroyed() {}
void __fastcall Modified() {}
private:
std::unique_ptr FSymbolList;
TSysCharSet FSysCharSet;
};
Код: Выделить всё
#include
#pragma hdrstop
#include "my_codeinsight_manager.h"
// ---------------------------------------------------------------------------
#pragma package(smart_init)
TMyCodeInsightManager::TMyCodeInsightManager()
: FSymbolList(std::unique_ptr(new TMyCodeInsightSymbolList))
{
FSysCharSet = TSysCharSet()
Подробнее здесь: [url]https://stackoverflow.com/questions/41932738/registering-a-custom-codeinsight-manager-what-am-i-doing-wrong[/url]