public static profileForPath(filePath as String, firstLine as String = "") as LanguageProfile
Resolves a LanguageProfile from a file path, filename, or optional first-line shebang (#!).
| Parameter | Description |
|---|---|
filePath | File path or filename (e.g. "src/Main.kn", "Makefile", "queries.sql"). |
firstLine | Optional first line of the file for #! shebang inspection. |
Resolved LanguageProfile.
import klyn.code
assert LanguageRegistry.profileForPath("lib/klyn/String.kn").id == "klyn"
assert LanguageRegistry.profileForPath("schema.sql").id == "sql"
assert LanguageRegistry.profileForPath("README.md").id == "markdown"