[gnome-builder] code: allow uncertain content-type if there is no syntax
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] code: allow uncertain content-type if there is no syntax
- Date: Fri, 15 Feb 2019 20:48:57 +0000 (UTC)
commit aa37baf7786e157aa9d000c69e46c1e3b38b5a0a
Author: Christian Hergert <chergert redhat com>
Date: Fri Feb 15 12:43:35 2019 -0800
code: allow uncertain content-type if there is no syntax
This allows us to guess the syntax type, even if the guess is uncertain
as long as there is no previous syntax set.
src/libide/code/ide-buffer.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/code/ide-buffer.c b/src/libide/code/ide-buffer.c
index 396815365..39cb7701e 100644
--- a/src/libide/code/ide-buffer.c
+++ b/src/libide/code/ide-buffer.c
@@ -3497,11 +3497,13 @@ ide_buffer_guess_language (IdeBuffer *self)
else
path = g_file_peek_path (file);
+ manager = gtk_source_language_manager_get_default ();
+ lang = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (self));
+
content_type = g_content_type_guess (path, (const guchar *)line, strlen (line), &uncertain);
- if (uncertain)
+ if (uncertain && lang != NULL)
return;
- manager = gtk_source_language_manager_get_default ();
if (!(lang = gtk_source_language_manager_guess_language (manager, path, content_type)))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]