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

Missing mode file extensions in CodeMirror.modeInfo #2940

Closed
silverwind opened this issue Nov 22, 2014 · 4 comments
Closed

Missing mode file extensions in CodeMirror.modeInfo #2940

silverwind opened this issue Nov 22, 2014 · 4 comments

Comments

@silverwind
Copy link
Contributor

It looks like there are a few modes which aren't defining any file extensions. As I've come to rely on extensions for displaying the correct mode for a given filename, it'd be great if at least those modes that have a unique file extension also have them defined in mode/meta.js.

I'll be researching some modes myself to see if I can find the extensions for it, but any help is appreciated!

Here's the current list of modes that don't define a file extension:

Mode          Mime Type
-----------------------------------------
asterisk      text/x-asterisk
cypher        application/x-cypher-query
django        text/x-django
dockerfile    text/x-dockerfile
gfm           text/x-gfm
http          message/http
javascript    application/ld+json
jinja2        null
mirc          text/mirc
nginx         text/x-nginx-conf
pegjs         null
pig           text/x-pig
rpm           text/x-rpm-changes
sieve         application/sieve
slim          text/x-slim
smartymixed   text/x-smarty
solr          text/x-solr
sql           text/x-mariadb
sql           text/x-mssql
sql           text/x-mysql
sql           text/x-plsql
stex          text/x-stex
textile       text/x-textile
tiddlywiki    text/x-tiddlywiki
tiki          text/tiki
toml          text/x-toml
tornado       text/x-tornado
vbscript      text/vbscript
@marijnh
Copy link
Member

marijnh commented Nov 24, 2014

If you have specific extensions that are missing, file a pull request. Some languages simply don't have extensions associated with them, other are so obscure that none of the people who helped add extensions had a clue what to associate with them.

@marijnh marijnh closed this as completed Nov 24, 2014
@silverwind
Copy link
Contributor Author

Okay. One last quesion: The nginx mode for example should only work on a file called nginx.conf. Do you think it would be reasonable to add a filename field instead of ext in this case? Maybe in regex format?

@marijnh
Copy link
Member

marijnh commented Nov 24, 2014

That's a good point. Supporting matching of full filenames would require us to add another method, something like findModeByFileName, which first scans full-filenames (specified by regexp, I guess), and then calls through to findModeByExtension when it doesn't find anything. Want to submit a pull request?

@silverwind
Copy link
Contributor Author

Yeah, I'll do, it's an interesting topic.

dshoreman pushed a commit to dshoreman/servidor that referenced this issue Oct 12, 2020
Replaces `CodeMirror.findModeByExtension` with `findModeByFileName` to
detect nginx config files properly. If `CodeMirror.findModeByFileName`
doesn't match anything it automatically tries to find a match via
`findModeByExtension`. If that fails to return info as well, we try to
determine a mode by calling `CodeMirror.findModeByMIME`.

This is the discussion + pr in the CodeMirror repo:
* codemirror/codemirror5#2940
* codemirror/codemirror5#3027

Fixes #187
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