User Extensions for Language Recognition not working for custom styles
-
I added some file extensions for syntax highlighting (Lua). This works well with the default style. But after switching to another style (Obsidian), only .lua files are recognized, not my custom ones.
-
The
user ext.
field is apparently saved per-theme, so when you change from one theme to another, the changes you made in the first theme (including the user extension list) don’t apply to any other theme.Thus, the sequence I had to go through to make it work for a new theme:
- Select theme (Obsidian)
- Save and close Style Configurator
(you have to save&close here, because right now, the user extension box doesn’t exist) - Style Configurator > Lua
- add your custom extension (my experiment used
clua
, which was short for “custom lua”) - save and close Style Configurator
- Now if you open a standard
blah.lua
or a customblah.clua
, both will use the Lua syntax highlighting.
-
@PeterJones
Strange, with clua it’s working. Not so with .con file.Maybe because I used it as user extension for other themes before?
-
@Tobias-Gebhard said in User Extensions for Language Recognition not working for custom styles:
@PeterJones
Strange, with clua it’s working. Not so with .con file.
Maybe because I used it as user extension for other themes before?Doubtful.
I tried some experiments. The first time I tried using
clua con mdl module
as my user-extensions, I thought I replicated your results, and when I openedblah.con
, it seemed to mark it as text.I was starting to think that
con
was somehow getting confused withCON
, the DOS console pseudo-file. I know that in other circumstances, the “user extension” also applies if it’s the exact name of the file, and I thought maybe the DOS pseudo-files would create extensions that didn’t work. So I changed toclua con prn nul mdl module
, and opened some files with those extensions: now all of them interpreted as Lua, even the.con
file.I went to just
con
as the user-extension list, and openingother.con
worked and was associated as Lua.I tried going back to
clua con mdl module
, and now that’s working – every.con
file I open, or when I create a new file and save-as anything.con, it works for me. I can exit and restart Notepad++, and that mapping is still there.You might try clearing the user extensions for Lua, setting it only to
con
, exiting Notepad++ and coming back in, and see if it works.If not, please share your ? menu Debug Info (you can copy/paste from that dialog into your reply)
-
I wrote only “con” to the list and it didn’t work. Every other ending is working, except the ones I used before.
But I also found out, this happens only at Obsidian. Not the other themes.
I customized the settings of Obsidian before, maybe that’s the problem. -
@Tobias-Gebhard said in User Extensions for Language Recognition not working for custom styles:
But I also found out, this happens only at Obsidian. Not the other themes.
Hmm, maybe use the Compare plugin to look at your
Obsidian.xml
theme vs the master copy of Obsidian.xml, and see whether any of the differences jump out as “this may break things”. -
Ok, I checked with the original Obsidian.xml and it works now.
Although the Lua block is the same, this strange behavior still exists. (They are only differences in other languages or maybe because of Global Style).
If anyone wants to further investigate, I would upload the files here, but I can’t.Anyway, thank you for the help.