mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-27 14:59:16 +08:00
Merge branch 'main' into dev/ani/advanced-paste-semantic-kernel
This commit is contained in:
commit
b10d26c60c
28
.github/actions/spell-check/expect.txt
vendored
28
.github/actions/spell-check/expect.txt
vendored
@ -69,11 +69,9 @@ AQS
|
||||
ARandom
|
||||
ARCHITEW
|
||||
ARemapped
|
||||
ari
|
||||
ARPINSTALLLOCATION
|
||||
ARPPRODUCTICON
|
||||
ARRAYSIZE
|
||||
arw
|
||||
asf
|
||||
AShortcut
|
||||
ASingle
|
||||
@ -151,6 +149,7 @@ CALG
|
||||
callbackptr
|
||||
calpwstr
|
||||
Cangjie
|
||||
caniuse
|
||||
CANRENAME
|
||||
CAPTUREBLT
|
||||
CAPTURECHANGED
|
||||
@ -260,7 +259,6 @@ critsec
|
||||
Crossdevice
|
||||
CRSEL
|
||||
crx
|
||||
crw
|
||||
CSearch
|
||||
CSettings
|
||||
cso
|
||||
@ -302,8 +300,8 @@ DCOM
|
||||
dcommon
|
||||
dcomp
|
||||
DComposition
|
||||
dcr
|
||||
dcs
|
||||
DCR
|
||||
DCs
|
||||
ddd
|
||||
DDEIf
|
||||
DDevice
|
||||
@ -373,7 +371,6 @@ DRAWCLIPBOARD
|
||||
DRAWFRAME
|
||||
drawingcolor
|
||||
dreamsofameaningfullife
|
||||
drf
|
||||
drivedetectionwarning
|
||||
dshow
|
||||
DSTINVERT
|
||||
@ -417,7 +414,6 @@ editkeyboardwindow
|
||||
EDITSHORTCUTS
|
||||
editshortcutswindow
|
||||
EFile
|
||||
eip
|
||||
ekus
|
||||
emmintrin
|
||||
Emoji
|
||||
@ -591,7 +587,7 @@ Hiberboot
|
||||
HIBYTE
|
||||
hicon
|
||||
HIDEWINDOW
|
||||
hif
|
||||
Hif
|
||||
HIMAGELIST
|
||||
himl
|
||||
hinst
|
||||
@ -668,7 +664,6 @@ IGNOREUNKNOWN
|
||||
IGraphics
|
||||
iid
|
||||
Iindex
|
||||
iiq
|
||||
IJson
|
||||
Ijwhost
|
||||
IKs
|
||||
@ -733,15 +728,14 @@ ith
|
||||
ITHUMBNAIL
|
||||
IUI
|
||||
IUnknown
|
||||
IUse
|
||||
IWbem
|
||||
IWeb
|
||||
IWIC
|
||||
iwr
|
||||
IYUV
|
||||
jfi
|
||||
jfif
|
||||
jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi
|
||||
jif
|
||||
jjw
|
||||
jobject
|
||||
jpe
|
||||
@ -750,7 +744,6 @@ Jsons
|
||||
jsonval
|
||||
junja
|
||||
jxr
|
||||
kdc
|
||||
keybd
|
||||
KEYBDDATA
|
||||
KEYBDINPUT
|
||||
@ -875,7 +868,6 @@ MAXIMIZEBOX
|
||||
MAXSHORTCUTSIZE
|
||||
maxversiontested
|
||||
MBR
|
||||
mdc
|
||||
MDICHILD
|
||||
MDL
|
||||
mdtext
|
||||
@ -883,7 +875,6 @@ mdtxt
|
||||
mdwn
|
||||
MEDIASUBTYPE
|
||||
mediatype
|
||||
mef
|
||||
MENUITEMINFO
|
||||
MENUITEMINFOW
|
||||
MERGECOPY
|
||||
@ -941,7 +932,6 @@ mpmc
|
||||
MRM
|
||||
MRT
|
||||
mru
|
||||
mrw
|
||||
msc
|
||||
mscorlib
|
||||
msdata
|
||||
@ -1064,7 +1054,6 @@ NOZORDER
|
||||
NPH
|
||||
npmjs
|
||||
NResize
|
||||
nrw
|
||||
nsunt
|
||||
NTAPI
|
||||
ntdll
|
||||
@ -1094,7 +1083,6 @@ opensource
|
||||
openxmlformats
|
||||
OPTIMIZEFORINVOKE
|
||||
ORAW
|
||||
ori
|
||||
ORPHANEDDIALOGTITLE
|
||||
ORSCANS
|
||||
oss
|
||||
@ -1273,7 +1261,6 @@ QUERYENDSESSION
|
||||
QUERYOPEN
|
||||
QUEUESYNC
|
||||
QUNS
|
||||
raf
|
||||
RAII
|
||||
RAlt
|
||||
Rasterize
|
||||
@ -1377,8 +1364,6 @@ runtimes
|
||||
ruuid
|
||||
rvm
|
||||
rwin
|
||||
rwl
|
||||
rwz
|
||||
sacl
|
||||
safeprojectname
|
||||
SAMEKEYPREVIOUSLYMAPPED
|
||||
@ -1513,7 +1498,6 @@ Srch
|
||||
SRCINVERT
|
||||
SRCPAINT
|
||||
SResize
|
||||
srf
|
||||
srme
|
||||
srre
|
||||
srw
|
||||
@ -1588,6 +1572,8 @@ SYSLIB
|
||||
SYSMENU
|
||||
SYSTEMAPPS
|
||||
SYSTEMTIME
|
||||
SYSTEMWOW
|
||||
tailwindcss
|
||||
tapp
|
||||
TApplication
|
||||
TApplied
|
||||
|
@ -201,6 +201,7 @@
|
||||
"PowerToys.WorkspacesLauncherUI.exe",
|
||||
"PowerToys.WorkspacesLauncherUI.dll",
|
||||
"PowerToys.WorkspacesModuleInterface.dll",
|
||||
"PowerToys.WorkspacesCsharpLibrary.dll",
|
||||
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewExt.dll",
|
||||
"WinUI3Apps\\PowerToys.RegistryPreviewUILib.dll",
|
||||
|
@ -39,6 +39,8 @@ Contact the developers of a plugin directly for assistance with a specific plugi
|
||||
| [GitHubRepo](https://github.com/8LWXpg/PowerToysRun-GitHubRepo) | [8LWXpg](https://github.com/8LWXpg) | Search and open GitHub repositories |
|
||||
| [ProcessKiller](https://github.com/8LWXpg/PowerToysRun-ProcessKiller) | [8LWXpg](https://github.com/8LWXpg) | Search and kill processes |
|
||||
| [ChatGPT](https://github.com/ferraridavide/ChatGPTPowerToys) | [ferraridavide](https://github.com/ferraridavide) | Ask a question to ChatGPT |
|
||||
| [CanIUse](https://github.com/skttl/ptrun-caniuse) | [skttl](https://github.com/skttl) | Look up browser feature support with caniuse.com |
|
||||
| [TailwindCSS](https://github.com/skttl/ptrun-tailwindcss) | [skttl](https://github.com/skttl) | Search the documentation of TailwindCSS |
|
||||
|
||||
## Extending software plugins
|
||||
|
||||
|
@ -7,7 +7,7 @@ export async function registerAdditionalLanguages(monaco){
|
||||
await languageDefinitions();
|
||||
registerAdditionalLanguage("cppExt", [".ino", ".pde"], "cpp", monaco)
|
||||
registerAdditionalLanguage("xmlExt", [".wsdl", ".csproj", ".vcxproj", ".vbproj", ".fsproj"], "xml", monaco)
|
||||
registerAdditionalLanguage("txtExt", [".sln", ".log", ".vsconfig", ".env", ".srt"], "txt", monaco)
|
||||
registerAdditionalLanguage("txtExt", [".sln", ".log", ".vsconfig", ".env", ".srt", ".ahk"], "txt", monaco)
|
||||
registerAdditionalLanguage("razorExt", [".razor"], "razor", monaco)
|
||||
registerAdditionalLanguage("vbExt", [".vbs"], "vb", monaco)
|
||||
registerAdditionalLanguage("iniExt", [".inf", ".gitconfig", ".gitattributes", ".editorconfig"], "ini", monaco)
|
||||
|
File diff suppressed because one or more lines are too long
@ -29,34 +29,28 @@ namespace Microsoft.PowerToys.FilePreviewCommon
|
||||
new XmlFormatter(),
|
||||
}.AsReadOnly();
|
||||
|
||||
private static string? _monacoDirectory;
|
||||
private static readonly Lazy<string> _monacoDirectory = new(GetRuntimeMonacoDirectory);
|
||||
|
||||
public static string GetRuntimeMonacoDirectory()
|
||||
/// <summary>
|
||||
/// Gets the path of the Monaco assets folder.
|
||||
/// </summary>
|
||||
public static string MonacoDirectory => _monacoDirectory.Value;
|
||||
|
||||
private static string GetRuntimeMonacoDirectory()
|
||||
{
|
||||
string codeBase = Assembly.GetExecutingAssembly().Location;
|
||||
string path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(codeBase) ?? string.Empty, "Assets", "Monaco"));
|
||||
if (Path.Exists(path))
|
||||
string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty;
|
||||
|
||||
// If the executable is within "WinUI3Apps", correct the path first.
|
||||
if (Path.GetFileName(exePath) == "WinUI3Apps")
|
||||
{
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're likely in WinUI3Apps directory and need to go back to the base directory.
|
||||
return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(codeBase) ?? string.Empty, "..", "Assets", "Monaco"));
|
||||
}
|
||||
exePath = Path.Combine(exePath, "..");
|
||||
}
|
||||
|
||||
public static string MonacoDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_monacoDirectory))
|
||||
{
|
||||
_monacoDirectory = GetRuntimeMonacoDirectory();
|
||||
}
|
||||
string monacoPath = Path.Combine(exePath, "Assets", "Monaco");
|
||||
|
||||
return _monacoDirectory;
|
||||
}
|
||||
return Directory.Exists(monacoPath) ?
|
||||
monacoPath :
|
||||
throw new DirectoryNotFoundException($"Monaco assets directory not found at {monacoPath}");
|
||||
}
|
||||
|
||||
public static JsonDocument GetLanguages()
|
||||
|
@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -22,6 +23,7 @@ using Peek.FilePreviewer.Models;
|
||||
using Peek.FilePreviewer.Previewers.Helpers;
|
||||
using Peek.FilePreviewer.Previewers.Interfaces;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics.Imaging;
|
||||
|
||||
namespace Peek.FilePreviewer.Previewers
|
||||
{
|
||||
@ -58,6 +60,12 @@ namespace Peek.FilePreviewer.Previewers
|
||||
|
||||
private DispatcherQueue Dispatcher { get; }
|
||||
|
||||
private static readonly HashSet<string> _supportedFileTypes =
|
||||
BitmapDecoder.GetDecoderInformationEnumerator()
|
||||
.SelectMany(di => di.FileExtensions)
|
||||
.Union([".svg", ".qoi"])
|
||||
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public static bool IsItemSupported(IFileSystemItem item)
|
||||
{
|
||||
return _supportedFileTypes.Contains(item.Extension);
|
||||
@ -199,74 +207,5 @@ namespace Peek.FilePreviewer.Previewers
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static readonly HashSet<string> _supportedFileTypes = new HashSet<string>
|
||||
{
|
||||
// Image types
|
||||
".bmp",
|
||||
".gif",
|
||||
".jpg",
|
||||
".jfif",
|
||||
".jfi",
|
||||
".jif",
|
||||
".jpeg",
|
||||
".jpe",
|
||||
".png",
|
||||
".tif", // very slow for large files: no thumbnail?
|
||||
".tiff", // NEED TO TEST
|
||||
".dib", // NEED TO TEST
|
||||
".heic",
|
||||
".heif",
|
||||
".hif", // NEED TO TEST
|
||||
".avif", // NEED TO TEST
|
||||
".jxr",
|
||||
".wdp",
|
||||
".ico", // NEED TO TEST
|
||||
".thumb", // NEED TO TEST
|
||||
".webp",
|
||||
|
||||
// Raw types
|
||||
".arw",
|
||||
".cr2",
|
||||
".crw",
|
||||
".erf",
|
||||
".kdc", // NEED TO TEST
|
||||
".mrw",
|
||||
".nef",
|
||||
".nrw",
|
||||
".orf",
|
||||
".pef",
|
||||
".raf",
|
||||
".raw",
|
||||
".rw2",
|
||||
".rwl",
|
||||
".sr2",
|
||||
".srw",
|
||||
".srf",
|
||||
".dcs", // NEED TO TEST
|
||||
".dcr",
|
||||
".drf", // NEED TO TEST
|
||||
".k25",
|
||||
".3fr",
|
||||
".ari", // NEED TO TEST
|
||||
".bay", // NEED TO TEST
|
||||
".cap", // NEED TO TEST
|
||||
".iiq",
|
||||
".eip", // NEED TO TEST
|
||||
".fff",
|
||||
".mef",
|
||||
|
||||
// ".mdc", // Crashes in GetFullBitmapFromPathAsync
|
||||
".mos",
|
||||
".R3D",
|
||||
".rwz", // NEED TO TEST
|
||||
".x3f",
|
||||
".ori",
|
||||
".cr3",
|
||||
|
||||
".svg",
|
||||
|
||||
".qoi",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,11 @@ namespace Peek.FilePreviewer.Previewers
|
||||
|
||||
public static HashSet<string> GetExtensions()
|
||||
{
|
||||
HashSet<string> set = new HashSet<string>();
|
||||
HashSet<string> set = [];
|
||||
|
||||
try
|
||||
{
|
||||
JsonDocument languageListDocument = Microsoft.PowerToys.FilePreviewCommon.MonacoHelper.GetLanguages();
|
||||
using JsonDocument languageListDocument = Microsoft.PowerToys.FilePreviewCommon.MonacoHelper.GetLanguages();
|
||||
JsonElement languageList = languageListDocument.RootElement.GetProperty("list");
|
||||
foreach (JsonElement e in languageList.EnumerateArray())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user