Skip to main content
Participant
February 10, 2010
Question

Using TLF as basis for code editor?

  • February 10, 2010
  • 1 reply
  • 520 views

Hi,

I want to develop a editor, which can be used as code editor(not fullscreen, embedded in HTML view) - that means it shall support syntax highlighting, code completion (simulated with other Flex controls) during the maintenance of the code(tokens), you name it. It would also be important to have the possibilty to add (invisible) metadata (like IDs) to the tokens, since there shall be an automatic mapping (user enters tokens and on the fly they are mapped to internal IDs).

Performance, accessiblity and other related issues (RightToLeft) are also quite important. Undo/Redo of course also .

Do you think TLF would be of help here or was it designed for another purpose? Another alternative would be the use of the TextArea control (supports HTML).

Thanks for your feedback!

This topic has been closed for replies.

1 reply

Adobe Employee
February 11, 2010

It is possible to use TLF as a code editor. I think the trickiest part is if your editor supports syntax highlighting, to handle syntax changes that ripple across all the content in a performant way (for instance, if you add a quote or start a comment at the top of the file, but don't have it closed off). You could certainly use our id mechanism to mark keywords, but as the keywords changed you would have to edit the markings you have applied as well. You probably would not want to use this same mechanism for syntax that may extend across many lines, such as comments or strings, because then you might have to edit the structure across a large range on the fly.

TLF does support right to left, and you can use explicit line breaking to prevent wrap if that's desired.

- robin

Participant
February 12, 2010

ok, thanks for your explainations.

I've forgotten to describe one further requirement. For some usecases, the user shall only enter coding/tokens in a template.

Example:

IF <userInput>

THEN <userInput>

ELSE <userinput>

So, the user shall not be able to delete the template structure (IF clause in this example, "ReadOnly Area").

I guess also you get low level events (for example, the user hovers the mouse over a token, so that you can provide a tooltip, etc.)?

There is the need for prototyping, no question. But from your  gutfeeling, would you prefer TLF instead of using the standard TextArea  control to implement such a code editor?

I know the TextArea control a little...I think its strength are the (memory) footprint, using of full(?) HTML...but I think using this control results not in a clean architecture because there would be the need to rely hevily on html/javascript (eg. using <A> tag to mask ID ) etc.

In contradiction, TLF can directly interpret XML if I've understood the concept correctly.