vscode-python extension
#code-reading
https://github.com/microsoft/vscode-python を読んだメモ
formatter のような、外部コマンド実行はどうやっている?
yapf でフォーマットするとき、以下が起こるのでその実装を知りたい
現在の環境にインストールされていれば使う
インストールされていなければ、入れる
コードを読む
formatters: https://github.com/microsoft/vscode-python/tree/master/src/client/formatters
yapf 実行している場所: https://github.com/microsoft/vscode-python/blob/master/src/client/formatters/yapfFormatter.ts#L35
ここで実行 https://github.com/microsoft/vscode-python/blob/master/src/client/formatters/baseFormatter.ts#L76-L78
エラー処理は https://github.com/microsoft/vscode-python/blob/master/src/client/formatters/baseFormatter.ts#L90
入ってなかったらインストール https://github.com/microsoft/vscode-python/blob/master/src/client/formatters/baseFormatter.ts#L108-L117
DI でつかっている部品
IPythonToolExecutionService
実装 https://github.com/microsoft/vscode-python/blob/649156a09ccdc51c0d20f7cd44540f1918f9347b/src/client/common/process/pythonToolService.ts
IPythonExecutionFactory or IProcessServiceFactory (IProcessServiceFactory かな?)
実装 https://github.com/microsoft/vscode-python/blob/765c48387306b2526bb3b4b5d8f6dc9fc0b2b78d/src/client/common/process/processFactory.ts
ProcessService https://github.com/microsoft/vscode-python/blob/765c48387306b2526bb3b4b5d8f6dc9fc0b2b78d/src/client/common/process/proc.ts
decoder は適当に吐いたログをよさげにテキスト化してくれるっぽい
IInstaller
#CodeReading