devcontainers / devcontainers/spec
Allow specifying subdirectory to open when port forwarding detected
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 5.7k
- Forks
- 496
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
We would like a way to configure a path (subdirectory) of a site to open from a devcontainer. In VSCode, for example, clicking the `browse` button - or from the automatic prompt to open a browser when a port is forwarded - we could open a site like `http://127.0.0.1:4000/azure-sdk` instead of only `http://127.0.0.1:4000`. For GitHub Codespaces, this would be forwarded port to a remote continer.
To `portAttributes` or `otherPortAttributes`, this would add:
| Property | Type | Description |
| --- | --- | --- |
`path` | string | Optional path relative to the site root to open in a browser e.g., "/blog" on forwarded port 4000 would open `http://127.0.0.1:4000/blog` on localhost.
To the schema for both `portAttributes` or `otherPortAttributes`1, this would look like:
```diff
"portsAttributes": {
"type": "object",
"patternProperties": {
"(^\\d+(-\\d+)?$)|(.+)": {
"type": "object",
"description": "A port, range of ports (ex. \"40000-55000\"), or regular expression (ex. \".+\\\\/server.js\"). For a port number or range, the attributes will apply to that port number or range of port numbers. Attributes which use a regular expression will apply to ports whose associated process command line matches the expression.",
"properties": {
+ "path": {
+ "type": "string",
+ "description": "Optional path relative to the site root to open in a browser e.g., '/blog' on forwarded port 4000 would open `http://127.0.0.1:4000/blog` on localhost."
+ },
"onAutoForward": {
```
See microsoft/vscode-remote-release#9518 for additional context.
1 Since `portAttributes` and `otherPortAttributes` appear to be the same schema, wouldn't a `$ref` to a single object definition be sufficient and easier to maintain?
Guía de contribución
Línea de trabajo
Start with the portsAttributes and otherPortAttributes schema described in the issue, then review the VS Code browse and automatic port-forwarding behavior referenced there. Done means the schema supports an optional relative path and forwarded-port browser URLs open that path for both attribute collections; also resolve whether they should share a $ref definition.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- github, vscode
- Área
- developer-experience
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100