mirror of
https://github.com/esphome/esphome.git
synced 2024-12-18 19:44:53 +01:00
Adds support cpp to vscode (#1828)
Co-authored-by: Stefan Agner <stefan@agner.ch>
This commit is contained in:
parent
93f8ee7e60
commit
c411043681
5 changed files with 58 additions and 26 deletions
|
@ -2,16 +2,29 @@
|
||||||
"name": "ESPHome Dev",
|
"name": "ESPHome Dev",
|
||||||
"context": "..",
|
"context": "..",
|
||||||
"dockerFile": "../docker/Dockerfile.dev",
|
"dockerFile": "../docker/Dockerfile.dev",
|
||||||
"postCreateCommand": "mkdir -p config && pip3 install -e .",
|
"postCreateCommand": [
|
||||||
"runArgs": ["--privileged", "-e", "ESPHOME_DASHBOARD_USE_PING=1"],
|
"script/devcontainer-post-create"
|
||||||
|
],
|
||||||
|
"runArgs": [
|
||||||
|
"--privileged",
|
||||||
|
"-e",
|
||||||
|
"ESPHOME_DASHBOARD_USE_PING=1"
|
||||||
|
],
|
||||||
"appPort": 6052,
|
"appPort": 6052,
|
||||||
"extensions": [
|
"extensions": [
|
||||||
|
// python
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
"visualstudioexptteam.vscodeintellicode",
|
"visualstudioexptteam.vscodeintellicode",
|
||||||
"redhat.vscode-yaml"
|
// yaml
|
||||||
|
"redhat.vscode-yaml",
|
||||||
|
// cpp
|
||||||
|
"ms-vscode.cpptools",
|
||||||
|
// editorconfig
|
||||||
|
"editorconfig.editorconfig",
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"python.pythonPath": "/usr/local/bin/python",
|
"python.languageServer": "Pylance",
|
||||||
|
"python.pythonPath": "/usr/bin/python3",
|
||||||
"python.linting.pylintEnabled": true,
|
"python.linting.pylintEnabled": true,
|
||||||
"python.linting.enabled": true,
|
"python.linting.enabled": true,
|
||||||
"python.formatting.provider": "black",
|
"python.formatting.provider": "black",
|
||||||
|
@ -19,7 +32,7 @@
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.formatOnType": true,
|
"editor.formatOnType": true,
|
||||||
"files.trimTrailingWhitespace": true,
|
"files.trimTrailingWhitespace": true,
|
||||||
"terminal.integrated.shell.linux": "/bin/bash",
|
"terminal.integrated.defaultProfile.linux": "/bin/bash",
|
||||||
"yaml.customTags": [
|
"yaml.customTags": [
|
||||||
"!secret scalar",
|
"!secret scalar",
|
||||||
"!lambda scalar",
|
"!lambda scalar",
|
||||||
|
@ -27,6 +40,18 @@
|
||||||
"!include_dir_list scalar",
|
"!include_dir_list scalar",
|
||||||
"!include_dir_merge_list scalar",
|
"!include_dir_merge_list scalar",
|
||||||
"!include_dir_merge_named scalar"
|
"!include_dir_merge_named scalar"
|
||||||
]
|
],
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.git": true,
|
||||||
|
"**/.DS_Store": true,
|
||||||
|
"**/*.pyc": {
|
||||||
|
"when": "$(basename).py"
|
||||||
|
},
|
||||||
|
"**/__pycache__": true
|
||||||
|
},
|
||||||
|
"files.associations": {
|
||||||
|
"**/.vscode/*.json": "jsonc"
|
||||||
|
},
|
||||||
|
"C_Cpp.clang_format_path": "/usr/bin/clang-format-11",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ insert_final_newline = true
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
|
|
||||||
# python
|
# python
|
||||||
[*.{py}]
|
[*.py]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
@ -26,3 +26,9 @@ indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
quote_type = single
|
quote_type = single
|
||||||
|
|
||||||
|
# JSON
|
||||||
|
[*.json]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1 @@
|
||||||
FROM esphome/esphome-base-amd64:3.4.0
|
FROM esphome/esphome-lint:1.1
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
python3-wheel \
|
|
||||||
net-tools \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /workspaces
|
|
||||||
ENV SHELL /bin/bash
|
|
||||||
|
|
|
@ -28,11 +28,6 @@ def write_version(version: str):
|
||||||
r"ARG BUILD_FROM=esphome/esphome-base-amd64:.*",
|
r"ARG BUILD_FROM=esphome/esphome-base-amd64:.*",
|
||||||
f"ARG BUILD_FROM=esphome/esphome-base-amd64:{version}",
|
f"ARG BUILD_FROM=esphome/esphome-base-amd64:{version}",
|
||||||
)
|
)
|
||||||
sub(
|
|
||||||
"docker/Dockerfile.dev",
|
|
||||||
r"FROM esphome/esphome-base-amd64:.*",
|
|
||||||
f"FROM esphome/esphome-base-amd64:{version}",
|
|
||||||
)
|
|
||||||
sub(
|
sub(
|
||||||
"docker/Dockerfile.lint",
|
"docker/Dockerfile.lint",
|
||||||
r"FROM esphome/esphome-lint-base:.*",
|
r"FROM esphome/esphome-lint-base:.*",
|
||||||
|
|
18
script/devcontainer-post-create
Executable file
18
script/devcontainer-post-create
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
# set -x
|
||||||
|
|
||||||
|
mkdir -p config
|
||||||
|
pip3 install -e .
|
||||||
|
|
||||||
|
cpp_json=.vscode/c_cpp_properties.json
|
||||||
|
if [ ! -f $cpp_json ]; then
|
||||||
|
echo "Initializing PlatformIO..."
|
||||||
|
pio init --ide vscode --silent
|
||||||
|
sed -i "/\\/workspaces\/esphome\/include/d" $cpp_json
|
||||||
|
else
|
||||||
|
echo "Cpp environment already configured. To reconfigure it you could run one the following commands:"
|
||||||
|
echo " pio init --ide vscode -e livingroom8266"
|
||||||
|
echo " pio init --ide vscode -e livingroom32"
|
||||||
|
fi
|
Loading…
Reference in a new issue