This repository was archived by the owner on Apr 1, 2025. It is now read-only.
Conversation
tclem
commented
Aug 16, 2019
| @@ -180,8 +180,22 @@ filePathReader = eitherReader parseFilePath | |||
| parseFilePath arg = case splitWhen (== ':') arg of | |||
Member
Author
There was a problem hiding this comment.
I don't love that we allow this on the cli, but didn't want to make breaking changes in this PR. I think in a future iteration we should remove this ability to specify a file language now that our file detection is a bit better.
| "typescript" -> Just TypeScript | ||
| "php" -> Just PHP | ||
| _ -> Nothing | ||
| pure $ textToLanguage l |
Member
Author
There was a problem hiding this comment.
I made our json parsing a little stricter here, languages are case sensitive and must be exactly how they are specified in linguist. Would like some feedback here on if that's OK.
| "TSX" -> Data.TSX | ||
| "PHP" -> Data.PHP | ||
| _ -> Data.Unknown | ||
| bridging = iso Data.textToLanguage Data.languageToText |
Member
Author
There was a problem hiding this comment.
I needed these helpers and couldn't figure out how to use the APIBridge directly due to circular references with Data.Language.
Contributor
patrickt
reviewed
Aug 19, 2019
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now semantic uses some very basic file extension matching for language detection. This moves us toward a slightly more sophisticated approach based on linguist's canonical list of languages.
I don't think we're ready to pull in a full dependency on linguist (it's a ruby gem), but this is a nice intermediate step. Lingo does some compile time map generation of extensions and common filenames to language, allowing fast lookups. We don't support anything where languages share a file extension (first one wins), but that's not an issue for the languages we currently target.