cjprecord / editra

Editra - Developers Text Editor
Other
3 stars 0 forks source link

Feature request: Configurable syntax highlighting. #825

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Problem: Currently, the lexer for syntax highlighting is determined in the 
following way:

- It can be set explicitly for an open document. This setting is forgotten if 
the document is closed.

- It can be derived from the extension of a file.

- A default lexer can be set for all other files.

This makes it not practical to use Editra in projects, where several 
programming languages are used, and the language is not related to the 
extension (for example, because no extension is used). This is a common 
situation in projects on Linux, OSX and in Cygwin projects for Windows.

Most programmer's editors allow the lexer to be derived from the first line of 
the file. The usual rule is to search for a certain string (for example -*- 
ruby -*- to denote a Ruby program), and if this string is missing, by looking 
at the shee-bang string, if present (for example, #!/bin/ruby). Only if both 
are missing, the file extension is used to determine the syntax.

Using this schema for Editra would not only make the editor useable for such 
projects too, but also would make it easier for users of other editors to "feel 
at home" when switching to Editra.

Original issue reported on code.google.com by ro.naldf...@gmail.com on 20 Sep 2014 at 7:33

GoogleCodeExporter commented 9 years ago
Hi this feature already exists exactly as you described

If the line #!/bin/ruby is at the top of the file when opened or after saving a 
new file it will detect it as a ruby file and apply the ruby highlighting.

Same applies for many other scripting languages. Is there a specific case your 
having an issue with? If possible please include a sample file and mention what 
version of Editra your using.

Original comment by CodyPrec...@gmail.com on 15 Oct 2014 at 1:30