Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Add LanguageManager.getLanguageForFile(Name|Extension)Only #3302

Closed
DennisKehrig opened this issue Mar 31, 2013 · 2 comments
Closed

Add LanguageManager.getLanguageForFile(Name|Extension)Only #3302

DennisKehrig opened this issue Mar 31, 2013 · 2 comments

Comments

@DennisKehrig
Copy link
Contributor

In some cases we want to use these specific mappings directly. For file extensions, LanguageManager.getLanguageForPath("file." + extension) can be used. This is still ambivalent, though - even if file extension "foo" generally maps to FooLang, "file.foo" could map to BarLang. Furthermore, if extension is complex (i.e. "foo.bar"), the returned language might belong to either of the file extensions "foo.bar" and "bar".

Instead, two additional methods should provide more direct access to these mappings, and getLanguageForPath should be refactored to use these.

  • getLanguageForFileNameOnly only checks _fileExtensionToLanguageMap
  • getLanguageForFileExtensionOnly only checks _fileNameToLanguageMap once

This could be used by #3301.

@ghost ghost assigned DennisKehrig Apr 1, 2013
@njx
Copy link
Contributor

njx commented Apr 1, 2013

Reviewed. Marking code cleanup, low priority, to @DennisKehrig

@njx
Copy link
Contributor

njx commented Apr 1, 2014

Closing - it's not clear what use cases would require this and we haven't heard the need for it from extension authors. If someone requests it we can add it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants