Consider project specific formatting settings for auto format

A fall back to the workspace wide formatting settings happens if the
project settings couldn't be accessed.

Fixes #1002331
Oh yes, I want to be able to keep regular `\n`. I copied the code from a different location where the text also contains such `\n`, in this case the last `\n` is not important.