Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: koonschi on September 19, 2013, 04:51:12 pm

Title: Underlining Compile errors in code
Post by: koonschi on September 19, 2013, 04:51:12 pm

I was thinking of writing a plugin for codeblocks for underlining compile errors and warnings in the code.
A lot of IDEs have this feature and I find it extremely useful when I can see the errors without hitting F9 to recompile the code, especially when working on bigger projects where compile times are generally higher.

To realize this, I was thinking of creating a plugin that basically runs the compiler in the background for the currently opened file, build target, and project. This would of course take into account the project settings specified by that build target/project.
After the compiler finished, its output is parsed, and the lines specified in the output are underlined.
When you hover your mouse over the underlined line you get a tooltip telling the exact error.

I think that this should not be too hard to achieve, as codeblocks can already parse compiler output, and it can underline things in the editor.

Now, there is a general problem with this approach: Compiling takes time. So the compiler would only be run for the currently edited file (the one in the editor that has the focus).
And it would be run possibly whenever the file is saved or opened (I'm open for proposals).
Of course, underlining specific errors in one line would not be possible with all compilers. Imagine 2 statements in 1 line, with some compilers it would be hard to find out which statement caused the error. For now I only know 2 compilers that are specific enough for such things, gcc 4.8+ and clang.
So I'd say I underline the whole line (except for the starting spaces).

The big (rather obvious) downside of such a plugin would be its performance consummation, as a compiler thread (process?) would be running almost non-stop in the background. Especially if you're a programmer who hits CTRL + S often.

So, would writing such a plugin be realistic? I'm asking because I've never before seen something similar in the forums, and maybe I'm overlooking something?
Title: Re: Underlining Compile errors in code
Post by: ollydbg on September 19, 2013, 05:11:17 pm
There is already such plugin by morten, I forgot the name. Maybe compile on save plugin. You can search the forum.
Title: Re: Underlining Compile errors in code
Post by: oBFusCATed on September 19, 2013, 05:26:07 pm,15915.0.html