pns_debug_tool: Add option to go to definition in vs code
Todo: add a way to add other IDEs and select them via GUI or advanced config
This commit is contained in:
parent
b89fefffb1
commit
3a95bd1bd1
|
@ -153,6 +153,7 @@ PNS_LOG_VIEWER_FRAME::PNS_LOG_VIEWER_FRAME( wxFrame* frame ) :
|
|||
wxITEM_NORMAL );
|
||||
m_listPopupMenu->Append( ID_LIST_SHOW_ALL, wxT( "Show all" ), wxT( "" ), wxITEM_NORMAL );
|
||||
m_listPopupMenu->Append( ID_LIST_SHOW_NONE, wxT( "Show none" ), wxT( "" ), wxITEM_NORMAL );
|
||||
m_listPopupMenu->Append( ID_LIST_DISPLAY_LINE, wxT( "Go to line in vs code" ), wxT( "" ), wxITEM_NORMAL );
|
||||
|
||||
m_itemList->Connect( m_itemList->GetId(), wxEVT_TREELIST_ITEM_CONTEXT_MENU,
|
||||
wxMouseEventHandler( PNS_LOG_VIEWER_FRAME::onListRightClick ), nullptr,
|
||||
|
@ -601,7 +602,27 @@ void PNS_LOG_VIEWER_FRAME::onListRightClick( wxMouseEvent& event )
|
|||
|
||||
return;
|
||||
}
|
||||
case ID_LIST_DISPLAY_LINE:
|
||||
{
|
||||
wxVector<wxTreeListItem> selectedItems;
|
||||
|
||||
if( m_itemList->GetSelections( selectedItems ) == 1 )
|
||||
{
|
||||
wxString filename = m_itemList->GetItemText(selectedItems.back(), 2);
|
||||
wxString line = m_itemList->GetItemText(selectedItems.back(), 4);
|
||||
|
||||
//todo: add IDE selection somewhere in the GUI
|
||||
// clion:
|
||||
//wxExecute( wxString::Format( "clion --line %s %s", line, m_filenameToPathMap[filename] ) );
|
||||
|
||||
if( !filename.empty() && !line.empty() )
|
||||
wxExecute( wxString::Format("code --goto %s:%s", m_filenameToPathMap[filename], line) );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -726,7 +747,13 @@ void PNS_LOG_VIEWER_FRAME::buildListTree( wxTreeListItem item,
|
|||
m_itemList->SetItemText( ritem, 1, ent->m_name );
|
||||
}
|
||||
|
||||
m_itemList->SetItemText( ritem, 2, wxFileNameFromPath( ent->m_srcLoc.fileName ) );
|
||||
wxString fullfilepath = ent->m_srcLoc.fileName;
|
||||
wxString filename = wxFileNameFromPath( fullfilepath );
|
||||
|
||||
if( !filename.empty() )
|
||||
m_filenameToPathMap.insert( { filename, fullfilepath } );
|
||||
|
||||
m_itemList->SetItemText( ritem, 2, filename );
|
||||
m_itemList->SetItemText( ritem, 3, ent->m_srcLoc.funcName );
|
||||
m_itemList->SetItemText( ritem, 4, wxString::Format("%d", ent->m_srcLoc.line ) );
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#define ID_LIST_COPY 10001
|
||||
#define ID_LIST_SHOW_ALL 10002
|
||||
#define ID_LIST_SHOW_NONE 10003
|
||||
#define ID_LIST_DISPLAY_LINE 10004
|
||||
|
||||
class PNS_LOG_VIEWER_OVERLAY;
|
||||
|
||||
|
@ -89,6 +90,7 @@ private:
|
|||
int m_rewindIter;
|
||||
wxMenu* m_listPopupMenu;
|
||||
std::shared_ptr<KIGFX::VIEW_GROUP> m_previewItems;
|
||||
std::map<wxString,wxString> m_filenameToPathMap;
|
||||
|
||||
bool m_showThinLines = true;
|
||||
bool m_showRPIs = true;
|
||||
|
|
Loading…
Reference in New Issue