Merge pull request #20 from microsoft/ports
Update ports and use Pylance
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"terminal.integrated.shell.linux": "/bin/bash",
|
"terminal.integrated.shell.linux": "/bin/bash",
|
||||||
"python.pythonPath": "/usr/local/bin/python",
|
"python.pythonPath": "/usr/local/bin/python",
|
||||||
|
"python.languageServer": "Pylance",
|
||||||
"python.linting.enabled": true,
|
"python.linting.enabled": true,
|
||||||
"python.linting.pylintEnabled": true,
|
"python.linting.pylintEnabled": true,
|
||||||
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
|
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
|
||||||
@@ -33,16 +34,14 @@
|
|||||||
|
|
||||||
// Add the IDs of extensions you want installed when the container is created.
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"ms-python.python"
|
"ms-python.python",
|
||||||
|
"ms-python.vscode-pylance"
|
||||||
],
|
],
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [9000],
|
// "forwardPorts": [9000],
|
||||||
|
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
|
||||||
"postCreateCommand": "pip3 install -r requirements.txt",
|
|
||||||
|
|
||||||
// Use 'portsAttributes' to set default properties for specific forwarded ports.
|
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
"9000": {
|
"9000": {
|
||||||
"label": "Hello Remote World",
|
"label": "Hello Remote World",
|
||||||
@@ -50,6 +49,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Comment out to connect as root instead.
|
// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
|
||||||
|
// "otherPortsAttributes": {
|
||||||
|
// "onAutoForward": "silent"
|
||||||
|
// },
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
"postCreateCommand": "pip3 install -r requirements.txt",
|
||||||
|
|
||||||
|
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
"remoteUser": "vscode"
|
"remoteUser": "vscode"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,12 +68,10 @@ Some things to try:
|
|||||||
|
|
||||||
You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect.
|
You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect.
|
||||||
|
|
||||||
**Forward a port statically:** As an example change, let's forward a port statically in the `.devcontainer/devcontainer.json` file.
|
**Open browser automatically:** As an example change, let's update the `portsAttributes` in the `.devcontainer/devcontainer.json` file to open a browser when our port is automatically forwarded.
|
||||||
|
|
||||||
> **Note:** Remote-Containers and Codespaces also take care of dynamic port forwarding, but there may be instances in which we want to statically declare a forwarded port.
|
|
||||||
|
|
||||||
- Open the `.devcontainer/devcontainer.json` file.
|
- Open the `.devcontainer/devcontainer.json` file.
|
||||||
- Uncomment the `forwardedPorts` attribute and adjust the port number as needed.
|
- Modify the `"onAutoForward"` attribute in your `portsAttributes` from `"notify"` to `"openBrowser"`.
|
||||||
- Press <kbd>F1</kbd> and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
|
- Press <kbd>F1</kbd> and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
|
||||||
|
|
||||||
### More samples
|
### More samples
|
||||||
|
|||||||
Reference in New Issue
Block a user