いろいろやってみるにっき

てきとーに生きている奴の日記

古いエントリのサムネイル画像がリンク切れになってたりするけど、チマチマ修正中


VS Code Serverを起動してみる

これならCloud9並に使えるかも。

 

forest.watch.impress.co.jp

 

ということで使ってみる。

code.visualstudio.com

 

WindowsでやってみるのでPowerShellで。

PS C:\Users\shigeo-t> New-Item "${HOME}\.vscode-server-launcher\bin" -Force -ItemType "directory"

    Directory: C:\Users\shigeo-t\.vscode-server-launcher

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          2022/07/10     3:39                bin

PS C:\Users\shigeo-t> Invoke-WebRequest "https://aka.ms/vscode-server-launcher/x86_64-pc-windows-msvc" -OutFile "${HOME}\.vscode-server-launcher\bin\code-server.exe"
PS C:\Users\shigeo-t> [Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";${HOME}\.vscode-server-launcher\bin", "User")
PS C:\Users\shigeo-t> code-server

VS Code Server

*
* By using the software, you agree to the
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*Do you accept the terms in the License Agreement · yes
To grant access to the server, please log into https://github.com/login/device and use code 81BD-F84E

GitHubのデバイス認証。

PowerShellに表示されているデバイスアクティベーション画面に変わる。

入れる。全角入力モードだとうまくいかないので半角に変える。

[Continue]をクリックするとこんな画面になる。

[Authorize Visulal-Studio-Code]をクリックするとこうなる。

PowerShellのほうはこうなる。「error Failed to read confirm input: Not a terminal」が出ている。

? What would you like to call this machine? (gallant-tapaculo) › [2022-07-10 03:47:08] error Failed to read confirm input: Not a terminal
PS C:\Users\shigeo-t>

 

構わず説明通りcode-serverを入れるとエラーになる。

PS C:\Users\shigeo-t> code-server
✔ What would you like to call this machine? · wonderful-seedeater
[2022-07-10 03:50:02] info Creating tunnel with the name: wonderful-seedeater
[2022-07-10 03:50:03] error Could not create tunnel with name: wonderful-seedeater
Reason: ResponseError(ResponseError { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("global.rel.tunnels.api.visualstudio.com")), port: None, path: "/api/v1/tunnels", query: Some(""), fragment: None }, status_code: 403, data: Some("{\"title\":\"Request not permitted.\",\"status\":403,\"detail\":\"Unauthorized tunnel creation access: Authenticated user does not have 'create' access scope for the default tunnel domain.\"}"), request_id: Some("fb01965a-b020-4157-ab9f-4e4623632ad6") })

PowerShellからの起動は失敗した。

 

Visual Studio Code Server にはブラウザでアクセスできるようなので、ブラウザのURL欄にvscode.devと入れる。アクセスできる。しかも最初から日本語になってる。前にWeb版出たよって時にアクセスしたら日本語じゃないし日本語化できなかった。

[フォルダを開く]をクリックするとローカルフォルダを開くことができる。

また、まだ上の画面では表示されていないが時間が掛かって表示される[リモート リポジトリを開く]をクリックすると、上にこれが表示される。Open Repository from GitHubをクリックする。

ダイアログが表示される。[許可]をクリック。

こんなダイアログが表示される。

接続すると実際にGitHubにつながる。自分のいつものアカウントを使ったので見せられない。

実際に開く。

 

ということで最初からvscode.devをまっさらなOSで開いてみた。開くねえ。

Linuxマシン(VM)でも。

しかも、普通にそのままローカルもGitHubも使える。なんだよ、最初のPowerShellのコマンドもデバイスのコード認証もいらないじゃん。

 

ということでVS Code Server使うならブラウザのURL欄に vscode.dev と入れればいい。インストールも不要なので、ちょっとだけ触るマシンでブラウザが使えてインターネット接続できるならこれでイケる。

お時間あったら、他のエントリもクリックして頂ければ幸いです。