LaurentTreguier / vscode-uncrustify

Code format using uncrustify
66 stars 10 forks source link

Cannot open uncrustify.cfg by creating option. #11

Closed everLEEst closed 7 years ago

everLEEst commented 7 years ago

after creating uncrustify.cfg by uncrustify.create, If I try to open the file, it always failed with 'Cannot read property 'tag' of undefined.'

LaurentTreguier commented 7 years ago

Looks awfully similar to #9... What are the contents of uncrustify.cfg? Is it created correctly?

LaurentTreguier commented 7 years ago

I think it should be fixed now. But I could be wrong, so please re-open if it's not the case.

everLEEst commented 7 years ago

yeah let me check it tomorrow. thanks a lot for fast resolve :) 👍 by the way, have you any plan to apply range formatting feature? It only needs really few code changes with using '--frag' option in uncrustify, and actually I locally modify the feature and it works well with block selections. If you don't mind I could just contribute my code as well.

LaurentTreguier commented 7 years ago

Why not ? I simply didn't know Uncrustify had this option. Has it always been there or is it only past a certain version ?

everLEEst commented 7 years ago

ftp://history.knowsley.gov.uk/hpux/Development/Tools/uncrustify-0.60/uncrustify-0.60.man.html at least the link said the option was exist in 2009, and my opensource project formatting rule is really something special even powerful uncrustify cannot supporting them fully, so I generally use some modified version based in 2014, and it works well in that version though. But yeah they have really weak documents so hardly find the way of using it. my project don't allow rewrite code for formatting which can be changed git author, so I need range format option and I find that these option can be useful :)

GijsGoudzwaard commented 7 years ago

I'm having the same issue. Everytime I click on uncrustify.cfg it gives the error Unable to open 'Uncrustify configuration': Cannot read property 'tag' of undefined. The uncrustify.cfg is generated by using uncrustify.create

This issue should be reopened

LaurentTreguier commented 7 years ago

I have had this issue as well when I last worked on this extension... I'll try to see where it comes from. In the meantime, simply re-creating the file can fix it, sometimes it doesn't work and sometimes it does work.

GijsGoudzwaard commented 7 years ago

I recreated the file like 5 times in a row and it didn't work any of the 5 times

GijsGoudzwaard commented 7 years ago

When I open the file in vim it is empty, maybe the problem is that it doesn't setup the file correctly?

LaurentTreguier commented 7 years ago

Yes, the problem is that the file is not written properly. But it's random, sometimes it works for me... You can manually create the file with uncrustify --update-config-with-doc > uncrustify.cfg for now. If that doesn't work...

GijsGoudzwaard commented 7 years ago

Your command didn't work, using this command uncrustify --update-config-with-doc -c uncrustify.cfg > uncrustify.cfg did work for me.

LaurentTreguier commented 7 years ago

Ok, what version of uncrustify do you have ?

GijsGoudzwaard commented 7 years ago

v0.59

LaurentTreguier commented 7 years ago

So this version simply needs an original config file with newer versions don't... Creating an empty file first and then filling it (just like you did) works with any version, so I guess this is how I should handle it.

LaurentTreguier commented 7 years ago

Hopefully this won't need to be re-opened again