How to do I opt in for experimentalFeatures Settings in terraform-ls on Neo/vim using Coc

Hello Community !

I’m using NVIM 0.5.1 with Coc.nvim for auto-completion and could not figure out how to get the terraform-ls experimentalFeatures to be enabled the in the settings ?
Here is my :CocConfig

{
	"languageserver": {
		"terraform": {
			"command": "terraform-ls",
			"args": ["serve"],
			"filetypes": [
				"terraform",
				"tf"
			],
			"initializationOptions": {
				
			},
			"settings": {
			}
		}
	}
}

I have tried adding "experimentalFeatures.prefillRequiredFields" true in the `“settings: {}” block, but it does not work.

Please advise.

Hi @msharma24
The following configuration should work:

{
        "languageserver": {
                "terraform": {
                        "command": "terraform-ls",
                        "args": ["serve"],
                        "filetypes": [
                                "terraform",
                                "tf"
                        ],
                        "initializationOptions": {
                                "experimentalFeatures": {
                                        "prefillRequiredFields": true
                                }
                        },
                        "settings": {}
                }
        }
}

I can see in our docs we use the dotted syntax for the config options, which works in VS Code, but won’t work here. I will get that updated too!

Also I should mention that variable files (*.tfvars) should use a separate language ID (terraform-vars, not terraform) to work correctly, but I’m not entirely familiar with the syntax highlighter or the detection engine neovim uses to tell you how to reflect this in the configuration. It’s also possible the grammar may need updating to reflect this.

1 Like