-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indenting doesn't work correctly #2214
Comments
Formatting issues are typically caused by PSScriptAnalyzer since we depend on that. @bergmeister is a maintainer of that project and has been working on this particular formatting rule I believe. What do you think? @PrzemyslawKlys can you share any formatting settings that you have? |
Definitely something changed in vscode-powershell v2019.9.0. Now the formatting gets messed up if there is structure like <pipeline> <multi-line scriptblock> <pipeline>. I'm aware of past PSScriptAnalyzer indentation issuse (like PowerShell/PSScriptAnalyzer#1187 ) but since that one got fixed I've had no issues with indentation as long as I keep the recommended setting: I've also tried various PSScriptAnalyzer rule and vscode-powershell setting combinations. Especially both Steps to reproduce
Expected behaviorThis is what I get with vscode-powershell v2019.5.0
Actual, incorrect behavior
Environment dataVS Code
PowerShell
PSScriptAnalyzer
|
{
"workbench.colorTheme": "Monokai",
"workbench.iconTheme": "material-icon-theme",
"powershell.codeFormatting.preset": "OTBS",
"editor.fontSize": 12,
"search.showLineNumbers": true,
"terminal.integrated.scrollback": 30000,
"debug.inlineValues": true,
"editor.minimap.enabled": false,
"workbench.useExperimentalGridLayout": true,
"breadcrumbs.enabled": true,
"workbench.editor.highlightModifiedTabs": true,
"window.title": "${folderName}${separator}${activeEditorShort}",
"powershell.powerShellExePath": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"debug.openDebug": "neverOpen",
"typescript.implementationsCodeLens.enabled": true,
"powershell.developer.editorServicesLogLevel": "Diagnostic",
"debug.toolBarLocation": "docked",
"editor.snippetSuggestions": "bottom",
"files.autoSave": "off",
"files.autoSaveDelay": 5000,
"explorer.confirmDragAndDrop": false,
"files.trimTrailingWhitespace": true,
"editor.renderWhitespace": "all",
"gitlens.blame.ignoreWhitespace": true,
"powershell.codeFormatting.useCorrectCasing": true,
"[powershell]": {
"editor.defaultFormatter": "ms-vscode.powershell",
/* "editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?" */
},
"[markdown]": {
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
},
"files.encoding": "utf8bom",
"editor.find.autoFindInSelection": true,
"extensions.autoUpdate": true,
"window.zoomLevel": 0,
"editor.suggest.localityBonus": true,
"editor.suggest.maxVisibleSuggestions": 15,
"search.maintainFileSearchCache": true,
"extensions.showRecommendationsOnlyOnDemand": true,
"terminal.integrated.experimentalRefreshOnResume": true,
"html.format.indentInnerHtml": true,
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"cSpell.enabledLanguageIds": [
"asciidoc",
"c",
"cpp",
"csharp",
"css",
"git-commit",
"go",
"handlebars",
"html",
"jade",
"java",
"javascript",
"javascriptreact",
"json",
"jsonc",
"latex",
"less",
"markdown",
"php",
"plaintext",
"pug",
"python",
"restructuredtext",
"rust",
"scala",
"scss",
"text",
"typescript",
"typescriptreact",
"yaml",
"yml"
],
"cSpell.userWords": [
"Kłys",
"Przemysław",
"dashimo",
"documentimo"
],
"sqltools.telemetry": false,
"mssql.copyIncludeHeaders": true,
"peacock.favoriteColors": [
{
"name": "Angular Red",
"value": "#b52e31"
},
{
"name": "Auth0 Orange",
"value": "#eb5424"
},
{
"name": "Azure Blue",
"value": "#007fff"
},
{
"name": "C# Purple",
"value": "#68217A"
},
{
"name": "Gatsby Purple",
"value": "#639"
},
{
"name": "Go Cyan",
"value": "#5dc9e2"
},
{
"name": "Java Blue-Gray",
"value": "#557c9b"
},
{
"name": "JavaScript Yellow",
"value": "#f9e64f"
},
{
"name": "Mandalorian Blue",
"value": "#1857a4"
},
{
"name": "Node Green",
"value": "#215732"
},
{
"name": "React Blue",
"value": "#00b3e6"
},
{
"name": "Something Different",
"value": "#832561"
},
{
"name": "Vue Green",
"value": "#42b883"
}
],
"editor.smoothScrolling": true,
"editor.tabCompletion": "on",
"html.format.wrapLineLength": 0,
"powershell.codeFormatting.autoCorrectAliases": true
} |
@anttiah with the |
Tried once more. This time I deleted directories |
hmm @bergmeister... Rob and I were able to repro this behavior in the stable extension but not in the preview extension. @anttiah if you move over to the PowerShell Preview extension in the VS Code marketplace, you wont see this issue. |
I'm wondering if we missed something to backport? |
There is not much wiring up (just the setting name). Does the non preview extension ship with PSSA 1.18.3 as well (changes were made in pssa to allow this)? |
@bergmeister 1.18.3 does ship in the PowerShell (non-preview) extension and I am able to repro with a locally built |
Hmm, you're right. I can repro with the legacy branch. To me it looks like, the setting does not get properly applied and then PSSA's default setting (which is not NoIndentation) gets used. I did a quick comparison of this repo and PSES and could not spot a difference between the master and legacy branch. will do a bit more debugging later this week |
Ok, I found the culprit, the legacy branch is missing this line: |
Let's play the blame game: PR open now, thanks @anttiah for the detailed repro and @TylerLeonhardt for spotting the difference between the preview and RTM extension |
Thanks for finding that and submitting a fix @bergmeister! |
Closed in PowerShell/PowerShellEditorServices#1050 |
Issue Description
I am experiencing a problem with...indenting.
Old one:
Formatting doesn't change indenting for either now, Not sure how that happens but it keeps "indenting" to 2 spaces if it's 2 spaces and 4 spaces if it's 4 spaces in the current file. The expectation would be to set indenting to current settings choice rather than keeping whatever is defined in a file.
I have a feeling it worked before, but maybe I was just assuming things.
Attached Logs
Follow the instructions in the README about
capturing and sending logs.
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: