Syntax highlighting complex filename extensions

Syntax highlighting, code folding, brace matching, code indenting, and function list

Syntax highlighting complex filename extensions

Postby wanderer » Fri Aug 06, 2004 1:30 am

Is it possible to uniquely identify a file extensions like filename.c.txt from other files whose extension might be filename.txt for the purpose of using different syntax highlighting ?
User avatar
wanderer
Newbie
 
Posts: 2
Joined: Thu Aug 05, 2004 11:00 pm

Re: Syntax highlighting complex filename extensions

Postby Mofi » Fri Aug 06, 2004 8:33 am

No, definitively not.

The file extension is defined by Microsoft as the characters AFTER the last dot. All characters BEFORE the last dot are part of the file name. The dot itself does not belong to the file extension nor the file name. It is the delimiter. File name + dot + file extension build the name of a file. That feature you want could only be used, if UE would accept wildcards for syntax highlighting, for example *.c.txt, instead of only using the file extension.

But you can switch the syntax highlighting used for the current file manually by selecting the one you want from the menu View - View As (Highlighting File Type).

But this is not stored and must be set manually for each file and every time UE is started again.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4066
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Syntax highlighting complex filename extensions

Postby DanKirkd » Fri Aug 06, 2004 10:22 pm

As a to followup on Mofi's answer, you could create various Key Mappings for different Language syntaxes to more quickly convert to them. For instance, I have a number of .TXT files that predominently contain SQL examples, and I've mapped Alt-Q to switch to View As... SQL (Language 13 for me), so after I've opened the file I can quickly display it to show SQL syntax highlighting.

Just a thought.

Dan
User avatar
DanKirkd
Basic User
Basic User
 
Posts: 39
Joined: Wed Jul 14, 2004 11:00 pm

Re: Syntax highlighting complex filename extensions

Postby wanderer » Mon Aug 09, 2004 2:38 am

Many thanks for the clarification and ideas. I will manually choose highlighting theme thru the | view as... | menu.

Regards ...
User avatar
wanderer
Newbie
 
Posts: 2
Joined: Thu Aug 05, 2004 11:00 pm

Associate a more complex extension ?

Postby svinot » Fri Jun 09, 2006 4:01 pm

Hello,

I'm using files that are using ".css.dtml" as extensions (it is css files) and I'd like to associate it with the CSS syntax highlighting. Of course I cannot use only ".dtml" because other files are using it.

I tried to simply add "CSS.DTML" on my wordfile but it does not work.

Is it possible to do this ?

Sebastien.
User avatar
svinot
Newbie
 
Posts: 6
Joined: Tue Nov 08, 2005 12:00 am

Re: Associate a more complex extension ?

Postby Mofi » Sat Jun 10, 2006 12:15 pm

Sorry, but this is not possible. The file extension is according to the specification from Microsoft only the part after last point. For example a file named "file.css.dtml" has the filename "file.css" and the extension "dtml". I personally avoid more than 1 point in the name of the file. I always use an underscore as word "delimiter" in a filename.

From help of UE about syntax highlighting:

File Extensions/Types

Syntax Highlighting is determined either by the name of the file or its extension. More commonly the extension is used and to specify the extensions for which this language is applicable the following string should be used: "File Extensions = " and each extension is separated by a space.

To specify that a filename is to be used to determine the language the following string should be used: "File Names = " and each name is separated by a space.



So you can also use File Names = if you do not have too much CSS files with the wrong extension. But it is not possible to specify "File Extensions = " and "File Names = " for the same language definition. You have to copy the whole CSS language definition block and insert it before the language definition for files with the extension CSS and DTML. Example:

/L3"CSS.DTML" File Names = ....

/L4"DTML" File Extensions = DTML

/L5"CSS" File Extensions = CSS

And you cannot use wildcards in the "File Names = " specification!
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4066
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Associate a more complex extension ?

Postby svinot » Sat Jun 10, 2006 12:36 pm

Well, because I have quite a lot of different files like this (due to the system we have to keep the "double" extension), I will keep choosing the colorization manually : that's not too difficult :)

Thanks for your answer : I'll look at deeper the documentation next time.

Sebastien
User avatar
svinot
Newbie
 
Posts: 6
Joined: Tue Nov 08, 2005 12:00 am


Return to Syntax Highlighting