In one of the previous versions of one of my file in a Netbeans project I wrote code that I later removed, and now I want to retrieve it. However now I can't find it when I manually go to previous versions, as I have many versions in the local history of this file, and I don;t remember when exactly I wrote this code.
Is there a way to run a search on the local history of this file?
I saw in this answer that the local history is kept in this path
<HOME>/.netbeans/<NB_VERSION>/var/filehistory where HOME is my user home and NB_VERSION is the version of NetBeans (e.g. 7.0).
I tried running AgentRansack on that directory, but to no avail.
I recently had to solve this problem and figured it out. Netbeans stores local history files in your user directory as mentioned above. Inside that folder are numbered directories. It's pretty easy to guess which one you need based on the modification date of the folder (if you know when you last looked at it, so that doesn't help you much). In side the numbered folders is another folder with a hashed name, and inside of that folder is a set of files: a data file, and numbered files. The data file can be read with a binary file reader, and if viewed in ascii mode will show the filename that this history belongs to. The numbered files are actually zip files and they have full versions of the file in them. Just unzip those and open with a text editor if they are plain text files.
Hope this helps you out, but I realize its probably too late now. I had to figure this out because I had opened a remote file with netbeans (a file that was not associated with a project), and couldn't get back into the Local History because the file didn't have a project. However I could see it in the Local history by reading the data file, and I just guessed that the other files were zipped by the fact that they started with "PK" in the binary viewer. Once I put it all together I was home free.
Related
I know that some settings such as imported folders are store on the workspace file such as my-worskapce.code-workspace and some others such as python interpreter are stored in the root folder(s?) such as .vscode/settings.json but these do not include information about opened editors or which extensions are disabled for each workspace etc. Where can I find those information?
I need that information because I started storing all my *.code-workspace files in ~/ and now it's getting cluttered and I want to move them to a different folder, when I do, and reopen my workspace, I see that all open editors are gone! This hurts my productivity as I will have to reopen them and recall which files were being worked on. And another issue is that previously added folders are gone too! I have to re-add them which is merely a redo of work that already has been done, since imported folders are imported as relative paths. If I move the *.code-workspace file to it's original location with the same name however, everything is back to normal, so this tells me VSCode is storing information about each workspace somewhere and it's bound to each *.code-workspace absolute path. I have checked ~/.config/Code/User but couldn't find anything. I've googled a lot using different keywords but seems it's nowhere documented or asked about. I usually make backups of my workspace files and I'd like to make back up of these information as well.
In windows you can find them in
C:\Users\<username>\AppData\Roaming\Code\User\workspaceStorage
VS Code 1.75 introduced a new Profiles feature, summarised here.
Profiles store information such as user settings, installed extensions and the current layout of panels etc.
You can export/import profiles to/from a Github gist or a local file. Different profiles are associated with each workspace.
Profiles won't resolve all your immediate issues, but may give you more flexibility in the future.
I am aware that I am asking for an implementation detail but I want to hack something for my use case and hence the question.
My use case: I use an on-demand instance where source code is hosted at work. This means I get a new machine (let's say every day) where I open the same source folder (but hosted on that remote machine). Because of this, the context of opened files in editor gets lost between sessions.
I am curious where does VSCode save the information about open files in a workspace. If I know that, I am hoping I can copy that file at the end of day before I give up an on-demand instance AND when I get the next instance (which may have a different remote url but same file paths), I can somehow hack this file to open all the editors from previous session in the new on-demand. Does my question make sense? Let me know if something is not clear.
On Windows the workspace state is stored here:
%APPDATA%\Code\User\workspaceStorage
And on Linux:
~/.config/Code/User/workspaceStorage
Every workspace has a subfolder here with a hashed name. To find out which one belongs to your workspace, open the contained workspace.json, which looks like this:
{
"folder": "file:///c%3A/some/path"
}
Choose the one that matches your workspace folder and copy the complete folder.
However, I am not sure how VS Code calculates the hashes for the folder names, so maybe it won't use the same hash again in your new instance. But this definitely is the place where the information is stored, so it's worth a try.
I have a problem. the documentation assumes that people who checked out the files a long time ago can be contacted, log in and check out their changes.
https://docs.oracle.com/cd/E19455-01/806-1075/msgs-1307/index.html
I am logged in to a SunOS box where I need to discard edits made by people who no longer work here. How do I do it?
Quick answer.
sccs uses files.
In the SCCS directory (subfolder) the are files with almost the same name as the file being checked out.
Iirc:
Most of these are "s.", but there are a few others with relation to what state the files are in.
The s. files are big, the other files are small.
You should see a file in the SCCS folder that starts "p.", I think, and it should contain the username or the person checking the file out. Delete the file and the record of the checked out file will be removed.
You'll also want to delete the filename from the parent directory, so that it can be checked out of the library easily.
There are other ways around it using sccs, but this is the easiest way to fix your issue.
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.
Today I opened netbeans after a month of not using it, and when I opened it all my program tabs with file names were italicized. This makes it a class like println, but the classes I am working on are my own files, and now I can't edit it.
How can I make them read and write files again?
Italized file names mean that the files are read only. Are those files located on your computer or on a remote server? Did you have write access to project files? Do you have them as .java, .class, or .jar? To begin with right click on the tab, use select in projects and see what is selected.