Giter Club home page Giter Club logo

vscode-terraform's Issues

Add an option to force hcl hightlighting to any files

Hi,

As mention in #16. I remembered why I had installed HCL extension.

Without it I can't force the syntax highlighting on any file extension.

I have some *.hcl files but with *ctmpl extension (for consul template). With the HCL extension I can choose to force vscode to recognize those files as hcl and without I can't:
screenshot 2017-04-13 07 38 30

Do you think you can make it?
It would be great.

Laurent

Add syntax highlighting for .tfstate files

Not a big deal, but sometimes you want to poke around and look at the .tfstate files that Terraform manages. Apparently, they are just plain JSON, so it would be neat if this extension instructed VS Code accordingly.

not formatting on save

Hi,

formatting on save stopped working in the last few days.

using vscode Version 1.19.0
plugin 0.0.20
Terraform v0.11.1

Code folding of resources does not correctly handle inline HEREDOC blocks

When viewing a resource in a Terraform file, if it contains a HEREDOC block (for example, an IAM policy), the code folding doesn't work - the closing curly brace is correctly matched but when folding the resource the HEREDOC block remains unfolded.

Unfolded:

image

Folded:

image

VSCode version: 1.19.2, x64, Linux (Ubuntu 16.04)
plugin version: mauve.terraform 0.0.20

Autocomplete & syntax highlighting not working

Hello,

Thanks for the extension. I was looking forward to use it to reduce a lot of typing with terraform.
I was trying this plugin on a mac (v10.13.33), VSCode (v1.20) and Terraform (v 0.11.3) and the autocomplete or syntax highlighting doesn't work at all.

Tried to reinstall this and VS Code as well but no luck.

Then I tried to install the other Terraform autocomplete extension (which is in beta) and it works as expected.

Can you please advise if I am missing something?

image

Terraform validation should support configuration

All of these should be configurable:

Usage: terraform validate [options] [dir]

  Validate the terraform files in a directory. Validation includes a
  basic check of syntax as well as checking that all variables declared
  in the configuration are specified in one of the possible ways:

      -var foo=...
      -var-file=foo.vars
      TF_VAR_foo environment variable
      terraform.tfvars
      default value

  If dir is not specified, then the current directory will be used.

Options:

  -check-variables=true If set to true (default), the command will check
                        whether all required variables have been specified.

  -no-color             If specified, output won't contain any color.

  -var 'foo=bar'        Set a variable in the Terraform configuration. This
                        flag can be set multiple times.

  -var-file=foo         Set variables in the Terraform configuration from
                        a file. If "terraform.tfvars" is present, it will be
                        automatically loaded if this flag is not specified.

Support #region #endregion for code folding

