[gnome-builder] code: guess language syntax after loading file



commit a888e262d721e6a883031c7c68ebb7ac57f1dfc7
Author: Christian Hergert <chergert redhat com>
Date:   Fri Feb 15 12:42:43 2019 -0800

    code: guess language syntax after loading file
    
    This is usually done by the file loader for us, but in cases where the
    file is empty, that might not happen. So this will use our wrapper to
    guess the language.

 src/libide/code/ide-buffer.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/libide/code/ide-buffer.c b/src/libide/code/ide-buffer.c
index 8e89eb066..396815365 100644
--- a/src/libide/code/ide-buffer.c
+++ b/src/libide/code/ide-buffer.c
@@ -1340,6 +1340,10 @@ _ide_buffer_load_file_finish (IdeBuffer     *self,
   if (state->highlight_syntax)
     gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (self), TRUE);
 
+  /* Guess the syntax language now if necessary */
+  if (!gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (self)))
+    ide_buffer_guess_language (self);
+
   /* Let consumers know they can access the buffer now */
   g_signal_emit (self, signals [LOADED], 0);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]