Skip to content

Commit

Permalink
UPDATED: New json defns
Browse files Browse the repository at this point in the history
  • Loading branch information
erd0s committed Nov 24, 2017
1 parent 36a0162 commit 6329316
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 350 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to the "terraform-autocomplete" extension will be documented in this file.

## [0.0.7] - 2017-11-24
- Updated to the most recent AWS provider docs
- Changed the structure a bit to use json instead of ts for storing definitions

## [0.0.4] - 2017-10-17
- Added "Go to definition functionality for AWS"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

WARNING! This is very beta, things might not work as expected so don't rely solely on this extension as a complete reference to terraform parameters and exported arguments. PRs welcome!

This extension provides basic autocomplete on AWS resources.
This extension provides basic autocomplete on AWS resources. Scraping functionality can be found at https://github.com/erd0s/terraform-scrape.

## Requirements

Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add the meta parameters from https://www.terraform.io/docs/configuration/resources.html#lifecycle
1 change: 1 addition & 0 deletions aws-resources.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "terraform-autocomplete",
"displayName": "Terraform Autocomplete",
"description": "Autocomplete for AWS resources with terraform.",
"version": "0.0.5",
"version": "0.0.7",
"publisher": "erd0s",
"repository": {
"type": "git",
Expand Down
77 changes: 0 additions & 77 deletions scrape.js

This file was deleted.

8 changes: 4 additions & 4 deletions src/TerraformCompletionProvider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CompletionItemProvider, TextDocument, Position, CancellationToken, CompletionItem, CompletionItemKind } from "vscode";
import * as resources from './aws-resources';
var resources = require('../../aws-resources.json');
import * as _ from "lodash";

var topLevelTypes = ["output", "provider", "resource", "variable", "data"];
Expand Down Expand Up @@ -58,7 +58,7 @@ export class TerraformCompletionProvider implements CompletionItemProvider {
// We're trying to type the exported field for the var
var resourceType = parts[0];
var resourceName = parts[1];
var attrs = resources.resources[resourceType].attrs;
var attrs = resources[resourceType].attrs;
var result = _.map(attrs, o => {
let c = new CompletionItem(`${o.name} (${resourceType})`, CompletionItemKind.Property);
c.detail = o.description;
Expand All @@ -85,7 +85,7 @@ export class TerraformCompletionProvider implements CompletionItemProvider {
let parentType = this.getParentType(line);
if (parentType && parentType.type == "resource") {
let resourceType = this.getResourceTypeFromLine(line);
return this.getItemsForArgs(resources.resources[resourceType].args, resourceType);
return this.getItemsForArgs(resources[resourceType].args, resourceType);
}
else if (parentType && parentType.type != "resource") {
// We don't want to accidentally include some other containers stuff
Expand Down Expand Up @@ -164,7 +164,7 @@ export class TerraformCompletionProvider implements CompletionItemProvider {
if (parts.length == 2 && parts[0] == "resource") {
let r = parts[1].replace(/"/g, '');
let regex = new RegExp("^" + r);
var possibleResources = _.filter(_.keys(resources.resources), k => {
var possibleResources = _.filter(_.keys(resources), k => {
if (regex.test(k)) {
return true;
}
Expand Down
Loading

0 comments on commit 6329316

Please sign in to comment.