Emerald Editor Discussion
July 24, 2017, 03:47:02 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Use of Syntax Files  (Read 12647 times)
0 Members and 1 Guest are viewing this topic.
KjeBja
Senior Miner
***
Posts: 76


« on: June 27, 2006, 06:21:51 am »

There is one small point which I am not really sure if has been mentioned anywhere in this forum, so here it comes, just in case:

CE gives you the possibility to choose which syntax to use when you are editing a file. I find this a particularly useful feature, as I often edit/view files for which there is no extension.xxx file. This might simply be a backup file, or a new file that has not yet been saved. So I just hope that this feature will be included in EE as well.
Logged
Arantor
Site Administrator
Administrator
Master Jeweller
*****
Posts: 618



« Reply #1 on: June 27, 2006, 07:33:35 pm »

I think this would be an important feature to add, actually.

Moreso if we are making this crossplatform, since it is not uncommon on Unixish platforms to have file.extension~ as a backup of file.extension.
Logged

"Cleverly disguised as a responsible adult!"
KjeBja
Senior Miner
***
Posts: 76


« Reply #2 on: June 28, 2006, 06:07:54 am »

It certainly is important to me, so I am glad our Project Manager agrees with me!  Grin
Logged
Zhrakkan
Official Mascot!
Beta Testers
Gem Cutter
***
Posts: 177



WWW
« Reply #3 on: June 28, 2006, 02:33:03 pm »

Are we talking that EE would know WHICH syntax to use depending on the extention of the file opened?

For instance, if the file is blah.php, then it uses EE with a PHP syntax, as oppossed to blah.pl in which uses EE with the Perl extention.
An I thinking this is correct?
Logged

News Manager and Unofficial Mascot
Join the Emerald Editor Project - Message Me!
Emerald Editor - "A Jewel of an Editor"
-----by the way, that name is pronounced "Za-Rack-In"
Arantor
Site Administrator
Administrator
Master Jeweller
*****
Posts: 618



« Reply #4 on: June 28, 2006, 05:37:14 pm »

Well, it's always implied in the CE model that the file extension defines the syntax to use.

E.g. out of the box, files marked .htm or .html are linked with the HTML syntax. Conversely, .pl -> Perl, .php -> PHP etc.

What I understood of KjeBja's point (maybe I'm misinterpreting it, though), is that if you have extensions which are not default, e.g. you're working on a backup of a PHP file, whose extension is now .php~ instead of plain .php, you should be able to select which syntax you want.

Maybe I'm being oldfashioned but I wouldn't want to set up all the associations for the different backup types, e.g. .pl, .pl~, .pl_, .plb, .pl.bak and so on (that's just the ones I can think of right now that I've seen for Perl), but not forgetting that some editors will simply use .bak or .backup, which you can't really associate with a specific syntax.

I think it would be a bit much of EE to expect it to autodetect based on content (it's doable, but it means you either have to have a huge autodetection module, or you have to get it to parse each available syntax type on loading) so basing it on extension is probably the best way to go for the moment.

Of course, this is where the INI file comes in handy...
Logged

"Cleverly disguised as a responsible adult!"
hoeltgman
Miner
**
Posts: 17


« Reply #5 on: June 28, 2006, 07:02:58 pm »

This would indeed be a very nice feature. I can even give you a very concrete example where this comes in handy.
If you have a phpbb forum, most of the files which are responsible for the layout have the ending .tpl (stands for template) But these files are actually written entirely in html.
If I open these files in CE, I can tell him that it's html. Would be nice if I could do the same in EE too.
Logged
KjeBja
Senior Miner
***
Posts: 76


« Reply #6 on: June 29, 2006, 06:47:51 am »

Quote
What I understood of KjeBja's point (maybe I'm misinterpreting it, though), is that if you have extensions which are not default, e.g. you're working on a backup of a PHP file, whose extension is now .php~ instead of plain .php, you should be able to select which syntax you want.

This is exactly what I mean. In CE, you can choose the syntax to use in the list of syntax types which is found under the Document menu. So even if CE has detected a syntax based on the extension of the file you are editing, you can change this to whichever syntax type you want. Like I said, this also comes in handy when you are editing a file that has not yet been saved.

Quote
Maybe I'm being oldfashioned but I wouldn't want to set up all the associations for the different backup types, e.g. .pl, .pl~, .pl_, .plb, .pl.bak and so on (that's just the ones I can think of right now that I've seen for Perl), but not forgetting that some editors will simply use .bak or .backup, which you can't really associate with a specific syntax.

Sticking to CE, you can add .000, .001, .002 and so on to your list, if you use an incremental number as backup extension. So I don't think you're the least bit oldfashioned when you don't want to set up all the associations, Arantor!
Logged
awmyhr
Senior Miner
***
Posts: 95

Maintainer of Obscure and Unused Ports


WWW
« Reply #7 on: July 05, 2006, 06:23:52 pm »

EE should offer a drop-down menu in the File Open requestor to set the syntax.  Further, if no selection is made (i.e., "Default"), then it should make an 'educated guess' based on file name extension, the first line or two of the file ("#! /usr/bin/ksh" is a dead give away, regardless of the file name/extension), and it's list of known syntaxes.  Further, the user should be able to manually change the syntax being used at any time (this is sometimes useful when embedding languages), as well as 'forcing' EE to auto-detect once again (in the unlikely event the user forgets what the syntax originally was).
Logged

-->>  This Space 4 Rent  <<--
Wahooney
Miner
**
Posts: 25


« Reply #8 on: July 22, 2006, 08:40:59 pm »

Another handy feature would be that in the file menu you have New, which just creates a new blank file, and New..., which will popup a dialog with a user defined list of commonly used extensions and set the new file to that extension (it may even be able to create headers and footers of that particular language/extension:
 ie. <html></html>
<?php ?>
<?xml version="1.0" encoding="UTF-8"?>
etc.

I know it may seem a bit lazy but I believe it may help workflow in some cases.
Logged
awmyhr
Senior Miner
***
Posts: 95

Maintainer of Obscure and Unused Ports


WWW
« Reply #9 on: July 23, 2006, 04:20:17 am »

Hhmmm, perhaps "New with template" option?  With user definable templates? 
Logged

-->>  This Space 4 Rent  <<--
Feldon
Gem Cutter
****
Posts: 106


« Reply #10 on: July 23, 2006, 05:36:57 pm »

That's a pretty good idea, you could simply have a number of default templates already created for a number of common files.  And then users could get smart and start editing them to suit their own needs.  Plus, users start to see the advantages of templates if they don't already.
Logged
Harry Wood
Prospector
*
Posts: 6


WWW
« Reply #11 on: November 16, 2006, 02:14:42 pm »

In addition to your ".php~" example maybe it's useful to think about XML files. These days a lot of software uses XML formatted files, but often they do not use .xml  as the extension.

Do we want emeraldeditor to detect that this is an XML format file, and switch to XML syntax highlighting automatically? Should be doable. But definately we want to be able to pick XML syntax highlighting. I imagine it should be a quick pick, for one-off viewing/editing, not necessarily configuring that extension to always be XML.  I notice 'context editor' does this well.
Logged
Wahooney
Miner
**
Posts: 25


« Reply #12 on: November 16, 2006, 03:07:28 pm »

Perhaps you guys should also look into creating entire projects through a wizard interface like Code::Blocks and VC++ does. This will let you create a series of files and headers in a certain folder structure, etc.

Or perhaps this is something for the future plugin writers Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.239 seconds with 18 queries.