The "Go to File" dialog is handy (Alt-Shift-o), but my project has a hundred files called index.phtml. Is there any way to include the directory? Say, search for docs/index.phtml?
Or do I just have to fix/wait for https://netbeans.org/bugzilla/show_bug.cgi?id=222697?
I'm using NetBeans PHP 7.3.
No, only file names can be searched for.
When looking at the code of the Jump To module, you can notice that a org.netbeans.modules.parsing.spi.indexing.CustomIndexerFactory gets registered which only keeps record of file names including their extension. So currently there is no way to to search for files with a path specified.
However, I think it shouldn't be too difficult to change the indexer of the Jump To module to not omit the path, I'd worry about the performance though.
Related
I'm using the workspace feature of VSCode, with two projects, but it's annoying to search for a file in the front-end project and need to pass by back-end files to find the one I want.
I'm using ctrl + p to search for files.
How can I search for a file in just one folder with multiple projects opened in the workspace?
Yes thats possible: use a relative path: ./mySearchedProjectName in "files to include"-input
from HERE!
UPDATED answer to UPDATED question
The fuzzy file finder (CTRL+P or ⌘+P) somehow supports prefixing the filename with a folder, such as folder/filename to locate a file from a specific folder:
But, in my experience, the search is a bit lacking. For example, I find it usually can only find files this way if that file has been recently opened in your workspace. It also does not support regex.
The best thing that can be done is to enable including recently opened files by adding this to the workspace settings:
"settings": {
"search.quickOpen.includeHistory": true,
AFAIK, there is no other built-in way to filter the results. There are (still) open feature requests for this, like this Allow quick open to filter on folder names by typing folder name after the file. You can thumbs-up them to hopefully get them noticed.
ORIGINAL answer to ORIGINAL question
I don't know what you mean by "projects" since VS Code only has "workspaces" and "folders", such that you add folders to a workspace. I think you're already doing this, where each folder contains a separate set of codes.
With that said, the Search/Find panel has an area to specify files to include, where you can limit your search to a specific folder. For example:
Here I have 3 folders (proj 1-3) added to a workspace. I have 3 sample files with the same text.
When searching, you can set files to include to a specific folder (./proj2), so that the search results will be limited to that folder.
I've found the best solution to this for me (though it's still a sub-optimal one) is simply to run multiple VS Code instances, one for each folder.
It's a pain to start up, but once you get things going (and hopefully you're not restarting often on your dev machine, so this is less of an issue) it works perfectly: you can search for files with only the relevant ones showing up.
Also, if you want to reduce the start-up pain you can make a shortcut/alias/etc. in your operating system that starts both at once.
Tried searching for this a number of ways and have not yet found an answer ...
Background
I am working on a legacy Perl application that has a lot of hard-coded values in it which should be configurable depending on where the app is installed. So, obviously, I am looking to externalize these values into a configuration file that may be located in one of a few "expected" locations. That is, using a traditional approach of checking for the configuration file in:
the current working directory,
the user's home directory (or a sub-folder therein), and
the system configuration directory (or a sub-folder therein)
where the first one found wins.
Where I am at
Perused the CPAN site a bit and found the Config::Any package, which looks promising. I can give it a list of files to use:
use Config::Any;
my $config = Config::Any->load_files(
{
files => [qw(sample.conf /home/william/.config/sample.conf /etc/sample.conf)],
use_ext => 0,
});
This will check for the existence of each of these files, and, if found, load the contents into an array reference of hash references. Not bad, but I still have to hard-code the locations where I search for my sample.conf file. Here, I assume that I am working on a Linux system, and that the location for the configuration file for all users of the application is /etc/. I could always add /usr/local/etc/ as well, but regardless, this is not system agnostic.
I can locate the user home folder using File::HomeDir for searching there, and it works correctly regardless of the system on which the application is running. So is there a similar package that would provide the /etc/ folder (or its equivalent on other platforms)?
Questions
Is there a way to do this without having to know what particular OS I am on? (Perl package or code snippet)
What is the "Perl best practice" way of accomplishing this? I cannot imagine that no one else has run into this previously.
Unless you don't plan to run your code on non unix-based hosts, according to the conventional directory layout and filesystem hierarchy standard, you may rely on a quite large set of well known places.
Anyway, nothing prevents you to dynamically build the file search specification to take account of platform oddities and their specific ways to get them (eg. File::HomeDir::Win32 vs File::HomeDir).
I'm currently using Eclipse to work on a PHP project. I commonly need to rename files but have others open that have changed that i'm not quite ready to save. I go to rename a file and a refactoring window pops up to save all documents. Is there a way around this?
Simple renaming is available on 'Navigator'(Window->Show View->Navigator) or 'Project Explorer'(Window->Show View->Other->General/Project Explorer).
(it seems that there is no workaround on PHP Explorer)
I'm working with eclipse and want to find a specific line that is being output in an error message. The line is not in any code I've written, but I believe it's comeing from a specific library I've included. Eclipse is able to navigated through classes within the library so it has the source from somewhere, the jars were fetched from Mavin and I assume the jar it fetched was a source jar?
The problem is that, by default, the simple java search does not search inside of jar's for lines, and I didn't see an obvious way to tell it to. IN addition I don't want to search all the jars, or even all the code within the one suspected jar, for a line as it could take awhile. Is there a way I can tell eclipse to do a text search of every file within a specific package only? Failing that how would I tell it to do a text search of all code within a specific jar?
Thanks.
Eclipse's 'File Search' which you'd need to find arbitrary text in files doesn't "look into" JARs. Its 'Java Search' on the other hand doesn't look at source code specifically but allows to search types, methods, fields etc. (i.e. things Eclipse doesn't need source code for). Hence, Eclipse can't help you here.
You weren't asking for alternatives but on Unix there's zipgrep and for Windows I believe Actual Search & Replace does the same.
To facilitate code reuse across projects, I set up this (quick and dirty) method to access recent projects.
In the current project, I add a link (z-themes) to a folder that contains links to recent projects. This enabled me to access those files without having to open the whole project (this worked in Espresso).
In Sublime Text, links are not followed and symlinks mess with the file search (files in the linked folders appear in the Go to file panel, so I might open the wrong file)
The question is: how do easily I access files in predefined folders outside the current project?
Plugins and alternative workflows are welcome.
Perhaps something like FuzzyFileNav? That plugin allows you to set up bookmarks to a particular folder. You can then navigate through folders as you would normally in the file system.
I found Goto Folder: it's very simplistic and doesn't allow for any file management like FuzzyFileNav does (which could be nice) but it allows for simple bookmarks and it behaves well.
Edit: I also found FileBinder
This is what I use now: I created a previous projects "project" just for the older files.
simple to add projects (drag their folder to the sidebar)
use Sublime's file search across all the files
old projects' files are separated from the current project
no plugins to update/figure out
Only thing is that I'll have to keep a separate window open just for this, but it's not a big deal.