Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Short-term quick patching code completion (for 1.0 / 1.1) ideas
rickg22:
--- Quote from: mispunt on June 04, 2007, 09:24:17 am ---It would be a great improvement to store the data in a database. And I don't think it will give much trouble. Important is that you do it in a branch and keep it simple.
--- End quote ---
I made it a contrib plugin 8) with its own cbp. I could effectively compile it and use it as C::B's code completion, but I had to delete the old codecompletion.dll. Anyway, now i'm starting to modify it.
*Takes a deep plunge* Here i go!
Biplab:
Can we have the code or a binary plugin for testing? :)
rickg22:
As soon as it compiles :lol: See, I'm changing one file and everything breaks.
But here's an snip of what I'm currently doing:
--- Code: ---wxString Token::GetName() const
{
return m_db->GetTokenName(m_id);
}
wxString Token::GetArgs() const
{
return m_db->GetTokenArgs(m_id);
}
wxString Token::GetType() const
{
return m_db->GetTokenType(m_id);
}
TokenID Token::GetParent()
{
return m_db->GetTokenParent(m_id);
}
--- End code ---
The thing is that all searches were done using in-memory data structures, so Token, TokenTree etc. were seen as arrays or the-like, and you see them referenced in for-loops and everything. Since we're switching to offline database, the parser becomes a client-server implementation.
m_db is the database wrapper. It'll have a cached copy of the most recent Token data to keep things fast.
Biplab:
So is it going to keep the most commonly used header files in a DB? That would be nice. Or maybe an option can be kept for users to define the most commonly used headers. :)
eranif:
Hi,
I can only give you an advise of how I used SQLite for the same purpose:
I am using 2 databases.
One for the commonly used headers which are unlikely to be chaned (e.g. /usr/include)
And one per workspace.
- User can add to the common database entries manually or from the GUI.
- User can replace the common database by simple 'File Open' dialog
- The common database can be shipped with C::B installation (huge advantage)
The parser thread only updates the workspace database.
When user clicks . or -> or Ctrl+Space, queries are made against both databases and the results are merged (the price of doing so, using prepared statements and in-memory feature of sqlite, is very low).
Hope you will find this useful.
Eran
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version