puppetlabs / puppet-editor-services

Puppet Language Server for editors
Apache License 2.0
46 stars 21 forks source link

Puppet profile document formatting #306

Closed Vasista-Eranki closed 3 years ago

Vasista-Eranki commented 3 years ago

Issue Type: Bug

Puppet profile has several resources listed. a few of the resource strings have different indentation and the collapsing of resources is getting messy due to this..
I think, the collapsing of sections shall strictly adhere the { }.

VS Code version: Code 1.54.3 (2b9aebd5354a3629c3aba0a5f5df49f43d6689f8, 2021-03-15T10:55:45.459Z) OS version: Windows_NT x64 10.0.19041

Extensions (45) Extension|Author (truncated)|Version ---|---|--- ng-template|Ang|11.2.8 armview|ben|0.4.5 hiera-eyaml|bra|1.0.1 vscode-eslint|dba|2.1.19 docs-yaml|doc|0.2.6 gitlens|eam|11.3.0 EditorConfig|Edi|0.16.4 vscode-npm-script|eg2|0.3.17 prettier-vscode|esb|6.3.1 vscode-firefox-debug|fir|2.9.2 terraform|has|2.8.3 angular-essentials|joh|11.0.0 Angular2|joh|11.0.0 vscode-peacock|joh|3.9.1 sublime-babel-vscode|jos|0.2.10 vscode-azureappservice|ms-|0.21.2 vscode-azurefunctions|ms-|1.3.0 vscode-azureresourcegroups|ms-|0.3.0 vscode-cosmosdb|ms-|0.16.0 vscode-docker|ms-|1.11.0 csharp|ms-|1.23.9 vscode-dotnet-runtime|ms-|1.0.0 python|ms-|2021.3.658691958 jupyter|ms-|2021.3.619093157 remote-wsl|ms-|0.54.6 azure-account|ms-|0.9.7 azurecli|ms-|0.5.0 powershell|ms-|2021.2.2 vs-keybindings|ms-|0.2.0 vscode-typescript-tslint-plugin|ms-|1.3.3 team|ms-|1.161.1 azurerm-vscode-tools|msa|0.15.0 debugger-for-chrome|msj|4.12.12 debugger-for-edge|msj|1.0.15 vscode-react-native|msj|1.4.1 angular2-inline|nat|0.0.17 angular-console|nrw|17.0.3 indent-rainbow|ode|7.5.0 oracledevtools|Ora|19.3.3 material-icon-theme|PKi|4.5.0 puppet-vscode|pup|1.1.0 ruby|reb|0.28.1 vscode-yaml|red|0.16.0 vscode-todo-highlight|way|1.0.4 vscode-ruby|win|0.28.0 (3 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspyt653:30270858 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstry244:30276681 pythonvsdeb440:30248342 pythonvsded773:30248341 pythonvspyt875:30259475 pythontbcf:30265426 vscoresta800cf:30276762 vspre833:30267464 vsdfh931:30275552 vshan820:30276952 ```
jpogran commented 3 years ago

Thank you for the report @Vasista-Eranki, but I do not understand what you are asking here. Can you please expand upon your request?

Vasista-Eranki commented 3 years ago

Hello James

Consider the below example .. Notice the file resource has bad indented information for the content attribute..

image

When I try to collapse the resource, I observe the resource is not completely collapsed, instead it is collapsing the lines as shown below.

image

I'm expecting the resource collapsing shall be looking for the curly braces' matching pair { } instead of the indented lines.

jpogran commented 3 years ago

Thank you for the additional detail. Unfortunately there isn't much more we can do here. If you port your example to other languages, you'll see similar behavior. It's an artifact of HERE blocks/strings (named differently depending on the language you're using), and how VS Code handles indentation.

glennsarti commented 3 years ago

I wonder if we'll have to implement the code-folding Language Server feature... I did something similar for PowerShell.

The downside is I'll need to use a puppet language lexer

glennsarti commented 3 years ago

If only the ruby based puppet language implementation had a public lexer .... like the Go ones does :-)