Open alvenchen opened 7 years ago
Sorry @alvenchen, I don't quite understand what you're asking for
@roblourens Thanks for reply.I wonder is there any convenient way to use global search when searching "current file" or "all open file".
Expanding this to cover searching open files or searching git modified files, or some other class of files.
Edit - Does github not show title edits in the history anymore?
I would also request that you define separate command for starting a search in each search scope, so i can map separate keyboard shortcuts for searching in the different scopes (current file, current folder, open files, all files, etc.). If we have that, it would suffice to cover the use case i requested in #40523, which you've closed.
Any word on this? I don't see much progress for this feature request.
To clarify, we're looking for something like this:
Kind of dropdown menu that allows you to select the search scope in the search panel. Possible search scopes can be:
In addition, expose a command for each search scope to allow initiating a search in that scope quickly through keyboard shortcut.
@yuval-gilboa That would be great. In addition to the fields you have listed, I would imagine custom search scopes (where user defines exclude/include files) also being available. "tests", for example, would be a good custom scope. I have a separate issue opened for custom search scopes #42350.
Friendly bump, I'd love to have this. Thank you!
This is necessary as I use it all the time in VS.NET
@roblourens Do you think limiting the scope of the "files to include" field, to the current files/files would be enough to accomplish this? I already have a version of VSCode where i have modified it to do this. I can submit a PR soon if you think that's enough.
I don't understand, so if you type in "files to include", it would only search using that pattern in open fils?
@malfusion I like the idea, but wouldn't that discard all the unsaved changes in the editor? (also slower because of i/o)
@roblourens so the "files to include" is a glob pattern that is searched. So the trick here would be to find the files that are required, generate the glob pattern and then update the "files to include" field with it. And the search would only search the matching files.
@atif089 if the question meant "would the search disregard the current file's unsaved changes", then I'm not sure yet. I'll have to check. But to my knowledge, the search is performed directly on the file system, so only saved changes might be searched.
was amazed (in bad sense of this word) to discover VSCode cannot do it... it's 2018 after all, seems to be a common sense feature present in any other code editor or IDE.. bumping the issue to attract attention to it.
+1
+1
@roblourens
Any update on this? This feature request has been open for a year and a half. I don't see any update regarding this feature for a long time, nor do I have any visibility on your future plans regarding this.
I used "search in open files" a lot in Notepad++. It is especially useful for searching multiple csv files (or other data files).
Love this feature!
+1 must have feature.
How about changing the scope of "files to include" with key words like @open
, @closed
, @modified
, @unsaved
?
It wouldn't require any UI changes and is easily extendable, so if in the future you decide to make files searchable by modify date, that could be @modified(2d)
or @modified(48h)
for files that have been modified within the last two days.
I can see this being a very useful advanced feature without needlessly cluttering the UI.
From #18796 : "Request ability to search only in the files that are loaded in the editor. In addition it would be good to have a search results window for find (in current file Ctrl+F) so that you can see a list of matches with some context and the ability to copy the search results and click on them to go to the match. This should also work with replace. May be there should be another window like Output, Problems, etc. Ideally this would be able store multiple sets of search results in multiple windows. See SlickEdit for example." I think the ideas have cover most of #18796, but possibly not suggestion of multiple search result windows. It very useful to have multiple search results, particularly when working with log files.
I think https://github.com/Microsoft/vscode/issues/16488 might cover the rest of that, keeping track of multiple independent searches
I really love the suggestion from @Instagit!!!
I find it superior to just a UI dropdown, because I can type something like @modified, @open, src/**/*.xml
into either the files to include or the files to exclude and anything else that takes file filters could accept the same patterns.
I also love how the idea includes the ability of extensions that extend the filter functionality. (Dreaming :sleeping::heart_eyes::joy::stuck_out_tongue_winking_eye: of GitLens support for @git(52b15e9)
allowing me to search within a specific commit.)
Not to mention, if you can accept pre-defined filters, than it's not hard for me to imagine user-defined filters, e.g.:
"search.filter": [
{ "config": ["**/*.config", "src/**/*.cscfg"] },
{ "deploy": ["**/deploy", "@config" },
{ "test": ["**/test", "!**/test/log", "!**/test/out"] },
{ "modified": ["@staged", "@unstaged", "@untracked"] },
{ "unmodified": ["!@modified"] },
{ "src": ["!@deploy", "!@test", "@modified"] },
{ "prod": ["@src", "@deploy", "!@modified"] }
]
Some things to note about the above suggested syntax:
@src
filter includes @modified
files that might be excluded by !@deploy
or !@test
@prod
filter includes @deploy
back in, but removes @modifed
Given the above syntax, the builtin filters only need to support some basic operations like @open
and @unsaved
. Then @closed
simply becomes !@open
.
I'm not sure if @folder
, @workspace
and @project
make sense. In the find panel, anything like @folder
, or even a UI dropdown will lack context. However, a keybinding for something like find(@folder)
probably does make sense.
I feel like minimum Git support is important. Filters for @staged
, @unstaged
, @untracked
and default definitions for "modified": ["@staged", "@unstaged", "@untracked"]
and "unmodified": ["!@modified"]
would be really nice. I don't know if these are things that must happen in this feature, or just things that must be enabled and support gets left to an extension.
The custom filters are a really interesting idea.
We recently added intellisense to the extension viewlet and settings search input, could do the same here.
+1 search open OR git modified files would be used constantly
I specifically would like to see at least a current file and all open files option. It doesn't seem like this would be hard to implement. What files would I be looking at in vscode if I wanted to implement this and submit a pull request?
+1 for this feature. Especially would like to have "all open files" and "modified files"
Any plans to implement this in 2019?
+1 all open files search option would be great!
Any plans to includes this feature?
I will be taking a stab at this based on the ideas of @Instagit and @mromanch
Sure. Just please discuss your approach with me before spending a lot of time on it.
Basic approach
The approach I have looked at is to extend the QueryBuilder
to make use of a new 'token expansion' class. The current builder splits the query into glob patterns and makes IExpressions out of them. The idea would be do the expansion between the split and conversion to IExpression. For example, the include pattern *.ts, @open, *.css
would leave the *.ts
and *.css
intact while expanding @open
into the file paths of the currently open files (though issue https://github.com/Microsoft/vscode/issues/48958 is blocking for this to work).
Tokens that simply expand into normal globs can also be supported via config.
Extension The actual token expansion will not have any hard-coded tokens, but these would rather be supplied by config and extensions. The ones I have looked at are the editor and git, to support for example open and unsaved files (editor) and changed, staged, etc (git). The extensions esentially use the command framework and the token expander use the ICommandService to call the extension and get the expanded token back.
Syntax
The default @ syntax for vscode seems to be @token:parmater
, e.g. @editor:unsaved
. This can then be shortened or aliased for the most common use-cases, see Configuration.
One question would be how to handle use-cases where multiple parameters are needed and what the delimiter should be. E.g. searching for files changed within the last day. Like @file:modified;24h
or @file(modified, 24h)
.
Configuration Pretty much follows @mromanch idea. Can either define hard-coded globs, combinations of previously defined configuration or reference tokens defined by extensions. Example:
{
'@config': ['**/*.config', 'src/**/*.cscfg'],
'@deploy': ['**/deploy', '@config'],
'@modified': ['@git:changes, @git:staged, @git:untracked']
}
UI Right now, there is only 'files to include', but other programs like Visual Studio also has a 'scope' (e.g. Entire Solution, Open Files, etc). Does it make sense to differentiate between them or will it only be confusing?
Auto-completion? Have not looked into this.
This sounds great, however it sounds like https://github.com/Microsoft/vscode/issues/48958 will be blocking most of this. Unfortunately that's harder to fix than it sounds because it will involve changing extension API and I will need to drive that.
Yes, I do not see any good way of solving this issue without having https://github.com/Microsoft/vscode/issues/48958 in place. I will keep an eye on if/when it is fixed.
bump . i really need this, this could be the only reason if I ever go back to Dreamweaver. "Search in open files" is very handy š
that is really a blocker, i came from sublime to vscode, before that notepad ++, vs.net etc all have them, but vscode does not. I have already going back to sublime or searching another alternatives. Soon i find that will dump VS code
Support request for "search in open tabs". Please!
+1 for search (and replace) in open files, it is extremely needed.
bump! +1
Guys, please stop "bumping". It triggers notifications for everyone involved in the thread and doesn't add any value. Just hit š in the top comment instead.
One problem with hitting the thumbs up in the top comment is that that top comment (the issue title itself) doesn't convey what nearly all the rest of the comments are getting at: a desire to have a feature to "find in open files/tabs". The OP worded the issue title and even their initial post in a way that does not convey this broader problem. I wish we could more clearly be voting for this broader problem/feature request.
Is anyone (who is a party to this thread) aware of any other issue or PR where attention to this broader issue (a desire to find against open files/tabs) maybe has moved? so that we can drive our support there, more clearly?
@carehart I consider this to cover that request, and I added a note to the OP to clarify that.
Great. Thanks.
/charlie
Yea I am looking forward to this. Every time this thread gets replied I get excited, only to find out it was yet another bump
stderr-to-devnull notifications@github.com, 25 Eyl 2019 Ćar, 14:34 tarihinde Åunu yazdı:
So this has been open for 2 1/2 years, is it so monumentally difficult to implement? Other more basic editor already have this (Notepad++ for example). I need to be able to search in all open file tabs. How many thumb ups are necessary? Maybe I can talk with my family and friends to create accounts and support this request.
ā You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/20530?email_source=notifications&email_token=AAD36PFLHJXMWKYQMTIKZN3QLNEC3A5CNFSM4C73QHN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7RSDEQ#issuecomment-534978962, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD36PFHHBZXEBOGNZ7XJL3QLNEC3ANCNFSM4C73QHNQ .
Hi, i found out that i can "search only in open files" by using a backslash instead of a forward slash. Is it a feature? Is it a bug? (if it's a bug i'll open an issue, obv) Demonstration screenshot attached (i was looking for php files inside the "backend/app" folder)
VSCode-win32-x64-1.38.1, extensions disabled, exclude settings/ignore files disabled
Hi @aetonsi, I just tested this technique on VS Code on macOS and it does NOT work š
Here is my config...
VersionĀ : 1.38.1 ValidationĀ : b37e54c98e1a74ba89e03073e5a3761284e3ffb0 DateĀ : 2019-09-11T13:31:32.854Z ĆlectronĀ : 4.2.10 ChromeĀ : 69.0.3497.128 Node.jsĀ : 10.11.0 V8Ā : 6.9.427.31-electron.0 OSĀ : Darwin x64 16.7.0
Cheers
I've found a simple solution but it might not work for all scenarios.
scenario: search for a keyword in modified files between two branches (like master and current branch) - I'm using gitlens (kinda solves #82756) steps:
this idea could somehow extend on multiple levels but as you can see it's not the best and I'm definitely waiting for an official solution from the vscode team
Sublime has a nice model for this that could work for VSCode too.
The text input for which files to search in is paired with a "..." control to get access to these special options. When one is selected, they insert a special entry into the text field. This lets these be used along side other search patterns and makes it easy to always see the full set of active search patterns in one place.
Dropdown at right
Choose "Add Open Files"
<open files> is added to the text field
You can have multiple of these together, and it's easy to delete them at any time
Steps to Reproduce:
1.when i use global search, it's not easy to type whole file path and name in input box, hope that there is a convenient way to use highlight in search current file by typing ""
Note from @roblourens This includes searching in any particular subset of files such as
etc