Skip to content

Commit

Permalink
[terraform,python/types] Add notes about terraform VS Code plugin & P…
Browse files Browse the repository at this point in the history
…ython Type Hints
  • Loading branch information
progrhyme committed Jun 24, 2022
1 parent 8363a86 commit ae7b1a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions content/ja/a/program/python/spec/types.md
Expand Up @@ -159,3 +159,21 @@ bytearray.replace(old, new[, count])
```

oldをnewにすべて置換する。countがある場合、先頭からcount個数分だけ置換する。

## 型ヒント

https://docs.python.org/ja/3/library/typing.html

Python 3.5から使えるようになったようだ。
実行時には影響を与えないそうだ。

参考: [Pythonの型ヒント、UnionとTypeVarの違いを理解する | DevelopersIO](https://dev.classmethod.jp/articles/python-union-vs-typevar/)

### Union

いずれかの型にマッチすればOKとする型ヒント。

`Union[X,Y]` ならば、 `X` または `Y` の型にマッチすればOK。

Python 3.7からは `X | Y` と書けるようになった。
See https://docs.python.org/ja/3/library/stdtypes.html#types-union
5 changes: 3 additions & 2 deletions content/ja/a/software/terraform/editor.md
Expand Up @@ -30,13 +30,14 @@ See also [Visual Studio Code]({{< ref "/a/software/editor/vscode.md" >}})

### Extensions

- [Terraform - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=mauve.terraform)
- 2020年5月、公式になった
- [HashiCorp Terraform - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform)
- 2020年5月、公式になった。当時は「mauve.terraform」だったが、2022年6月現在は「HashiCorp.terraform」となっている。

参考:

- [Supporting the HashiCorp Terraform Extension for Visual Studio Code](https://www.hashicorp.com/blog/supporting-the-hashicorp-terraform-extension-for-visual-studio-code/)

### 設定

- `terraform-ls` ... terraformの実行ファイルのパスを指定する。自動フォーマットなどで必要
- 自動フォーマット( `editor.formatOnSave` )をONにしておく -> `terraform fmt` が掛かるようになる

0 comments on commit ae7b1a1

Please sign in to comment.