Support for macOS's NSFindPboard, which is a global shared find buffer. Which allows one to put text into the find buffer from other native apps like Chrome, TextEdit, Safari, Sublime, etc. and then switch to other Cocoa apps and use cmd-g to find next matching text.
I suggest binding this new action to cmd-e for ux sensibility on macOS.
from https://github.com/Microsoft/vscode/issues/3431#issuecomment-239508682
Based on actions.find in VSCode, each open buffer seems to have it's own (non-shared) find pasteboard. So actions.find works fine in a single buffer, but I can't cmd-e some text in one file, then cmd-g it in my next file...
We need to add a new action/function such as editor.action.addSelectionToNextFindMatchInGlobalBuffer which may work in other systems as well, but initially for macOS.
Electron will likely need modifications to expose an API capturing the NSFindPboard.
ref: https://github.com/atom/atom/issues/4650#issuecomment-130619175
Alternatively, we can execute a shell script to gain access to the global find pasteboard in macOS with pbpaste -pboard find.
/cc @bpasero
@wprater shouldn't this be filed against Electron?
There is work to be done on both parts, and honestly, I think it could be accomplished all within VS Code. You need to extend your action API to execute shell script to gain access to NSFindPboard, which can be done with pbpaste -pboard find.
The process being when action.find view is pulled up, we check first if there is a presence of pbpaste -pboard find and if so, populate the dialogue with such.
@bpasero who would own this in terms of feature area?
I'm interested in this, as it's catching me quite often, I've roughed out what would be needed to do in terms of objective-c (xcodeproject below) - then I was thinking of exposing an electron event to correspond to discovering changes in the find pasteboard
I've spec'd out a bit of what I the electron API for this could look like: https://github.com/orta/electron/blob/orta-pasteboard/docs/api/pasteboard.md
I'm evaluating switching to VS Code for my day to day work at the moment, and I quite like the experience so far. The issue of not ignoring the mac OS system-wide paste buffer, is becoming a deal breaker for me, though. Hitting Cmd-E - Cmd-G is so deep in my muscle memory that it strikes me several times an hour that this does not work. It's almost like Copy-Paste not working. Common use cases are selecting an error message in my application, hitting Cmd-E, and searching for it in the code using Cmd-G (or Cmd-Shift-F - return to search the whole project).
yeah, its tough. I may tackle this myself, but Im not super familiar with
the electron core lib yet.
On Fri, Oct 21, 2016 at 1:00 AM jonas echterhoff [email protected]
wrote:
I'm evaluating switching to VS Code for my day to day work at the moment,
and I quite like the experience so far. The issue of not ignoring the mac
OS system-wide paste buffer, is becoming a deal breaker for me, though.
Hitting Cmd-E - Cmd-G is so deep in my muscle memory that it strikes me
several times an hour that this does not work. It's almost like Copy-Paste
not working. Common use cases are selecting an error message in my
application, hitting Cmd-E, and searching for it in the code using Cmd-G
(or Cmd-Shift-F - return to search the whole project).—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/11233#issuecomment-255318809,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAo1My6Z6uONkUJOchNQaDfG5g-RUWLks5q2HEQgaJpZM4JwwB_
.
@wprater I don't have the time to dig into the code right now, but I'll help test if you take this on.
yay, it's landed in Electron! not sure when the target is for using the 1.4.x branch in VC Code?
Looks like the API is now there in Electron:
clipboard.readFindText()clipboard.writeFindText(text)This API is available in the electron version we are currently using in VS Code.
This is a good area for a PR. But we need to decide if we introduce separate new commands that respect the find pasteboard, or actually bake it into the existing find behaviour. I would opt for baking it into the current behaviour.
For the record, Atom has the same issue, might be useful to keep an eye on it: https://github.com/atom/atom/issues/4650
I'm still hoping for this to be fixed (and holding out on actually switching to VS Code for my day-to-day coding needs mostly because of this). FWIW, wrt the question raised by @bpasero above, I very much agree that this should be baked into the existing behavior.
Also, somewhat related, entering a search string (using Cmd-E) from the built-in Terminal in VS Code won't work either. This is a very common workflow for me - select an error message, hit Cmd-E, and the Cmd-G to find it in the source file. Because VS Code does not support the system-wide paste buffer, it won't work when selecting the error message in another application, but it even does not work within VS Code when selecting an error message in the builtin Terminal.
@bpasero can you point to another feature that would hook into an Electron API? I'll try to take a look at this.
@wprater sorry, what do you mean? you can just use Electron API by importing it.
@wprater we have a IClipboardService that is probably the right place to add more API for the find buffer and that one is already using Electron API directly.
The adoption would have to take place in the vs/editor space though. Since the editor can also be used standalone outside of Electron, you need to provide a shim for this method (or no-op implementation).
The place where Cmd+E (Start Find) is implemented would be StartFindAction and Cmd+G (Next Find Match) is NextMatchFindAction
@bpasero perfect.. was just looking at some tips on code organization in this area.
@bpasero I wanted to know what you meant by "the adoption should take place in vs/editor.." and "you need to provide a shim for this method (or no-op implementation)." in your previous comment
Is it to help editors to implement the same underlying interface?
Let me know if I am missing anything.
I added API to IClipboardService.
Used dependency injection to inject the service in CommonFindController and wrote helper functions to use the apis. Should this be on the Controller or the editor object?
Then I used these helper functions in StartFindAction and NextMatchFindAction
Everything seems to work well.
I would also like to submit a PR for this.
@melvin0008 do you have a fork now?
@wprater I have not committed yet because I still have to write test cases but the code is working for the above usecases.
@melvin0008 yeah I think best to discuss this through a PR 👍
Most helpful comment
Looks like the API is now there in Electron:
clipboard.readFindText()clipboard.writeFindText(text)This API is available in the electron version we are currently using in VS Code.
This is a good area for a PR. But we need to decide if we introduce separate new commands that respect the find pasteboard, or actually bake it into the existing find behaviour. I would opt for baking it into the current behaviour.