Errors As-You-Type

Discussion about CodeLite development process and patches
wiley
CodeLite Curious
Posts: 1
Joined: Sun May 25, 2014 10:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Errors As-You-Type

Post by wiley »

I'm somewhat new to CodeLite, but I'm really liking what's here.
One thing I noticed is that when using Clang autocompletion, triggering autocomplete has the side effect of showing you all the errors in the file because Clang has to reparse it. It looks like this doesn't cause any significant latency, and I was wondering if the same Clang backend could be used to implement Intellisense-like continuous error detection to show likely compiler errors before you hit compile.

I realize that this would be Clang-only, as ctags just wasn't built for this, but is there any big reason it couldn't work? Just wait for the user to stop typing for, say, half a second, then trigger a reparse and show the errors.

I'd be willing to look into implementing it if it seems feasible. Any thoughts?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Errors As-You-Type

Post by eranif »

wiley wrote:I'm somewhat new to CodeLite, but I'm really liking what's here.
One thing I noticed is that when using Clang autocompletion, triggering autocomplete has the side effect of showing you all the errors in the file because Clang has to reparse it. It looks like this doesn't cause any significant latency, and I was wondering if the same Clang backend could be used to implement Intellisense-like continuous error detection to show likely compiler errors before you hit compile.

I realize that this would be Clang-only, as ctags just wasn't built for this, but is there any big reason it couldn't work? Just wait for the user to stop typing for, say, half a second, then trigger a reparse and show the errors.

I'd be willing to look into implementing it if it seems feasible. Any thoughts?
I believe that some work was invested in the area by upCASE ( a forum user ), I will try to contact him and see if his work is in a "working" condition (or maybe I got it all wrong...)

About implementation:
- Such implementation _must_ be configurable (default is set to OFF)
- Instead of parsing "as-you-type" I would go for "as-you-save" (the current code completion also parses files on-save)
- When you mention that you don't notice any latency, can I guess that you are using Linux? On large windows projects it is slow.. (the first parse)
notice that I have implemented a cache that stores the TU (Translation Unit) which can be usable for later reparsing (you still need to pass the "un-saved buffer")
but most of the code completion code (clang) already has this logic implemented

Have a look here:
https://github.com/eranif/codelite/blob ... _manager.h

Eran
Make sure you have read the HOW TO POST thread
Post Reply