Commit 3063850e authored by Christian Hergert's avatar Christian Hergert

code: default to python3 when guessing languages

Until we can get reliable guessing from shared-mime-info, default to
python3.
parent dbb78255
Pipeline #211886 passed with stages
in 61 minutes and 33 seconds
......@@ -3597,6 +3597,7 @@ ide_buffer_guess_language (IdeBuffer *self)
g_autofree gchar *basename = NULL;
g_autofree gchar *content_type = NULL;
g_autofree gchar *line = NULL;
const gchar *lang_id;
const gchar *path;
GFile *file;
gboolean uncertain = FALSE;
......@@ -3626,7 +3627,18 @@ ide_buffer_guess_language (IdeBuffer *self)
!(lang = gtk_source_language_manager_guess_language (manager, basename, content_type)))
return;
if (!ide_str_equal0 (gtk_source_language_get_id (lang), ide_buffer_get_language_id (self)))
lang_id = gtk_source_language_get_id (lang);
/* Override to python3 by default for now, until shared-mime-info
* gets a better way to detect the difference between the two.
*/
if (ide_str_equal0 (lang_id, "python"))
{
lang_id = "python3";
lang = gtk_source_language_manager_get_language (manager, lang_id);
}
if (!ide_str_equal0 (lang_id, ide_buffer_get_language_id (self)))
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (self), lang);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment