Strange linebreak with long arguments and callbacks
See original GitHub issueWhen a function call has a callback but also has many and/or long arguments, for specific lengths the callback formatting is quite strange.
Input:
someFunctionCallWithBigArgumentsAndACallback(thisArgumentIsQuiteLong, function(cool) {
return cool
})
Actual Output (strange line break in function
):
someFunctionCallWithBigArgumentsAndACallback(thisArgumentIsQuiteLong, function(
cool
) {
return cool;
});
Expected Output:
someFunctionCallWithBigArgumentsAndACallback(
thisArgumentIsQuiteLong,
function(cool) {
return cool;
}
);
Note that if thisArgumentIsQuiteLong
is a little bit longer, or you add more parameters, the expected output formatting happens. It’s only for specific lengths that this strange formatting appears.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Better Line Breaks for Long URLs - CSS-Tricks
Soft or “shy” hyphens are great for breaking words, but bad news for URLs. It's not as big a deal on screens, since...
Read more >Chart js v2 tooltip callback line breaks - Stack Overflow
I'm using chart js v2.3.0 by the way. UPDATE. I've fixed the problem! Convert the tooltip text to array of string (I'm gonna...
Read more >Promisification - The Modern JavaScript Tutorial
Here, promisify assumes that the original function expects a callback with exactly two arguments (err, result) . That's what we encounter most ...
Read more >argparse — Parser for command-line options, arguments and ...
Source code: Lib/argparse.py Tutorial: This page contains the API reference information. For a more gentle introduction to Python command-line parsing, ...
Read more >Breaking up long lines of code in Python
As long as we have an open square bracket ( [ ), parenthesis ( ( ), or an open curly brace ( {...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Do we have snapshots for these cases? If not, we should add them, so that we don’t introduce an unintentional regression later (considering the cause of the fix is unknown)
Fixed by https://github.com/prettier/prettier/pull/9662 Let’s add a test from this issue and close it.