devcontainers / devcontainers/spec

Allow specifying subdirectory to open when port forwarding detected

Ouverte
#413 11 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Aucune donnée de langage
Étoiles
5.7k
Forks
496
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
github, vscode
Domaine
developer-experience
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.