I use phpfmt to format the php files according to PSR1 standard.
Every time I use the Format Document function (Shift + Alt + F) in Visual Studio Code, the parentheses have been removed from the require_once lines.
require_once($CFG->dirroot.'/lib/filelib.php');
-> require_once $CFG->dirroot.'/lib/filelib.php';
This is what I do not want. Because when uploading these files to Moodle, Moodle will throw errors:
(#30) "require_once" must be immediately followed by an open parenthesis
Problem: How to use the quick format under PSR1 without removing the parentheses of require_once?
Put this in settings.json: "phpfmt.exclude": ["RemoveIncludeParentheses"],
But its still put a space after require_once.
Related
When I open a file in VS Code and press Alt + Shift + F, the opened file gets formatted. The 2 spaces indentation gets used in html, js, etc. even though my configurations specify 4 spaces. How could I fix it?
I can refer the same issue in Visual Studio. Relevent changes for each type of file extesion exist in different section with the same heading. For example C# and JavaScript/TypeScript has the same settings. So make sure you are modifying correct one.
I want visual studio code to suggest an autocompletion for an entire line if I start typing the first few characters of any line already in the file, regardless of the content of the existing line. So if this is the content of my file:
this is a line with whitespace
this,is,a,comma,separated,list
And I type this on a new line, I would get a pop-up like any other autocomplete suggestion and I could fill in either of the lines above. How can I do this (and if I can't, is there another editor that has this ability)?
The extension Line Completion does what you want.
You have to configure for which files (language identifiers) it should perform these suggestions. (To prevent to much calculation on large files where you don't use it. See the README page.
I'm working on a language extension and need to handle completion of tokens that start with a colon. What happens is that the original colon is not replaced and it ends up with two of them.
For example, to complete the symbol :foo, I type
:f
and it shows :foo in the list of options. I hit enter or tab to do the completion and it ends up with
::foo
How do I have it replace the original colon instead of appending after it?
Figured it out. The root problem was the wordPattern from the language config. I copied it from somewhere and it excluded colons.
I am coding HTML & CSS in VS Code IDE. I have installed & enabled the prettier extension for better readability of the code & auto-indentation. but my content of tags is not going beyond that certain point on the screen & it is getting added to the next line whenever I save my code by Ctrl +S (example: see the last paragraph tag). How to get that content on the same line?
You shouldn't use Prettier if you don't need this behavior. That's what Prettier does: splits lines that are too long. See here https://prettier.io/docs/en/index.html
I am using NetBeans for my C++ development.
Previously there was nice formatting of code but it has changed.
This is the format that I want
This is the format that I am getting
Note the two closing braces in one line after connection line and also the closing braces after semicolon in else statement.
if you press crtl + a then right click, you will find a "format" option. I hope this helped!