Toggle comments does not work for Chef Metadata file type
dg42xyz opened this issue · 3 comments
dg42xyz commented
Describe the problem
When editing metadata.rb
files, they are recognized as a Chef Metadata file type rather than Ruby. However, the ability to toggle comments using the keyboard shortcut CTRL + / does not work in the Chef Metadata file type.
Software Version
VS Code: version 1.40.1
Chef Infra Extension: version 0.8.1
OS: Windows 10 (10.0.17763)
Replication Case
- Open a file named
metadata.rb
. Ensure that it is recognized as a Chef Metadata file type. - Highlight a portion of the file and use CTRL + / to attempt to toggle comments. Notice comments are not toggled.
- As a comparison, open a different Ruby file (for example,
Policyfile.rb
). Perform the same action as step 2, but notice how comments are toggled on/off.
dg42xyz commented
Update: I was able to dig into the VSCode docs a bit and figure out a workaround. Not sure this is the best solution though?
Workaround
- Update
package.json
(in ~/.vscode/extensions/chef-software.chef-0.8.1) to include"configuration": "./chef_metadata_language.json"
within the object for thechef_metadata
language (under contributes > languages). - Created
chef_metadata_language.json
file in the same directory as the package file. I kept it simple and just have it as:
{ "comments": { "lineComment": "#", "blockComment": "#" } }
- Reloaded VSCode.
This is the documentation I referred to for this change: https://code.visualstudio.com/api/language-extensions/language-configuration-guide
stuartpreston commented
@tas50 Could you have a look at this and see if it makes sense?
tas50 commented
We've fixed this on master and it'll get shipped soon.