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

resource completion quotes ensure parameter #391

Open
tmu-sprd opened this issue Oct 7, 2024 · 0 comments
Open

resource completion quotes ensure parameter #391

tmu-sprd opened this issue Oct 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tmu-sprd
Copy link

tmu-sprd commented Oct 7, 2024

Describe the Bug

The Puppet language style guide states here in section Quoting:

If a string is a value from an enumerable set of options, such as present and absent, it SHOULD NOT be enclosed in quotes at all.

For example:

Good:
ensure => present
Bad:
ensure => "present"

The completion of resources in VScode encloses the parameter value in single ticks, which is a violation of the language style guide.

Current behavior

quoted

Expected Behavior

unquoted

Steps to Reproduce

Steps to reproduce the behavior:
In a Puppet file, add a supported resource like file, service, package etc.

Environment

  • Version 2.0.4 (added by official VScode extension Puppet version 1.5.4)
  • Platform Gentoo

Additional Context

Seems, that this is caused by this line.

In the meantime, I edited the file locally like so:

diff --git a/lib/puppet-languageserver/manifest/completion_provider.rb b/lib/puppet-languageserver/manifest/completion_provider.rb
index e41c41d..086876f 100644
--- a/lib/puppet-languageserver/manifest/completion_provider.rb
+++ b/lib/puppet-languageserver/manifest/completion_provider.rb
@@ -276,7 +276,7 @@ module PuppetLanguageServer
           attr_names.each_index do |index|
             name = attr_names[index]
             value_text = (name == 'ensure') ? 'present' : 'value' # rubocop:disable Style/TernaryParentheses  In this case it's easier to read.
-            snippet += "\t#{name.ljust(max_length, ' ')} => '${#{index + 2}:#{value_text}}'\n"
+            snippet += "\t#{name.ljust(max_length, ' ')} => ${#{index + 2}:#{value_text}}\n"
           end
           snippet += '}'
 
@tmu-sprd tmu-sprd added the bug Something isn't working label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant