Changing language association of file extension
-
Hi everyone,
I’d like to change the language association of the file extension “inc” from Pascal to Assembly language.
I already modified the “ext” attributes in “langs.xml” in the AppData\Roaming\Notepad++ directory accordingly (deleted “inc” in “pascal” entry, inserted it in “asm” entry). However, the changes don’t take effect after several times closing and reopening Notepad++; opened *.inc files are still associated with Pascal.
Could anybody please help to solve this problem?
Thanks in advance![Edit:] My debug info:
Notepad++ v8.5.2 (64-bit)
Build time : Apr 4 2023 - 19:55:32
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 22H2
OS Build : 19045.2846
Current ANSI codepage : 1252
Plugins :
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4) -
@jofe95
Did you verify that your changes to thelangs.xml
file were not overwritten?I have no idea how to solve this, but my first guess is that Notepad++ overwrote your changes on exit.
-
@Mark-Olson
Thanks for your reply.
I checked it, my changes were not overwritten; the file still contains<Language name="asm" ext="asm inc" commentLine=";" commentStart="/*" commentEnd="*/"> ... <Language name="pascal" ext="pas pp p lpr" commentStart="{" commentEnd="}">
-
@jofe95 said in Changing language association of file extension:
I checked it, my changes were not overwritten; the file still contains
Did you leave
blah.inc
open in Notepad++ when you exited Notepad++? If so, the “current session” remembers which Language is associated with an individual file.I did the following sequence:
- Open
blah.inc
under the old setup, and see that it’s Pascal - Edit
%AppData%\Notepad++\langs.xml
, move theinc
from pascal to asm - Exit Notepad++
- Run Notepad++
blah.inc
is still open as a Pascal file- Close
blah.inc
while Notepad++ is still running - Open
blah.inc
: it is now an Assembly file
If I do a different sequence:
- Open
blah.inc
under the old setup, and see that it’s Pascal - Edit
%AppData%\Notepad++\langs.xml
, move theinc
from pascal to asm - Close
blah.inc
while Notepad++ is still running - Exit Notepad++
- Run Notepad++
- Open
blah.inc
: it is an Assembly file
- Open
-
@PeterJones
Thanks for explaining this. I honestly had forgotten that this behavior existed. I was on the verge of submitting a feature request at the official repo because it seemed like some files whose extensions had UDL file associations were not being lexed on startup, and then it turned out that it was just that they were not lexed when I last closed Notepad++.I wonder if there’s a way to override this behavior? (Yes, probably PythonScript, but I consider that the method of last resort)
-
@PeterJones
OK, after reopening the *.inc file, it seems to work now. Thank you!