@elextr I think, all SCI_*LEXER* are not really needed in this plugin (so they can stay in this list and no more), also you wrote

You should not set the lexer directly, set the Geany filetype instead.

here. Now we can get the current filetype

local finfo = geany.fileinfo()
if finfo ~= nil then
  geany.message('Current filetype is "' .. finfo.type .. '": ' .. finfo.desc)
end

and it may be useful to change the current filetype: something like geany.settype(".cmake") with

/* Change the current file type by the specified file extension */
static gint glspi_set_filetype(lua_State* L)
{
	GeanyDocument *doc=NULL;
	GeanyFiletype *ft=NULL;
	const gchar *ftn=NULL;

	if (lua_gettop(L)==1){
		if (!lua_isstring(L, 1)) { return FAIL_STRING_ARG(1); }
		doc = document_get_current();
		if (!(doc && doc->is_valid)) { return 0; }
		ftn=lua_tostring(L, 1);
		if ('\0' == ftn[0]) { return 0; }
		ft=filetypes_detect_from_extension(ftn);
		if (ft != NULL){
			document_set_filetype(doc, ft);
			return 1;
		}
	}
	return 0;
}

in glspi_doc.c. But currently filetypes_detect_from_extension is not a prt of Geany API.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.