devcontainers / devcontainers/spec

Allow specifying subdirectory to open when port forwarding detected

オープン
#413 コメント 11 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
言語のデータがありません
スター
5.7k
フォーク
496
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github, vscode
領域
developer-experience
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。