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

Support "filenames" key, mk. 2 #115

Merged
merged 5 commits into from Jun 5, 2017
Merged

Conversation

kazimuth
Copy link
Contributor

@kazimuth kazimuth commented Apr 8, 2017

Reopening #109 with comments addressed. (It took a while to get back to it, I've been swamped with work.)

We now support:

  • Makefiles
  • Rakefiles
  • Dockerfiles
  • CMakeLists.txt
  • SCons

}
}

let extension = fs::get_extension(&entry)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that extension matching should be first. Just so it's a clear set of precedences in determining the language.

(extension) > (filename) > (shebang)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will unfortunately prevent CMake from working. If you think it's the right thing I can implement it, though.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that?

Copy link
Contributor Author

@kazimuth kazimuth Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The canonical CMake filename is CMakeLists.txt, for whatever reason. Maybe to make them easier for Windows users to edit?

If we detect by extension first, that will always be detected as plaintext, despite being a very different language from plaintext.

Similar cases are Cargo.toml and package.json, although those are more straightforwardly TOML and JSON files, so I understand why you don't want to count them separately.

Note that the filename key matches the entire filename, not just the extension-stripped stem. So in this scheme, Makefile.bananas won't be detected as anything, since there's nothing with the Makefile.bananas filename, and nothing with the bananas extension.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose the entire filename over the stem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to support CMakeLists.txt, mainly.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, seems fine with me, if you could rebase it onto the latest I'll be happy to merge it in.

@kazimuth
Copy link
Contributor Author

kazimuth commented Jun 5, 2017

Rebased!

@XAMPPRocky XAMPPRocky merged commit 7849edf into XAMPPRocky:master Jun 5, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants