Page 1 of 1

Would you like to develop the dynamic syntaix error prompt?

Posted: Mon Dec 09, 2013 5:17 pm
by shushengyu
Codelite is very excellent at many aspects, event better than vc, developing it is a great job and I would like to express my great praise to you.But compared with the currrent vc, it is simple in some aspects.
For example, dynamic checking the syntax error(may be I have not expressed this well for my poor English).
I want to implement this function, but I have not the comlete idea and can image some diffculty.
For example, if there is need a special thread parse the source periodly? if so, it is too expensive , or only parse a source file, but
will output many error, or immplent some "increment parse", it is seems very diffculty too.
And how can let the editor draw a red wave line under the error. Is current codeliet editor control can support the function?
Can you give me some advices, thanks!

Re: Would you like to develop the dynamic syntaix error prom

Posted: Mon Dec 09, 2013 5:47 pm
by eranif
Hi,

I think I understand what you mean. You want to implement some syntax check as you type (or close to this)
This idea is raised often and the best solution for this is to use clang.

codelite is linking (on all platforms) with libclang.dll (or so/dylib depending on your OS)
This library can provide static analysis for your source file based on API.

codelite already has all the infrastructure for doing this, you can start by looking up at the way I have implemented code completion based on clang.
Start from the source file "clang_code_completion.cpp", more specifically, it parse the file on every file save to create a new TU object ( Translation Unit )

Code: Select all

void ClangCodeCompletion::OnFileSaved(wxCommandEvent& e)
{
    e.Skip();
    CHECK_CLANG_ENABLED_RET();

    if( TagsManagerST::Get()->GetCtagsOptions().GetFlags() & ::CC_DISABLE_AUTO_PARSING) {
        CL_DEBUG(wxT("ClangCodeCompletion::OnFileSaved: Auto-parsing of saved files is disabled"));
        return;
    }

    // Incase a file has been saved, we need to reparse its translation unit
    wxFileName fn( e.GetString() );
    if(!TagsManagerST::Get()->IsValidCtagsFile(fn))
        return;

    m_clang.ReparseFile( fn.GetFullPath() );
}
See here: http://clang.llvm.org/doxygen/group__CINDEX.html

Eran

Re: Would you like to develop the dynamic syntaix error prom

Posted: Mon Dec 09, 2013 6:44 pm
by SteelRat
I've seen this feature in Eclipse and MS VS 2012/3 and i'm turned it off. Especially Eclipse, where dynamic error checking disallows me to begin build of project! Very annoying thing for me.

Re: Would you like to develop the dynamic syntaix error prom

Posted: Wed Oct 22, 2014 1:49 pm
by syedshah20
Not sure if I should file a feature request for this but the other day I created a new project and fumble fingered the name of a existing project in the work space and it quietly overwrote the existing project file.

Re: Would you like to develop the dynamic syntaix error prom

Posted: Thu Oct 23, 2014 3:50 am
by Gibbon1
That sounds similar or the same as a bug I files a year and a half ago

http://forums.codelite.org/viewtopic.php?f=13&t=2368