Folded / Collpased code partially scrambled
See original GitHub issueWhen reporting an issue, please include the following information in your post:
- Explain the Issue and Expected Behavior
- Prettier version
- JsPrettier Plug-in Version
- Platform Details
- Generated Prettier command line arguments
- Is the same behavior observed when run against Prettier directly?
- The contents of your
User/JsPrettier.sublime-settings
file - The contents of your
<project_name>.sublime-project
file (if applicable) - Steps to reproduce the behavior
Explain the Issue and Expected Behavior
When invoiking JsPrettier (via direct command or on-save) while having folded code (Edit > Code Folding > Fold All) above or below the section I’m working on, the folded code is scrambled.
By scrambled I mean the code is not altered but the fold representation is not consistent anymore.
I would expect for the fold representation to remain unaltered.
Prettier version
1.16.1
JsPrettier Plug-in Version
1.27.0
Platform Details
macOS 10.14.5 SublimeText 3.2.1 (Build 3207)
Generated Prettier command line arguments
JsPrettier DEBUG - Prettier CLI Command
/Users/hunita/.nvm/versions/node/v8.11.4/bin/node /usr/local/bin/prettier --stdin --config /Users/user/test/.prettierrc --config-precedence cli-override --parser babel --use-tabs false --stdin-filepath /Users/user/test/test.js --loglevel debug --cursor-offset 249
Prettier reported the following output:
[debug] normalized argv: {"_":[],"color":true,"editorconfig":true,"stdin":true,"use-tabs":false,"config":"/Users/user/test/.prettierrc","config-precedence":"cli-override","parser":"babel","stdin-filepath":"/Users/user/test/test.js","loglevel":"debug","cursor-offset":249,"plugin-search-dir":[],"plugin":[],"ignore-path":".prettierignore","debug-repeat":0}
[debug] load config file from '/Users/user/test/.prettierrc'
[debug] loaded options `{"printWidth":80,"tabWidth":2,"useTabs":false,"semi":true,"singleQuote":false,"trailingComma":"none","arrowParens":"always"}`
[debug] applied config-precedence (cli-override): {"filepath":"/Users/user/test/test.js","arrowParens":"always","cursorOffset":249,"parser":"babel","printWidth":80,"semi":true,"singleQuote":false,"tabWidth":2,"trailingComma":"none","useTabs":false}
Is the same behavior observed when run against Prettier directly?
This is only related to code folding in SublimeText itself.
The contents of your User/JsPrettier.sublime-settings
file
The entire contents of your User overridden JsPrettier Settings, excluding the comments.
{
"node_path": "/Users/user/.nvm/versions/node/v8.11.4/bin/node",
"prettier_cli_path": "/usr/local/bin/prettier",
"prettier_options": {
"singleQuote": true,
"semi": false,
"useTabs": false,
"tabWidth": 2,
"printWidth": 80
},
"auto_format_on_save": true,
"debug": true,
"auto_format_on_save_requires_prettier_config": true
}
The contents of your <project_name>.sublime-project
file (if applicable)
N/A
Steps to reproduce the behavior
export function by2(param) {
if (typeof param !== "number") {
return param;
}
const result = param * 2;
return result;
}
export function somethingElse(param) {
if (!param) {
throw new Error("Missing param1");
}
}
When prettifying the code above, with the first function by2
folded in, you should see the first fold messed
up.
I’m attaching screen shots to show what I mean:
-
before
-
after
In particualr I’m referring to the characters sult
that appeard in the fold and the now swalloed am) {
. This gets worse with more LOC in the same file.
Nonetheless very greatful for this plugin, thank you!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
No luck. Apparently (err assumingely), there were some internal changes which now cause the mentioned method to throw when attempting to refold the start/end regions.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.