Closed mundodisco8 closed 6 years ago
There is a configuration setting, uncrustify.debug
, which when set to true
, will show some info in an output channel. However, I can't reproduce this bug... When I try with a very basic incorrect code like int main(
, uncrustify still outputs something. I've tried on Linux with uncrusify 0.64 and on Windows with uncrustify 0.66.1. Do you have some code extract I could use that always produces this bug ?
I'm away from the computer and officially on holidays (yay!) until new year so it will take me some time to get back to this thread but i will set a reminder to send you some code. I will play with the debug a bit too.
Happy new year!
On 22 Dec 2017 18:42, "Laurent Tréguier" notifications@github.com wrote:
There is a configuration setting, uncrustify.debug, which when set to true, will show some info in an output channel. However, I can't reproduce this bug... When I try with a very basic code like int main(, uncrustify still outputs something. I've tried on Linux with uncrusify 0.64 and on Windows with uncrustify 0.66.1. Do you have some code extract I could use that always produces this bug ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LaurentTreguier/vscode-uncrustify/issues/20#issuecomment-353654188, or mute the thread https://github.com/notifications/unsubscribe-auth/AIA3ExMMqm0OBrtwZcDjXXnkBpnfgqTSks5tC_gtgaJpZM4RLJOq .
Well, merry Christmas and happy new year then!
Hi!
This is the code I was working on. In line 230 there is an extra bracket. As it is now, formatting it will delete all my code. If I remove it, the formatting operation works. I activated the debug output but I get no output at all.
Ok, so I tested uncrustify 0.65 specifically... and I got the bug. It's only with version 0.65, so I think it's actually an uncrustify bug. However this issue made me realize that the installation/upgrade of this extension is broken, which is why even if version 0.65 is outdated the extension doesn't offer you to upgrade your uncrustify installation. It should be fixed in a quick update.
Thanks for taking the time to find a solution to my problem, I really appreciate it.
Cheers!
Hi Laurent,
I tried with uncrustify v0.66. Using the executable from the console in this test file (notice the extra parenthesis after the while):
void main () {
while((true+1) {
printf("hey!");
}
}
I get this oputput
C:\Users\Joel\Desktop\Timer\_02_TimerStateMachine>uncrustify -c uncrustify.cfg -p debug.txt -f test.c
uncrustify.cfg:38 Unknown symbol 'align_number_left'
Parsing: test.c as language C
parse_cleanup(437): test.c, orig_line is 5, Error: Unexpected '}' for 'SPAREN_OPEN', which was on line 2
Unmatched BRACE_CLOSE
at orig_line=5, orig_col=1
Try the option 'tok_split_gte = true'
Removing the extra parenthesis I get the expected output, VS Code formats the code and adds spaces before and after the + sign.
In Visual Studio Code, my code is gone. Is there something I'm missing or doing wrong? The only preference I've changed is "uncrustify.configPath": "C:/Program Files (x86)/UniversalIndentGUI_win32/indenters/uncrustify.cfg"
The path to my uncrustify exe is in the system path.
I can't get the graphical editor for the config to open either.
Version 2.8.4 fixes the problem of erasing all the code when there is a syntax error... However I don't know why the graphical editor can't start. Is it simply showing the text file, or is it showing the graphical editor incorrectly ? (that happened to me at some point while developing)
The Unknown symbol 'align_number_left'
warning very probably comes from having an outdated config file considering the version of uncrustify. With the graphical editor, the config file can be upgraded, however since it's not working for you right now, I'd suggest merging your config file with the newest default uncrustify config file. On Windows, if you don't have a merge tool installed, KDiff3 is free and open-source, and seems pretty capable to me (a bunch of them are also listed here).
I'm using Universal Indent GUI to get my format file, and the differences between the two files are too many for a merge, and the tools I tried basically suggest the complete deletion of one of the files and the complete inclusion of the other.
When I open the .cfg file I just get the text, as with any other files. I tried with the default uncrustify file, default.cfg, renamed uncrustify.cfg, and it also prints the text as normal.
I get this error when I try to open the cfg file on the root of the project. Hope it helps. As I said, this is a config file straight out of Universal GUI Indent. It works with the uncrustify executable from the command line, although it complains about line 38 (removing it has no effect on the behaviour of your plugin). uncrustify.zip
PS: I think the problem might be in the fact that Univesal indent GUI has not been updated for more than 5 years, maybe uncrustify has advanced and now the cfg files generated by UIGUI are not working on uncrustify anymore :S
Version 2.8.5 should fix it. The extension should be able to parse your config file, and will offer you to upgrade it to have all the latest comments and uncrustify config features.
Thanks for your support, I will test it during next week.
Hi,
I'm using the latest version of your plugin. When my file has an error and I try to process it with the format document command, all the text is deleted. I attach a video. there are two errors in the file, an extra parenthesis and an extra bracket.
Link to the video
In the video, I use the format document command, the text disappears, then I undo, correct one of the errors, try again, text disappears again, and then remove the latest error, and the command works. I attach my uncrustify config too. Is there a log that I can check to see what is going on? This is a bit of a pain because I see no indication of the error and I have to either compile the code or comment sections until I find the problem. I use the same uncrustify config with Atom and I didn't have this issue, but I'm kind of new to all this uncrustify thing and I could be doing something wrong.
Thanks
Uncrustify config: uncrustify.zip