Auto-detect Language when creating new file
-
When creating a new file, is there a way to auto detect and set the language of the new file content?
Using the Language drop down in the menu bar at the top, I can apply the language of choice manually
After a few lines, is there a way to auto-detect the language and apply it for me so the proper style and syntax highlighting shows without additional clicking?
If not, can we make that happen?
-
Language is detected/based on file extension.
-
So there is no hope for anything based on text input?? This makes me sad. I don’t always want to save a file or select the proper syntax… ie. I’m lazy :P
-
if you provide the distinct logic which of the languages should be used,
I can provide the python script to set it automatically, but, of course, this means
you need to have python script plugin installed.Cheers
Claudia -
I mean… I know several languages that would give away the language in the very first line… ex: #!/bin/bash
But other languages could have these context clues on other lines… ex: <?php does not need to be the first line of a valid PHP file
-
agreed but what if you open a html page with embedded php?
I guess you don’t want to have php lexer on html page, do you?Cheers
Claudia -
Just regex some different syntax? lol idk
-
Would have to be in a certain order though… because I would want the PHP to set even though there is HTML syntax as well… so checking one before another would be important in this case, on new file input…
-
would not be able to use a comment line to change the syntax?
use it to exchange syntax in the middle of the document?
I am trying to set up the O2 compiler “Oxygen Basic” but the syntax is very varied, assimble, syntax C, Basic, and even in Basic accepts variants like End if, Endif,
would be good to avoid language vices