How to make basic code autocompletion?

I am making a simple code editor in GTK and gtksourceview2.0. I would like to add a code completion window to my editor. There should be 10-15 keywords (always the same).

Can someone give me a link to some tutorials or describe using the gtk_source_completion_XXX functions?

+3
source share
2 answers

You need to parse the user input using a signal key-press-event(or similar signals).

  • Get GtkTextBuffer by calling gtk_text_view_get_buffer.
  • Get GtkTextMark by calling gtk_text_buffer_get_insert.
  • Get GtkTextIter by calling gtk_text_buffer_get_iter_at_mark.
  • , GtkTextIter gtk_text_iter_ends_word.
    • gtk_text_iter_backward_word_start, GtkTextIter .
    • gtk_text_buffer_get_text, .
    • GtkTreeView GtkWindow GTK_WINDOW_POPUP.

. :: ->, , .

+6

Source: https://habr.com/ru/post/1757110/


All Articles