These are supported in core vscode for some languages (https://stackoverflow.com/a/46597272/4200039 and microsoft/vscode#12146) - I suggest adding #region support.

Also if the autoformatter did not force a space before the trailing #endregion comment I'd prefer that.

I tried adding something like https://github.com/Microsoft/vscode/blob/6c421d85528d4ddb37dcb167b7a442e348f51378/extensions/javascript/javascript-language-configuration.json to https://github.com/mauve/vscode-terraform/blob/master/syntaxes/terraform.json and https://github.com/mauve/vscode-terraform/blob/master/terraform.configuration.json but it didn't work.

Disable `terraform.formatOnSave` by default

In our team, almost everyone was surprised that .tf files get reformatted on each save. It took us some time to realize that there is the terraform.formatOnSave config option. A small suggestion would be to ship the extension with auto-formatting disabled by default.

Fmt on save not working with vscode 1.11.1

Hi,

Thanks for the good work on this extension.
Since the last update of vscode, the fmt on save doesn't work anymore. I have update to 0.0.7 and added "terraform.formatOnSave": true to my use settings.

My coworker has the same problem.

Laurent.

"Sorry, but there is no formatter for 'terraform'-files installed." with portable ZIP instance of VSCode

I am running VSCode (x64) v1.18.0 with v0.0.19 of this extension.

VSCode is being run from the extracted contents of a portable ZIP. It is not "installed" on the machine, just unzipped from the portable ZIP into a directory and executed from there.

I'm running the portable ZIP version due to a lack of admin rights, on a client-provided laptop for my current project. Admin rights may or may not be attainable, so I have to work without them for the time being.

When I choose the "Format Document" option from the command palette, I get the following error:

Sorry, but there is no formatter for 'terraform'-files installed.

I have also tried setting the path to the terraform.exe in VSCode settings like so:

    "terraform.path": "C:\\bin\\terraform.exe",

This doesn't make any difference, unfortunately.

Pressing Ctrl opens documentation

Pressing Ctrl (just Ctrl!) opens documentation.

I'd like to only happen when I Ctrl+click, as everywhere else it works.

I'm using Ubuntu 16.04.

How are you keeping docs up to date?

Hey there,

I created another vscode plugin for autocomplete since I couldn't get yours working, but now I see with the recent updates that yours is way better than what I had so I'm going to bow out and leave this with you, however one of my challenges was keeping the documentation up to date and I was wondering how you were doing it?

I had started this: https://github.com/erd0s/terraform-scrape which I used to get all the data from the online docs, if you don't already have something in place I'd be happy to modify what I have to fit with your plugin, either way I'd be interested to know how you're doing it because it killed me when I was trying!

Cheers

extra lines, removal of tabs on latest build

i've been using this for a while now - its great.
but i've noticed recently on save, all of my tabs get deleted and every line in the document is spaced by 2.
removing the module corrects the issue
This happens as soon as i save my document

eg:

variable "foo"                      {}
variable "bar"                      {}

becomes
variable "foo" {}


variable "bar" {}

Variable interpolation in quotes does not auto-close braces

I am trying to reference a variable in a .tf file in my project. I have two quotes already typed out and then I type ${. At this point, I would expect a close-brace character (}) to automatically be inserted at this point, but it isn't. I know (annoyingly) have to type in that character.

It would be great if this extension supported this auto-closing, like it is suggested in the README. Other IDEs support this, such as Jetbrains.

Configure extensions to apply formatting to

Great plugin, thanks!

It would be great to allow for other extensions. For example, we use jinja2 templates to generate our terraform .tf files, so in source control our file extensions are .tf.tpl, which this plugin ignores.

It would be nice to be able to add that extension in a configuration setting, or if the plugin applied this formatting to any file extension containing .tf in it.

๐Ÿคทโ€โ™‚๏ธ

Thanks again!

resource auto-completion

Hi,

I'm wondering what your thoughts are on extending auto-completion for resources and data sources. I did a quick hack to test this out (screenshot below). Do you have input / would you consider a PR to accomplish this?

screen shot 2017-12-13 at 7 37 08 pm

A few thoughts of mine, in no particular order:

  • I'm collecting resource types by scraping https://www.terraform.io/docs/index.html. the vim-terraform project seems to accomplish the same by cloning github repos that match terraform-provider-*, and searching for resource definitions in the source.
  • CompletionItem.documentation can present abbreviated documentation and link to terraform.io
  • It may be possible to auto-populate required properties, but I haven't given this much thought.

Curious to have your thoughts and interested in putting a PR together if this approach seems reasonable.

Path expansion for terraform binaries broken

It looks like #50 broke my configuration (formatting, linting, etc no longer work) since my binaries are in my home dir (e.g. ~/bin/terraform) and child_process.execFile doesn't spawn a shell

Changing that to /real/path/to/bin/terraform gets things going again, but it would be nice to support at least home directory expansion again.

Incorrectly highlighting Strings inside maps

In the below screenshot I'd expect the strings inside the map to be colored green as well (I'm using the Kimbie Dark theme).

image

Later edit: the comments inside maps are also colored incorrectly

Option to disable fmt for tfvars file

The terraform fmt runner is neat, but on I would prefer to have an option to disable it for tfvars file. It makes them look really ugly with spaces between all the variables.

terraform.format [on-save]: Failed: 'Error: write EPIPE'

Multiple Win10 machines running VSCode and Terraform 0.23.
The linter does not seem happy, as all on-save events and validate fail.
terraform.validate and terraform.lint simply report 'Failed', while the on-save event reports Error: write EPIPE.

Any ideas if there are known incompatibilities that prevent the plugin from doing validation, linting?

terraform fmt isn't called

Hello,

I'm looking at the config, and I would expect that terraform fmt be run when I execute a save: command s on the Mac.

    "enable": true,
    "ignoreExtensionsOnSave": [
      ".tfsmurf"
    ],
    "formatOnSave": true
   },

I am using VS Code 1.22.2, plugin 0.0.23 of the plugin, and am running OSX 10.13.4, this was previously working, so I'm not sure why it stopped. I don't see any obvious mentions in the Console log or the Dev Tools. Nothing is registered when I execute command s. Running terraform fmt from bash does what I expect.

When terraform.indexing.enabled is true, Code UI freezes on Ubuntu

Indexing is now enabled by default since vscode-terraform 0.0.21: 7d170c6#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R149

This change seems to freeze Code UI on my system (Ubuntu 17.10 with code 1.21.0-1520420608) where terraform-index is not installed.

Work-around, start Code with code --disable-extensions and add "terraform.indexing.enabled": false to user settings.

As soon as I change terraform.indexing.enabled from false to true, code UI freezes.

settings json - objenious - visual studio code_291

Here are some logs when that happens:

==> /home/pdecat/.config/Code/logs/20180309T110358/exthost1.log <==                                    
[2018-03-09 13:07:13.692] [exthost1] [info] ExtensionService#_doActivateExtension mauve.terraform {"startup":false,"activationEvent":"onLanguage:terraform"}
[2018-03-09 13:07:13.692] [exthost1] [info] ExtensionService#loadCommonJSModule /home/pdecat/.vscode/extensions/mauve.terraform-0.0.21/out/src/extension
==> /home/pdecat/.config/Code/logs/20180309T110358/main.log <==                                                                                                                                                
[2018-03-09 13:04:28.563] [main] [info] update#setState checking for updates                           
[2018-03-09 13:04:29.238] [main] [info] update#setState idle                                           
[2018-03-09 13:07:46.637] [main] [error] [VS Code]: detected unresponsive                              

Note: only the main view is frozen, menu and developer tools still work.

String highlighting error

Since the most recent update (0.8 or 0.10 not to sure), it seems to have introduced a bug in the syntax highlighting of strings.

The attached screenshot explains it better:

screen shot 2017-04-13 at 08 15 46

After the DEFINITION string ends, the highlighting is treating the rest of the file as a string, when it is not.

The Terraform template is definitely valid and it's not an escaping issue, the problem first occurred after I updated the plugin.

Auto Save and Auto Format conflict

This is more of a feature request than an actual bug, but with Auto Save enabled in vscode and auto formatting on in Terrafom there are some issues.

When typing in a new line, pausing for a second will cause auto format to run and will move incomplete code around, remove lines that are needed, etc. I've found that if I put in an illegal char, that will prevent auto formatting to run until I'm ready for it to auto format.

Both features are great, but it would be nice if there was a delay on auto formatting that could be configured or invoke formatting on keystroke or button vs on save.

Formatting is not working

I have this settings on my user settings:

    "[terraform]": {
        "editor.formatOnSave": true
    },
    "editor.formatOnSave": true,

And this on my workspace settings:

 "files.associations": {
        "**/terraform/*/*.tf": "terraform",
        "*.tf": "terraform",
        "*.tfstate": "json"
    ,}

I cannot get format on save to work and i i choose the command directly on the palette:

There is no formatter for 'terraform'-files installed.

Terraform: Validate and Terraform:Lint give similar results

My configuration:

"code --version" output: 1.21.0
9a199d77c82fcb82f39c68bb33c614af01c111ba
x64

Extension version: 0.0.23

Thanks!

Bug/Preference: New line added, inconsistently, between variable declarations

Steps to reproduce

If I start with this...

# The SNS topics to use for alarms when missing data, insufficient data, data has returned to OK status (health service)
variable "sns_arn_alarm" {}
variable "sns_arn_alarm_insufficient" {}
variable "sns_arn_alarm_ok" {}

Actual results

When I save the file it gets turned into this...

# The SNS topics to use for alarms when missing data, insufficient data, data has returned to OK status (health service)
variable "sns_arn_alarm" {}

variable "sns_arn_alarm_insufficient" {}
variable "sns_arn_alarm_ok" {}

Expected results

Personally, I'd like the lot to stay together, but if there are reasons to require the new line then I'd prefer it to be applied consistently, like this...

# The SNS topics to use for alarms when missing data, insufficient data, data has returned to OK status (health service)
variable "sns_arn_alarm" {}

variable "sns_arn_alarm_insufficient" {}

variable "sns_arn_alarm_ok" {}

Do not format tfvariable file

Seems like with the version of 0.0.20 the "terraform.formatVarsOnSave" does no longer exist.
How with the new version I can disable formatting for tfvars files but leave it for tf files?

thank you

on osx, cmd key shortcut

This is more of a question than an issue; is there any way to disable the "cmd" shortcut that automatically opens the browser with the terraform documentation for the resource that the cursor is in in the editor?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.