Would you like to develop the dynamic syntaix error prompt?

Discussion about CodeLite development process and patches
shushengyu
CodeLite Curious
Posts: 6
Joined: Sat Dec 07, 2013 9:35 am
Genuine User: Yes
IDE Question: zng
Contact:

Would you like to develop the dynamic syntaix error prompt?

Post 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!
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post 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
Make sure you have read the HOW TO POST thread
SteelRat
CodeLite Enthusiast
Posts: 17
Joined: Sat Dec 07, 2013 11:51 am
Genuine User: Yes
IDE Question: C++
Location: Russia
Contact:

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

Post 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.
-----------------------
Core2Duo E6750, 6Gb RAM, Ubuntu 12.04, CodeLite 5.3-110
syedshah20
CodeLite Curious
Posts: 1
Joined: Wed Oct 22, 2014 1:43 pm
Genuine User: Yes
IDE Question: IDE
Contact:

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

Post 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.
We offer guaranteed success for 642-885 vce exam questions - braindumps.com certification and ECCOUNCIL practice questions and the exams of University of California, San Francisco & Youtube.
Gibbon1
CodeLite Expert
Posts: 167
Joined: Fri Jul 22, 2011 5:32 am
Genuine User: Yes
IDE Question: C++
Contact:

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

Post 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
Post Reply