Skip to content
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

AutoIndent update implementation #289

Closed
jpogran opened this issue Jun 19, 2018 · 7 comments
Closed

AutoIndent update implementation #289

jpogran opened this issue Jun 19, 2018 · 7 comments

Comments

@jpogran
Copy link
Contributor

jpogran commented Jun 19, 2018

In VSCode version 1.9 auto-indent was updated. Functionality is documented here.

This requires usto update the https://github.com/lingua-pupuli/puppet-vscode/blob/master/languages/puppet.configuration.json file, with a new indentationRules block that contains regex patterns for increasing and decreasing the indent. According to the documentation, we should also change the name from puppet.configuration.json to puppet-languages-configuration.json in order to get validation and editor support.

I did a POC locally and have it working somewhat, but it's controlled by a regex so it's going to need some further work to catch all the different cases we have. Examples show a known list of keywords ( if, else, when, do, etc) so we have a possible problem in that we want indentation to occur after both puppet language keywords (the puppet dsl) as well as any type name (file, package, etc)

@jpogran
Copy link
Contributor Author

jpogran commented Jun 19, 2018

This was reported by Joseph Citarello.

@jpogran jpogran added this to the 0.11.0 milestone Jun 19, 2018
@jpogran
Copy link
Contributor Author

jpogran commented Jun 20, 2018

The regex can account for the Puppet DSL keywords but when it comes to the type declarations it is much harder.

For example:

file { 'foo':

This isn't caught by the existing configuration because of the string followed by the colon. Adding a single quote and colon begins to break the regex.

@jpogran
Copy link
Contributor Author

jpogran commented Jun 22, 2018

I think for the 0.11 release we can correct the file name and add indentation support for the keywords in the DSL. Auto indentation for the types will need to come in a subsequent PR

@jpogran jpogran removed this from the 0.11.0 milestone Jun 25, 2018
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jun 27, 2018
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jun 27, 2018
This commit fixes the declaration for block comments by setting it to an
array.
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jun 27, 2018
This commit uses the correct block comment characters as per puppet
specifications.
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jun 27, 2018
This commit uses the correct block comment characters as per puppet
specifications.
@jpogran jpogran added this to the 0.11.0 milestone Jun 27, 2018
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jun 29, 2018
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jun 29, 2018
This commit fixes the declaration for block comments by setting it to an
array.
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jun 29, 2018
This commit uses the correct block comment characters as per puppet
specifications.
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jul 3, 2018
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jul 3, 2018
This commit fixes the declaration for block comments by setting it to an
array.
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jul 3, 2018
This commit uses the correct block comment characters as per puppet
specifications.
glennsarti added a commit that referenced this issue Jul 4, 2018
@jpogran
Copy link
Contributor Author

jpogran commented Jul 10, 2018

First pass implemented (DSL indenting). Adding this to the 0.12. for the more complicated type indenting.

@jpogran jpogran modified the milestones: 0.11.0, 0.12.0 Jul 10, 2018
@jpogran jpogran added this to To do in Road to 1.0 Jul 17, 2018
@jpogran jpogran removed this from the 0.12.0 milestone Jul 19, 2018
@github-actions
Copy link

github-actions bot commented Sep 7, 2019

This issue has been marked stale because it has been open for more than 30 days with no activity. If this issue is still important to you, please comment to keep this issue open. If not, this will be closed in 5 days

Road to 1.0 automation moved this from To do to Done Sep 12, 2019
@genebean
Copy link

I would like to see this issue reopened. Here is an example of how it impacts me.

autoindent-demo

@jpogran jpogran reopened this Nov 26, 2019
Road to 1.0 automation moved this from Done to In progress Nov 26, 2019
@jpogran jpogran added this to To do in 0.23.0 Marketplace Release via automation Nov 26, 2019
@jpogran jpogran added this to the 0.23.0 milestone Nov 26, 2019
@jpogran
Copy link
Contributor Author

jpogran commented Nov 26, 2019

Added this to 0.23 to plan and triage

jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jan 7, 2020
This commit enables the editor to indent properly after a type
declaration with a title.
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Jan 9, 2020
This commit programmatically sets language configuration for Puppet
manifests and Puppetfiles instead of using json files.

This commit also enables the editor to indent properly after a type
declaration with a title by adding the `onEnterRules` section.
glennsarti added a commit that referenced this issue Jan 14, 2020
(GH-289) Auto Indent for Types with Titles
@jpogran jpogran closed this as completed Jan 15, 2020
Road to 1.0 automation moved this from In progress to Done Jan 15, 2020
0.23.0 Marketplace Release automation moved this from To do to Done Jan 15, 2020
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Feb 14, 2020
This reverts commit fa2ef7c.

Removing the language configuration json files removed support for
`surroundingPairs`, which breaks adding matching characters like quotes
or brackets. The programmatic language configuration method does not
support `surroundingPairs`, so we still need the language config json
file. We can instead have the language config file present as
well as a programmatic declaration at the same time, and keep both old
and new functionality.
jpogran added a commit to jpogran/puppet-vscode that referenced this issue Feb 14, 2020
This commit programmatically sets language configuration for Puppet
manifests and Puppetfiles instead of using json files.

This commit also enables the editor to indent properly after a type
declaration with a title by adding the `onEnterRules` section.
@jpogran jpogran removed this from Done in Road to 1.0 Mar 27, 2020
@jpogran jpogran removed this from Done in 0.23.0 Marketplace Release Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants