-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix script errors reporting wrong line numbers #937
Conversation
Nice @dedmen Looks like you are already on that path. Thank you! |
This has bugged me for so long in ace too, good solve 👍 |
For the regex this should do it: ^\s*(/\*.+?\*/)\s*#include\s*"script_component\.hpp" In sublime add the flags Replace with: #include "script_component.hpp"\n\1 |
correct I wanted to... Oh.. @SilentSpike Don't steal my work!!!!!111!11" |
Does anyone know if the documentation generator tool thingy can handle this without problems? |
@@ -24,8 +25,6 @@ Examples: | |||
Author: | |||
Written by Deadfast and made CBA compliant by Vigilante | |||
---------------------------------------------------------------------------- */ | |||
|
|||
#include "script_component.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match the default style. So I'd say it's okey that, that newline is gone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not sure if you used my regex, but I specifically made it account for cases where there might be space and strip it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used yours. But slightly modified [\s\S]
instead of .
What about files that don't have the include? Like https://github.com/CBATeam/CBA_A3/blob/master/addons/ai/fnc_searchNearby.sqf lol wtf CBA_A3/addons/common/fnc_getFov.sqf Line 28 in ffd5fa7
What should I do with this: CBA_A3/addons/strings/fnc_formatElapsedTime.sqf Lines 21 to 22 in 815dac2
CBA_A3/addons/strings/fnc_formatNumber.sqf Lines 58 to 59 in 815dac2
CBA_A3/addons/vectors/fnc_polar2vect.sqf Lines 23 to 26 in fd62c89
Shouldn't the SCRIPT macro take care of scriptName? CBA_A3/addons/xeh/fnc_init.sqf Line 22 in 7f53215
? |
The last commit has stuff that was not just done automatically. Take special care about that when reviewing the PR. I'm done now. Just need someone to check the makeDocs script with this. I don't have perl or "NaturalDocs" |
Merge asap, to avoid merge conflicts. |
I'll happily fix conflicts. If you merge #939 I'll have to add these anyway. If something is wrong in here it could break CBA at any point, sensitive or not. Don't wanna take that risk |
The last commit looks all good 👍 |
Just waiting for #937 (comment) |
Patience. Will review this week. Promised. |
You wanted it merged asap, not me :D |
preprocessFileLineNumbers "x\cba\addons\common\fnc_currentUnit.sqf"
Before: https://gist.github.com/dedmen/896504ced548b9e2f9de738525908510
After: https://gist.github.com/dedmen/1ffc539dbec1d016d602b62888f94943
Let's superimpose the actual script together with the line numbers.
Before:
Was the getVariable on line 6? Is that correct? NO!
CBA_A3/addons/common/fnc_currentUnit.sqf
Line 19 in ffd5fa7
That's line 19!
After:
Was the getVariable on line 19? Is that correct? YES!
CBA_A3/addons/common/fnc_currentUnit.sqf
Line 19 in ffd5fa7
That's indeed line 19!
The above will cause script error messages to be on the wrong line exactly like I showed you here. Because the in-engine representation is broken because of this preprocessor bug.
And because the game doesn't know where the F it is right now, neither does my debugger. Which makes CBA not debugable. You set a breakpoint on Line 19, but never hit it because Line 19 is actually Line 6.
This PR is WIP. I will add all the other files too. Just wanted to get this visualization out before I actually get everything done.
Scripts that grab the header to generate documentation probably also have to be updated.