Visual Studio Code native formatter messing with PHP code format
Get the solution ↓↓↓I'm having problems with Visual Studio Code. When I'm editing PHP code, and inputing an if/else statement, when I type else and hit ENTER, I get this crap formatting that looks like the following code segment and I have to manually change it (which is annoying to say the least).
if (...)
{
}
else {
# code...
}
I turned off all extensions and it's still doing it, so it's something native in Visual Studio Code itself. I've scoured the settings and it doesn't seem to be anything in there. A google search didn't help much either. I found a similar type of question here on Stack Overflow, but that was dealing with C++, and was the opposite of what I'm trying to do. It's almost like it's some type of autocomplete function, but I have that turned off too.
Any ideas where to look?
Thanks.
Answer
Solution:
After some digging, I figured out what was going on. It's a feature of Visual Studio Code that I was not aware of. The feature is code snippets. It doesn't appear anywhere on the menus which is why I missed it. So you have to go (View -> Command Palette) then type in insert snippet. Then you can select all the different snippets that are available. You can also turn them off, which is what I did. The specific one was 'else'. Once that was done, it didn't do it anymore.
So, problem solved.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: object of class stdclass could not be converted to string
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.