PowerShell / ProjectMercury

An interactive shell to work with AI-powered assistance providers
MIT License
52 stars 13 forks source link

Make '/agent config' to use the default editor for the setting file based on its extension #164

Closed daxian-dbw closed 4 months ago

daxian-dbw commented 4 months ago

PR Summary

Fix #163

Make '/agent config' to use the default editor for the setting file based on its extension, like what Windows Terminal does with the "Open JSON file" button in the settings page.

This is supposed to be easy, by simply start a process with the file's path using ShellExecute. However, I run into 2 issues with that:

  1. To simply use UseShellExecute to open a file, the file needs to exist already.
  2. When simply using shell execute to open a file whose default editor is VSCode from a console app, VSCode writes log messages to the cosnole output and there is no way to suppress it (see screenshot below).

image

To resolve those 2 problems, I need to find the executable of the default application for a given file extension.