Autocompletion feature in runtime

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Autocompletion feature in runtime

Sebastián Sastre
Hi all,

  It was requested the autocompletion feature to one of my apps.

  Do you think it's possible to use a TextPresenter with a
ScintillaView to gave this functionallity? any problem to deploy?

  In the other hand the text should be with format, like the WordPad in
the Sample Applications of System Folder.

   Can one use a Scintilla text to produce/display some RTF text ?

  thank you,

Sebastian


Reply | Threaded
Open this post in threaded view
|

Re: Autocompletion feature in runtime

Blair McGlashan-4
"Sebastián" <[hidden email]> wrote in message
news:[hidden email]...
> Hi all,
>
>  It was requested the autocompletion feature to one of my apps.
>
>  Do you think it's possible to use a TextPresenter with a
> ScintillaView to gave this functionallity? any problem to deploy?
>

There is certainly no problem in doing this, indeed we have written an
application (also an IDE of sorts, but not one that re-uses any of the
Dolphin IDE) that uses Scintilla and which has syntax colouring and
auto-completion.

>  In the other hand the text should be with format, like the WordPad in
> the Sample Applications of System Folder.
>
>   Can one use a Scintilla text to produce/display some RTF text ?
>

I would not use Scintilla for that. It is not designed for displaying
formatted text or text with markup. You could introduce a presenter that
would use it to do that, but really it is designed as a programmer's editor
where the formatting is derived automatically from lexical/syntactic
analysis of the text.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Autocompletion feature in runtime

Sebastián Sastre
Dear Blair,
  thanks for your answer. I understood that Scintilla is not designed
to show formatted text.

  What I need is not the lexical features, just an autocompletion based
on a custom dictionary preservating text format.

  What would you recomend to have both features, formatted text and
autocompletion?

 Can autocompletion be added to a subclass of RichTextPresenter for
instance?

  thanks again,

Sebastian


Reply | Threaded
Open this post in threaded view
|

Re: Autocompletion feature in runtime

Blair McGlashan-4
"Sebastián" <[hidden email]> wrote in message
news:[hidden email]...

> Dear Blair,
>  thanks for your answer. I understood that Scintilla is not designed
> to show formatted text.
>
>  What I need is not the lexical features, just an autocompletion based
> on a custom dictionary preservating text format.
>
>  What would you recomend to have both features, formatted text and
> autocompletion?
>
> Can autocompletion be added to a subclass of RichTextPresenter for
> instance?
>

Well it would be possible, especially if you completion is based just on
dictionary lookup. If you need to identify syntactic elements in order to
direct auto-completion, then you will have a lot of work to do. You'll need
to maintain information about the tokens in the text, and maintain this
efficiently as the user is editing. This is non-trivial.

Scintilla itself doesn't do a lot of this work for you, but rather it
understands what text has been "styled" and sends appropriate notifications
to request styling of text. Obviously it is also capable of maintaining
information about the styling of text runs, and of drawing the runs
appropritely depending on the visual style configuration. It has a lot of
built-in "lexers" that can do this styling, but frankly I don't think those
belong in the control itself even though they are packaged that way for
convenience. We use container based "lexing" (really it goes a bit beyond
lexical analysis because of token ambiguity in Smalltalk) because it is much
more flexible and allows us to provide extensibility in Smalltalk without
having to build a C++ lexer for your favourite language and get it
incorporated into the distro.

Being able to distinguish the type of syntactic element under the cursor is
absolutely key to the intelligent editing features of most modern IDEs.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Autocompletion feature in runtime

Sebastián Sastre
Understood. My needs of autocompletion seems to be far more simple than
dolphins (or IDE's ones). So when I get that requeriment implemented
I'll first try the way of a subspecialized RichTextPresenter.

Thanks,

Sebastian