Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong file name and js source when using a subdir #11

Closed
briannesbitt opened this issue Jan 23, 2012 · 1 comment
Closed

Wrong file name and js source when using a subdir #11

briannesbitt opened this issue Jan 23, 2012 · 1 comment

Comments

@briannesbitt
Copy link

I have a test.coffee in the main directory and a test.coffee in a sub directory. In the browser file list it shows only the subdirectory test.js file.

When you click on either of the test.coffee scripts it shows the test.js from the subdirectory file in both cases.

@showell
Copy link
Owner

showell commented Jan 23, 2012

Duplicate filenames can cause confusion when trying to match up coffee files to js files, although I try to make the most sensible match I can find, with this little piece of code in file_utils.coffee:

score_path_similarity = (path1, path2) ->
  # find out how many common directories there are, to
  # help us determine the likelihood of path2 being an
  # output directory for path1
  score = 0
  for part in path1
    score += 1 if part in path2
  score

I don't see an easy way to guess with 100% accuracy here. If you compile both versions of test.coffee, then I think it should fix your problem.

While I'd gladly take a robust patch here, this is a bit of a low priority fix for me. The workaround is pretty obvious; use more distinct names for the files, even when they are in separate directories. I've worked on a Rails system where there are about 20 different copies of base.rb in the filesystem, and it gets confusing real fast.

I'm closing for now, but feel free to provide more info, and I'll reopen as needed.

@showell showell closed this as completed Jan 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants