掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
コード補完の取得 (ID:17407)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Delphi7以上ならIOTACodeInsightManagerでSymbolListを取得すれば 良いと思います。以下は手抜きですが、だいたいこんな感じだと思います。 パッケージを作ってインストールすれば、ショートカットCtrl+Bで起動します。 unit TestUnit; interface uses ToolsAPI, Classes; type TSampleBufferList = class(TNotifierObject, IOTAKeyboardBinding) private procedure BufferListProc(const Context: IOTAKeyContext; KeyCode: TShortCut; var BindingResult: TKeyBindingResult); public function GetBindingType: TBindingType; function GetDisplayName: string; function GetName: string; procedure BindKeyboard(const BindingServices: IOTAKeyBindingServices); end; procedure Register; procedure UnRegister; implementation uses Menus, Dialogs, SysUtils; var BindNo: integer; procedure Register; begin BindNo := (BorlandIDEServices as IOTAKeyBoardServices).AddKeyboardBinding(TSampleBufferList.Create); end; procedure UnRegister; begin (BorlandIDEServices as IOTAKeyBoardServices).RemoveKeyboardBinding(BindNo); end; { TSampleBufferList } procedure TSampleBufferList.BindKeyboard( const BindingServices: IOTAKeyBindingServices); begin BindingServices.AddKeyBinding([ShortCut(Ord('B'), [ssCtrl])], BufferListProc, nil); end; procedure TSampleBufferList.BufferListProc(const Context: IOTAKeyContext; KeyCode: TShortCut; var BindingResult: TKeyBindingResult); var CodeInsightServices: IOTACodeInsightServices; CodeInsightManager: IOTACodeInsightManager; SymbolList: IOTACodeInsightSymbolList; UserInput: string; Allow: boolean; i: integer; begin if Supports(BorlandIDEServices, IOTACodeInsightServices, CodeInsightServices) then begin if CodeInsightServices.CodeInsightManagerCount > 0 then CodeInsightManager := CodeInsightServices.CodeInsightManager[(CodeInsightServices.CodeInsightManagerCount -1)]; if not (CodeInsightManager = nil) then begin CodeInsightServices.SetQueryContext(Context.EditBuffer.TopView, CodeInsightManager); Allow := True; CodeInsightManager.AllowCodeInsight(Allow, #0); if not Allow then exit; UserInput := ''; if not CodeInsightManager.InvokeCodeCompletion(itManual, UserInput) then exit; CodeInsightManager.GetSymbolList(SymbolList); if SymbolList = nil then exit; for i := 0 to 10 do showMessage(SymbolList.SymbolText[i]); end; end; BindingResult := krHandled; end; function TSampleBufferList.GetBindingType: TBindingType; begin Result := btPartial; end; function TSampleBufferList.GetDisplayName: string; begin Result := 'テスト'; end; function TSampleBufferList.GetName: string; begin Result := 'Test.BufferList'; end; initialization finalization UnRegister; end.
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.