public CodeEditor.Installation[] PathCallback() { var res = RiderPathLocator.GetAllRiderPaths() .Select(riderInfo => new CodeEditor.Installation { Path = riderInfo.Path, Name = riderInfo.Presentation }) .ToList(); var editorPath = RiderScriptEditor.CurrentEditor; if (RiderScriptEditor.IsRiderInstallation(editorPath) && !res.Any(a => a.Path == editorPath) && FileSystemUtil.EditorPathExists(editorPath)) { // External editor manually set from custom location var info = new RiderPathLocator.RiderInfo(editorPath, false); var installation = new CodeEditor.Installation { Path = info.Path, Name = info.Presentation }; res.Add(installation); } return(res.ToArray()); }
public virtual bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { var result = TryGetVisualStudioInstallationForPath(editorPath, searchInstallations: false, out var vsi); installation = vsi == null ? default : vsi.ToCodeEditorInstallation(); return(result); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { var lowerCasePath = editorPath.ToLower(); var filename = Path.GetFileName(lowerCasePath).Replace(" ", ""); var installations = Installations; if (!k_SupportedFileNames.Contains(filename)) { installation = default; return(false); } if (!installations.Any()) { installation = default; return(false); } try { installation = installations.First(inst => inst.Path == editorPath); } catch (InvalidOperationException) { installation = new CodeEditor.Installation { Name = "Visual Studio Code", Path = editorPath }; } return(true); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { installation = new CodeEditor.Installation { Name = Path.GetFileNameWithoutExtension(editorPath), Path = editorPath }; return(true); }
/// Unity stores the path of the chosen editor. An instance of /// IExternalCodeEditor can take responsibility for this path, by returning /// true when this method is being called. The out variable installation need /// to be constructed with the path and the name that should be shown in the /// "External Tools" code editor list. public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { //~ Debug.Log($"[VimExternalEditor] TryGetInstallationForPath {editorPath}"); // I don't understand why this function exists. I must return true // to be able to control what the selected editor does, but it's // just passing one of the paths I provided in Installations. installation = Installations.FirstOrDefault(install => install.Path == editorPath); return !string.IsNullOrEmpty(installation.Name); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { foreach (CodeEditor.Installation i in Installations) { if (i.Path == editorPath) { installation = i; return(true); } } installation = default; return(false); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { if (FileSystemUtil.EditorPathExists(editorPath) && IsRiderInstallation(editorPath)) { var info = new RiderPathLocator.RiderInfo(editorPath, false); installation = new CodeEditor.Installation { Name = info.Presentation, Path = info.Path }; return(true); } installation = default; return(false); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { if (string.IsNullOrEmpty(editorPath)) { installation = new CodeEditor.Installation { Name = "", Path = "" }; return(false); } installation = new CodeEditor.Installation { Name = OSUtil.GetAppFriendlyName(editorPath) + " (internal)", Path = editorPath }; return(true); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { var lowerCasePath = editorPath.ToLower(); if (lowerCasePath.EndsWith("vcsexpress.exe", StringComparison.OrdinalIgnoreCase)) { installation = new CodeEditor.Installation { Name = "VSExpress", Path = editorPath }; m_Installation = installation; return(true); } if (lowerCasePath.EndsWith("devenv.exe", StringComparison.OrdinalIgnoreCase) || lowerCasePath.Replace(" ", "").EndsWith("visualstudio.app", StringComparison.OrdinalIgnoreCase) || lowerCasePath.Replace(" ", "").EndsWith("visualstudio(preview).app", StringComparison.OrdinalIgnoreCase)) { installation = new CodeEditor.Installation { Name = "VisualStudio", Path = editorPath }; m_Installation = installation; return(true); } if (lowerCasePath.Contains("monodevelop") || lowerCasePath.Replace(" ", "").Contains("xamarinstudio")) { installation = new CodeEditor.Installation { Name = "MonoDevelop", Path = editorPath }; m_Installation = installation; return(true); } installation = default; m_Installation = installation; return(false); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { var lowerCasePath = editorPath.ToLower(); if (lowerCasePath.EndsWith("vcsexpress.exe")) { installation = new CodeEditor.Installation { Name = "VSExpress", Path = editorPath }; m_Installation = installation; return(true); } if (lowerCasePath.EndsWith("devenv.exe")) { installation = new CodeEditor.Installation { Name = "VisualStudio", Path = editorPath }; m_Installation = installation; return(true); } var filename = Path.GetFileName(lowerCasePath.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar)).Replace(" ", ""); if (filename == "visualstudio.app" || filename == "visualstudio(preview).app" || lowerCasePath.Contains("monodevelop") || lowerCasePath.Contains("xamarinstudio") || lowerCasePath.Contains("xamarin studio")) { installation = new CodeEditor.Installation { Name = "MonoDevelop", Path = editorPath }; m_Installation = installation; return(true); } installation = default; m_Installation = installation; return(false); }
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation) { if (IsRiderInstallation(editorPath)) { try { installation = Installations.First(inst => inst.Path == editorPath); } catch (InvalidOperationException) { installation = new CodeEditor.Installation { Name = editorPath, Path = editorPath }; } return(true); } installation = default; return(false); }