Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Python Code Completion
darmar:
--- Quote from: dmoore on October 24, 2012, 03:36:41 am ---Here's a revised patch to try. I've made the needed change to the fortran plugin as well.
--- End quote ---
I would like to explain how the same thing is functioning now (without this patch).
--- Code: ---Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 8464)
@@ -727,8 +727,12 @@
if ( ParserCommon::FileType(filename) == ParserCommon::ftOther
&& Manager::Get()->GetPluginManager()->IsFileExtRegistered(filename) )
return;
--- End code ---
The idea is the same as in dmoore's patch. The function "IsFileExtRegistered" is doing similar thing as "IsProviderFor(ed)" in this patch.
Every CC plugin should register file extensions it like to handle. In FortranProject plugin the corresponding code is:
--- Code: ---void FortranProject::RegisterFileExtensions()
{
PluginManager* plugman = Manager::Get()->GetPluginManager();
StringSet fileExts;
m_pNativeParser->GetFortranFileExts(fileExts);
plugman->RegisterCCFileExts(_T("FortranProject"), fileExts);
}
--- End code ---
So, Python CC should register file extensions it like to handle with "plugman->RegisterCCFileExts(_T("PythonCC"), fileExts);".
If developers prefer to apply this patch, it is OK from FortranProject plugin's point of view. You just need to delete Rev 7922 patch (in this patch the required changes were made in C::B API and CC plugin).
danselmi:
Aren't these the same extensions as used for Syntax highlighting? (configured in Settings->Editor->SyntaxHighlighting->Filemasks)
MortenMacFly:
--- Quote from: danselmi on October 30, 2012, 11:41:52 am ---Aren't these the same extensions as used for Syntax highlighting? (configured in Settings->Editor->SyntaxHighlighting->Filemasks)
--- End quote ---
Yes, ...so what? Id that bad? ???
The only issue I see here is that oe can change the nbame of the file group. Like I did for example with "Sources" which I renamed to "C/C++ Sources" and "Fortran Sources" to group these files. As the categories can change this may break functionality, see for example:
FileType FileTypeOf(const wxString& filename) in globals.cpp
Here I had to change:
--- Code: --- if (fgm->GetGroupName(i) == _T("Sources") && fgm->MatchesMask(ext, i))
return ftSource;
if (fgm->GetGroupName(i) == _T("Headers") && fgm->MatchesMask(ext, i))
return ftHeader;
--- End code ---
...to:
--- Code: --- if (fgm->GetGroupName(i).Contains(_T("Source")) && fgm->MatchesMask(ext, i))
return ftSource;
if (fgm->GetGroupName(i).Contains(_T("Header")) && fgm->MatchesMask(ext, i))
return ftHeader;
--- End code ---
(Notice the "Contains").
To use this properly we should introduce constant identifiers for file groups and readable names only as an alias, which may be extendible by plugins (using a GetNewFileGroupID() method or alike).
danselmi:
--- Quote from: MortenMacFly on October 30, 2012, 01:12:57 pm ---
--- Quote from: danselmi on October 30, 2012, 11:41:52 am ---Aren't these the same extensions as used for Syntax highlighting? (configured in Settings->Editor->SyntaxHighlighting->Filemasks)
--- End quote ---
Yes, ...so what? Id that bad? ???
--- End quote ---
So I have to configure the same thing twice? Once for syntax highlighting and a second time for CC?
darmar:
--- Quote from: danselmi on October 30, 2012, 11:41:52 am ---Aren't these the same extensions as used for Syntax highlighting? (configured in Settings->Editor->SyntaxHighlighting->Filemasks)
--- End quote ---
Not exactly.
It is because CodeCompletion plugin wants to make code-completion not only for C/C++, but for other languages similar to C++ too.
The logic in CC is:
if (file is C/C++ or other language but without specific code-completion plugin):
make code-completion.
Maybe it would be possible to register language instead of file extensions.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version