PowerToys
PowerToys copied to clipboard
[PastePlain] Introduce Paste as Plain Text module
Summary of the Pull Request
Introduces the "Paste as Plain Text" module which allows the user to paste their most recent clipboard content as plain text (as opposed to formatted text).
PR Checklist
- [X] Closes: #1684
- [X] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [ ] Tests: Added/updated and all pass
- [ ] Localization: All end user facing strings can be localized
- [ ] Dev docs: Added/updated
- [ ] New binaries: Added on the required places
- [ ] JSON for signing for new binaries
- [ ] WXS for installer for new binaries and localization folder
- [ ] YML for CI pipeline for new test projects
- [ ] YML for signed pipeline
- [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
Detailed Description of the Pull Request / Additional comments
This is heavily based on the work done for the "Text Extractor" module then ripping out anything that may be unnecessary. The same KeyboardMonitor is implemented and used. The interesting logic really falls inside the KeyboardMonitor as that is where the clipboard is opened/read/modified, then a ctrl+v input sequence is injected.
The default key binding for this will be ctrl+win+v.
Validation Steps Performed
- [X] works with win+shift+v
- [x] settings UI added and updated
- [x] added to "welcome to powertoys"
- [x] tested with rebinded keys
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view or the :scroll:action log for details.
Unrecognized words (20)
CARLOS
HWHEEL
LEFTDOWN
LEFTUP
MIDDLEDOWN
MIDDLEUP
NOCOALESCE
nonconvert
pasteplain
pastetext
RIGHTDOWN
RIGHTUP
Roamable
SPACEBAR
UMsg
VIRTUALDESK
WScan
WVk
XDOWN
XUP
Previously acknowledged words that are now absent
depsjsonpath NONCONVERT :arrow_right:To accept :heavy_check_mark: these unrecognized words as correct and remove the previously acknowledged and now absent words, run the following commands
... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the dev/cazamor/paste-as-plain-text branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.21/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/4028857826/attempts/1'
Available :books: dictionaries could cover words not in the :blue_book: dictionary
This includes both expected items (2141) from .github/actions/spell-check/expect.txt and unrecognized words (20)
| Dictionary | Entries | Covers |
|---|---|---|
| cspell:cpp/src/cpp.txt | 30216 | 121 |
| cspell:win32/src/win32.txt | 53509 | 117 |
| cspell:python/src/python/python-lib.txt | 3873 | 31 |
| cspell:php/php.txt | 2597 | 16 |
| cspell:node/node.txt | 1768 | 13 |
| cspell:typescript/typescript.txt | 1211 | 12 |
| cspell:python/src/python/python.txt | 453 | 10 |
| cspell:java/java.txt | 7642 | 10 |
| cspell:aws/aws.txt | 218 | 8 |
| cspell:python/src/common/extra.txt | 741 | 7 |
Consider adding them using (in .github/workflows/spelling2.yml):
with:
extra_dictionaries:
cspell:cpp/src/cpp.txt
cspell:win32/src/win32.txt
cspell:python/src/python/python-lib.txt
cspell:php/php.txt
cspell:node/node.txt
cspell:typescript/typescript.txt
cspell:python/src/python/python.txt
cspell:java/java.txt
cspell:aws/aws.txt
cspell:python/src/common/extra.txt
To stop checking additional dictionaries, add:
with:
check_extra_dictionaries: ''
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
Hi @carlos-zamora
Love this! Very useful!
- There are a few references to PowerOCR in
PastePlainModuleInterface.vcxproj. Wasn't able to build before fix them. - I think
KeyboardMonitor.csshould be started only where running detatched from PowerToys runner (VS debug) and use Low Level Keyboard Hook when launched under the runner. ColorPicker and PowerOCR are designed this way. WIN+SHIFT+Vshould work with PowerToys Low Level Keyboard Hook since I am able to use it as activation for other utilities.
So 🔥
Tested and verified that it pastes rich text as plain text using Ctrl+Win+V. \o/
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view or the :scroll:action log for details.
Unrecognized words (19)
CARLOS
HWHEEL
LEFTDOWN
LEFTUP
MIDDLEDOWN
MIDDLEUP
NOCOALESCE
nonconvert
pasteplain
RIGHTDOWN
RIGHTUP
Roamable
SPACEBAR
UMsg
VIRTUALDESK
WScan
WVk
XDOWN
XUP
Previously acknowledged words that are now absent
depsjsonpath NONCONVERT :arrow_right:To accept :heavy_check_mark: these unrecognized words as correct and remove the previously acknowledged and now absent words, run the following commands
... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the dev/cazamor/paste-as-plain-text branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.21/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/4049500945/attempts/1'
Available :books: dictionaries could cover words not in the :blue_book: dictionary
This includes both expected items (2141) from .github/actions/spell-check/expect.txt and unrecognized words (19)
| Dictionary | Entries | Covers |
|---|---|---|
| cspell:cpp/src/cpp.txt | 30216 | 121 |
| cspell:win32/src/win32.txt | 53509 | 117 |
| cspell:python/src/python/python-lib.txt | 3873 | 31 |
| cspell:php/php.txt | 2597 | 16 |
| cspell:node/node.txt | 1768 | 13 |
| cspell:typescript/typescript.txt | 1211 | 12 |
| cspell:python/src/python/python.txt | 453 | 10 |
| cspell:java/java.txt | 7642 | 10 |
| cspell:aws/aws.txt | 218 | 8 |
| cspell:python/src/common/extra.txt | 741 | 7 |
Consider adding them using (in .github/workflows/spelling2.yml):
with:
extra_dictionaries:
cspell:cpp/src/cpp.txt
cspell:win32/src/win32.txt
cspell:python/src/python/python-lib.txt
cspell:php/php.txt
cspell:node/node.txt
cspell:typescript/typescript.txt
cspell:python/src/python/python.txt
cspell:java/java.txt
cspell:aws/aws.txt
cspell:python/src/common/extra.txt
To stop checking additional dictionaries, add:
with:
check_extra_dictionaries: ''
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view or the :scroll:action log for details.
Unrecognized words (19)
CARLOS
HWHEEL
LEFTDOWN
LEFTUP
MIDDLEDOWN
MIDDLEUP
NOCOALESCE
nonconvert
pasteplain
RIGHTDOWN
RIGHTUP
Roamable
SPACEBAR
UMsg
VIRTUALDESK
WScan
WVk
XDOWN
XUP
Previously acknowledged words that are now absent
depsjsonpath NONCONVERT :arrow_right:To accept :heavy_check_mark: these unrecognized words as correct and remove the previously acknowledged and now absent words, run the following commands
... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the dev/cazamor/paste-as-plain-text branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.21/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/4049816099/attempts/1'
Available :books: dictionaries could cover words not in the :blue_book: dictionary
This includes both expected items (2141) from .github/actions/spell-check/expect.txt and unrecognized words (19)
| Dictionary | Entries | Covers |
|---|---|---|
| cspell:cpp/src/cpp.txt | 30216 | 121 |
| cspell:win32/src/win32.txt | 53509 | 117 |
| cspell:python/src/python/python-lib.txt | 3873 | 31 |
| cspell:php/php.txt | 2597 | 16 |
| cspell:node/node.txt | 1768 | 13 |
| cspell:typescript/typescript.txt | 1211 | 12 |
| cspell:python/src/python/python.txt | 453 | 10 |
| cspell:java/java.txt | 7642 | 10 |
| cspell:aws/aws.txt | 218 | 8 |
| cspell:python/src/common/extra.txt | 741 | 7 |
Consider adding them using (in .github/workflows/spelling2.yml):
with:
extra_dictionaries:
cspell:cpp/src/cpp.txt
cspell:win32/src/win32.txt
cspell:python/src/python/python-lib.txt
cspell:php/php.txt
cspell:node/node.txt
cspell:typescript/typescript.txt
cspell:python/src/python/python.txt
cspell:java/java.txt
cspell:aws/aws.txt
cspell:python/src/common/extra.txt
To stop checking additional dictionaries, add:
with:
check_extra_dictionaries: ''
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
Updated the settings UI and OOBE, but when I try to deploy the settings UI project I get a popup saying "The application cannot be run as a standalone process. Please start the application through the runner.".
How can I validate the settings UI and OOBE?
Updated the settings UI and OOBE, but when I try to deploy the settings UI project I get a popup saying "The application cannot be run as a standalone process. Please start the application through the runner.".
How can I validate the settings UI and OOBE?
Option 1 You can build the settings ui as standalone project in debug mode. Then you can start debugging the settings project. The message box can be closed using the X. (Don't close it using the "text" button.)
Option 2 Build the complete solution and start the PowerToys (tray) exe.
Weird. "Paste as Plain Text" won't pop up in the settings UI when I deploy PowerToys.Settings.
If I try to build the complete solution, the "Hosts" project fails:
Build log for failure in Hosts project
Build started...
1>------ Build started: Project: Hosts (modules\Hosts\Hosts), Configuration: Debug x64 ------
1>C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(219,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error :
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : Unhandled Exception: System.NotImplementedException: The method or operation is not implemented.
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommonCompiler.LoggingMetadataFileReferenceResolver.GetHashCode()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Roslyn.Utilities.Hash.Combine[T](T newKeyPart, Int32 currentKey)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CompilationOptions.GetHashCodeHelper()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions.ComputeHashCode()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CompilationOptions.GetHashCode()
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at System.Collections.Generic.HashSet`1.InternalGetHashCode(T item)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.InputNode`1.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.TransformNode`2.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.BatchNode`1.UpdateStateTable(Builder builder, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CombineNode`2.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.SourceOutputNode`1.UpdateStateTable(Builder graphState, NodeStateTable`1 previousTable, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.DriverStateTable.Builder.GetLatestStateTableForNode[T](IIncrementalGeneratorNode`1 source)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.SourceOutputNode`1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.GeneratorDriver.UpdateOutputs(ImmutableArray`1 outputNodes, IncrementalGeneratorOutputKind outputKind, Builder generatorRunStateBuilder, CancellationToken cancellationToken, Builder driverStateBuilder)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsCore(Compilation compilation, DiagnosticBag diagnosticsBag, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.GeneratorDriver.RunGeneratorsAndUpdateCompilation(Compilation compilation, Compilation& outputCompilation, ImmutableArray`1& diagnostics, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommonCompiler.RunGenerators(Compilation input, ParseOptions parseOptions, ImmutableArray`1 generators, AnalyzerConfigOptionsProvider analyzerConfigOptionsProvider, ImmutableArray`1 additionalTexts, DiagnosticBag generatorDiagnostics)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommonCompiler.CompileAndEmit(TouchedFileLogger touchedFilesLogger, Compilation& compilation, ImmutableArray`1 analyzers, ImmutableArray`1 generators, ImmutableArray`1 additionalTextFiles, AnalyzerConfigSet analyzerConfigSet, ImmutableArray`1 sourceFileAnalyzerConfigOptions, ImmutableArray`1 embeddedTexts, DiagnosticBag diagnostics, CancellationToken cancellationToken, CancellationTokenSource& analyzerCts, AnalyzerDriver& analyzerDriver, Nullable`1& generatorTimingInfo)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.<>c__DisplayClass1_0.<Run>b__0(TextWriter tw)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil.RunWithUtf8Output[T](Func`2 func)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunLocalCompilation(String[] arguments, BuildPaths buildPaths, TextWriter textWriter)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter, String pipeName)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CommandLine.BuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc, CompileOnServerFunc compileOnServerFunc)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.MainCore(String[] args)
1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(237,8): error : at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)
1>Done building project "Hosts.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 7 up-to-date, 0 skipped ==========
But I get the same issue when building the solution off of main, so I'm guessing I'm doing something wrong here. The unit tests for Hosts is also failing, but that's less surprising.
Any ideas how to fix this?
@carlos-zamora thats awkward 😓 Main branch on CI build.. May be related to preview VS? Are you up to date?
Are Hosts tests failing or not building? I am confused since Hosts doesn't build. In case of failed tests, can you please share the result?
\7.0.100-preview.7.22377.5
@carlos-zamora Update that .NET 7 SDK to 7.0.102 ;). You're still running the .NET 7 Preview 7 SDK.
\7.0.100-preview.7.22377.5
@carlos-zamora Update that .NET 7 SDK to 7.0.102 ;). You're still running the .NET 7 Preview 7 SDK.
Yup, that fixed the build for me. Thanks!
Still not seeing Paste As Plain Text pop up in the settings UI or the OOBE though. I was hoping this would fix it. Any ideas?
Hi @carlos-zamora , Thanks for the contribution! I've added a commit to add the navigation items to the Settings and OOBE Navigation menu so you can see it in Settings :) Hope this helps.
Added another commit to add Paste as Plain text to the new quick access flyout as well :)
Regarding the feature itself, doesn't seem to be working for me when I start PowerToys. Is it supposed to work out of the box?
Regarding the feature itself, doesn't seem to be working for me when I start PowerToys. Is it supposed to work out of the box?
Thank you!! Yeah this is weird. It works when I'm debugging the feature itself, but it looks like when I have the settings app open, it won't actually enable/disable it. Probably something I messed up in the settings app. Investigating.
Still didn't manage to fix that PastePlain isn't running via the runner/settings app. I did find a few places I missed though, but no luck.
When I run the runner, I get this:

settings_window.cpp::ESettingsWindowNames_from_string() is given an empty string and we hit that assert. I figured I should add PastePlain as a case in the function, but it's weird that it's just getting an empty string. Clint suggested setting a breakpoint in dllmain.cpp::launch_process() but we don't even get that far. Any suggestions on how to debug this further? Maybe some common traps people hit when adding a new module?
Another thing on my radar now is that I need to update the Product.wxs, but Clint said that there have been changes to how to handle that since the PowerOCR PR merged back in August. Any PRs you can send me way to know how to update it properly?
Still didn't manage to fix that PastePlain isn't running via the runner/settings app. I did find a few places I missed though, but no luck.
When I run the runner, I get this:
settings_window.cpp::ESettingsWindowNames_from_string()is given an empty string and we hit that assert. I figured I should addPastePlainas a case in the function, but it's weird that it's just getting an empty string. Clint suggested setting a breakpoint indllmain.cpp::launch_process()but we don't even get that far. Any suggestions on how to debug this further? Maybe some common traps people hit when adding a new module?
The assertion thing is a known bug that happens only when PT was build in debug mode: #15139 => https://github.com/microsoft/PowerToys/issues/15139#issuecomment-1001549020
Another thing on my radar now is that I need to update the Product.wxs, but Clint said that there have been changes to how to handle that since the PowerOCR PR merged back in August. Any PRs you can send me way to know how to update it properly?
@jaimecbernardo can you help here?
Love this idea and hope it gets added.
@d0x360 it is in PR :)
Another thing on my radar now is that I need to update the Product.wxs, but Clint said that there have been changes to how to handle that since the PowerOCR PR merged back in August. Any PRs you can send me way to know how to update it properly?
@jaimecbernardo can you help here?
@carlos-zamora https://github.com/microsoft/PowerToys/pull/23378/files#diff-287ae1fdcc07b9c7d5ea77d02f08554388313688bf628d0d1532e8cb02988a49 .
Look at PowerToysInstaller.wixproj and TextExtractor.wxs.
Clint helped me out today. Looks like the module is loaded now and the hotkey is being detected (it's being logged into the debugger, and saying "PastePlain hotkey is invoked from Centralized keyboard hook"). Now just need to figure out why the centralized keyboard hook isn't the same thing as the one in my KeyboardMonitor haha. I'll work on that more tomorrow (and also do the wixproj/wxs changes). 😊
@carlos-zamora - I made a commit to add the variable needed for the PastePlainProjectName for the installer.
Hi, I'm taking another look now. I'll look at the "plumbing" to make the hotkey event reach Paste as Plain Text.
@jaimecbernardo moved over the main logic into the centralized keyboard hook. We're detecting the key event, so that's good. I'm just hitting the following issue when calling GetTextAsync():
[2023-02-08 17:04:46.787590] [p-34120] [t-11452] [trace] PastePlain hotkey is invoked from Centralized keyboard hook
[2023-02-08 17:04:46.787783] [p-34120] [t-11452] [trace] PastePlain hotkey pressed
onecore\com\combase\objact\dllcache.cxx(3983)\combase.dll!00007FF8371DA74A: (caller: 00007FF8370D21F0) ReturnHr(1) tid(2cbc) 8000001D Activating a single-threaded class from MTA is not supported
Over in Windows Terminal, our solution was to make the app single_threaded (https://github.com/microsoft/terminal/blob/143127d6c4810488df851ae99abe5789fec11e10/src/cascadia/WindowsTerminal/main.cpp#L119-L128). Do I have to do something similar here? If so, where? Or is there another workaround (might be using the async stuff wrong?)?
Hi @carlos-zamora , We are calling init_apartment here in case you want to give it a try: https://github.com/microsoft/PowerToys/blob/45ba48498d670b2b7a6e8ca513aea7b5d4815913/src/runner/main.cpp#L358-L364
I wonder if we can make it single-threaded without interfering with other functionality though. Where can I look at the current code to give it a try?
An alternative would be using win32 functions for this as well, which we might be able to call with CF_UNICODETEXT:
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getclipboarddata
Could we extend the module to paste with quote escape or something like that for programmer?
Could we extend the module to paste with quote escape or something like that for programmer?
I did make the key binding rebindable, so you should be able to bind paste as plain text to that. Or are you requesting to be able to generally rebind paste?