mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Run][New Plugin] VSCode Workspaces/Remote machines (#9050)
* vscode workspaces plugin for Powertoys Run
* reduce score
* make vscode workspaces dynamic instead of string to prevent exceptions
* change icons again
* remove unused images and PreserveNewest during build
* code refactoring
* show vscode ssh remote machines
* update score workspaces
* vscode workspaces plugin for Powertoys Run
* remove unused images and PreserveNewest during build
* code refactoring
* remove unused packages
* get ExecutablePath from AppData and use shell to vscode process
* ' instead of \"
* try using ((char)34) instead of '
* add comments
* translate windows paths
* remove unused code
* add vscodeworkspace to installer
* use the new naming convention for plugins
* sign VSCodeWorkspaces.dll
* reimplement ssh-config parser
* update spell-check
* use the new naming convention for community plugins
* minor adjustments
* add actionKeyword {
* prevent copyright
* add localization
* add github link
* bug fix after localization
* --new-window --enable-proposed-api ms-vscode-remote.remote-ssh
* change order by
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs
* Update src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Properties/Resources.resx
* Update src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Properties/Resources.resx
* Update src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Properties/Resources.resx
* Update src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Properties/Resources.resx
* Update src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/Properties/Resources.resx
* fix powertoys run settings not working
* update plugin description
Co-authored-by: ricar <ricar@ASUS>
Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f648ac44b2
commit
7e5fb876bb
@@ -0,0 +1,15 @@
|
||||
using Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper;
|
||||
|
||||
namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.RemoteMachinesHelper
|
||||
{
|
||||
public class VSCodeRemoteMachine
|
||||
{
|
||||
public string Host { get; set; }
|
||||
|
||||
public string User { get; set; }
|
||||
|
||||
public string HostName { get; set; }
|
||||
|
||||
public VSCodeInstance VSCodeInstance { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using Community.PowerToys.Run.Plugin.VSCodeWorkspaces.SshConfigParser;
|
||||
using Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.RemoteMachinesHelper
|
||||
{
|
||||
public class VSCodeRemoteMachinesApi
|
||||
{
|
||||
public VSCodeRemoteMachinesApi() { }
|
||||
|
||||
public List<VSCodeRemoteMachine> Machines
|
||||
{
|
||||
get
|
||||
{
|
||||
var results = new List<VSCodeRemoteMachine>();
|
||||
|
||||
foreach (var vscodeInstance in VSCodeInstances.instances)
|
||||
{
|
||||
// settings.json contains path of ssh_config
|
||||
var vscode_settings = Path.Combine(vscodeInstance.AppData, "User\\settings.json");
|
||||
|
||||
if (File.Exists(vscode_settings))
|
||||
{
|
||||
var fileContent = File.ReadAllText(vscode_settings);
|
||||
|
||||
try
|
||||
{
|
||||
dynamic vscodeSettingsFile = JsonConvert.DeserializeObject<dynamic>(fileContent);
|
||||
if (vscodeSettingsFile.ContainsKey("remote.SSH.configFile"))
|
||||
{
|
||||
var path = vscodeSettingsFile["remote.SSH.configFile"];
|
||||
if (File.Exists(path.Value))
|
||||
{
|
||||
foreach (SshHost h in SshConfig.ParseFile(path.Value))
|
||||
{
|
||||
var machine = new VSCodeRemoteMachine();
|
||||
machine.Host = h.Host;
|
||||
machine.VSCodeInstance = vscodeInstance;
|
||||
machine.HostName = h.HostName != null ? h.HostName : String.Empty;
|
||||
machine.User = h.User != null ? h.User : String.Empty;
|
||||
|
||||
results.Add(machine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var message = $"Failed to deserialize ${vscode_settings}";
|
||||
Log.Exception(message, ex, GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user