Opening search result duplicates file in search results


#1

Repro:

  1. Search full project for some text
  2. Double-click a search result to open that file
  3. Come back to the results

Expected: Results have not changed

Actual: The file you just opened is now duplicated in the results. It appears at the bottom of the list, and for some reason it has the full pathname instead of a path relative to the project.


#2

Thanks for the feedback. I’m having trouble reproducing this bug. Is the repo you are searching with public? Or can you give me an example of a public repo this happens with?


#3

OK, I think I figured out the repro. It happens when you have a symlink on your path. Try this:

  1. mkdir -p foo/bar
  2. ln -s foo/bar
  3. echo "hello" > foo/bar/baz.txt
  4. cd bar
  5. atom
  6. Search project for “hello”, find one result
  7. Double-click on the result, opening baz.txt
  8. Go back to search results

Expected: search results have not changed

Actual:

Hope that helps.


#4

PS, workaround: cd to a path that has no symlinks in it, then open Atom from there. Seems to work fine.


#5

Is there really no better work around for this other than avoid symlinks? I have a symlink involved with everyone of my projects and this makes it hard when I need to open all the files from a search, and then have to make sure I don’t waste my time opening the duplicated search results.


#6

You could probably use the File/directory pattern field to exclude that symlink folder.


#7

I don’t think you understand, my whole project is through a symlinked directory. My projects are kept in path/to/my/Work and I symlink it to be just cd Work.


#8

No, because you weren’t clear.

My projects are kept in path/to/my/Work and I symlink it to be just cd Work.

The two easiest options I see would be to set up an alias so that the atom command resolves the path sent to it before opening the binary, or to set yourself up with a project management package so that you don’t have to mess with paths at all.


#9

While both those options would work, it doesn’t answer the question and improperly places onus on the user and not the software and its developers.

First, it doesn’t answer the question “Why does this happen in the first place?” Clearly, Atom can handle the symlinks, opening the project and files correctly. Why does opening a file from Search Results result in a new file being found with the full, absolute path to the file?

Second, if the software behaves in an unexpected pattern, it still doesn’t place the responsibility of a work around on the end user. That burden is still the responsibility of the software developer. Clearly, the intended use of Search is to not result in duplications due to clicking files from it. Sublime Text does not have this problem and if Atom cares about being competitive with Sublime Text (or any other text editor) then it is up to the software developers to deliver.

I’m honestly surprised that there isn’t more traction on an issue like this. The last company I worked for, our entire dev team used a symlinked folder structure like mine. I know that no one on the team used Atom, but still, there have to be other developers with similar setups.


#10

Your original question was how to work around this behavior without giving up symlinks. So I tried to help you find workarounds, and now you’re complaining about being given workarounds.

First, it doesn’t answer the question “Why does this happen in the first place?”

I would presume that it happens because, when the Find and Replace package was being developed, nobody ran into the bug.

Why does opening a file from Search Results result in a new file being found with the full, absolute path to the file?

I have no idea. I haven’t looked into it.

Sublime Text does not have this problem and if Atom cares about being competitive with Sublime Text (or any other text editor) then it is up to the software developers to deliver.

The great thing about open-source, freely available software is that it doesn’t have to compete with proprietary, closed-source, $70 software. It can, and for many people it does. There are some developers at Facebook who have built their own IDE on top of Atom because they could (there are also Juno and PlatformIO). Sublime Text I’m sure is great for people who want to pay money for professional support and a product that’s as perfect as it can be. Atom being as free and as flexible as it is makes it a valuable product in spite of its flaws.

I’m honestly surprised that there isn’t more traction on an issue like this.

There is an open issue. Another great thing about open-source software is that the community can share information about problems and if people like us are motivated to fix those problems, we can (and I have) help out in the area that is important to us. The dev team is very responsive and is hard at work on the things at the top of their priority list, but as it’s a free product, it can’t have a giant dev team. Atom is an oversized passion project that does not generate revenue and the people who work on it also have to work on things that bring in money. This issue is important to you, but it’s an inconvenience and it only affects a very limited subset of users. If you want to convince people that it is important for them to care about, you trying to guilt the developers because they can’t immediately address every issue is not going to be persuasive.