Community
    • Login

    Setting a UDL as default for extension

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 2 Posters 291 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dan EastwoodD
      Dan Eastwood
      last edited by

      Apologies for what seems to be a common question, but I’ve searched and looked at the FAQ and I’m still can make this work.

      I downloaded and installed user defined language syntax highlighting for SAS files, which works great. The only bug is I have to set the language highlighting manually every time I open a file.

      My understanding is that a UDL cannot be set as the default for an extension (here SAS or sas).

      So I thought I could do this with a simple macro and assign it to a key, but when I try to record the macro the menu command for Language–>SAS_BALANCE is not captured.

      Is there a way to do this that doesn’t require a deep dive into NPP macro language?

      TIA

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Dan Eastwood
        last edited by

        @Dan-Eastwood ,

        So first: you don’t need a UDL for SAS anymore, assuming you have Notepad++ v8.7.8-or-newer, and assuming you have up-to-date config files => Language > S > SAS exists now.

        Settings > Style Configurator > Language: SAS should show a Default ext.: of sas, so when you open a blah.sas file, it should automatically syntax highlight with SAS.

        However, if you first installed an older Notepad++ some time ago, and upgraded to something v8.7.8-or-newer, then your configuration files might be out of date, as explained here in the user manual.

        So if your config files are out-of-date – and if you can see Language > S > SAS but Settings > Style Configurator > Language: SAS doesn’t exist, then the files are out-of-date – then there are two options for updating them (as the manual mentioned): you could (1) manually edit Notepad++'s XML configuration files, or (2) use my ConfigUpdater plugin to do the update for you. If you are in this situation, and want help with either (1) or (2), share your ?-menu’s Debug Info, and which route you want to go down, and someone here will be able to help you.

        –

        My understanding is that a UDL cannot be set as the default for an extension (here SAS or sas).

        Actually, that’s not correct. UDL can have default extension.

        Assuming, for some reason, that you still want to continue down the UDL path instead of the better built-in SAS handling described above:

        • Look at Language > User Defined Language >Define Your Language…, and choose your SAS UDL from the dropdown.
        • There should be a Ext box, where you can put the extension
          7c60990c-2fd6-4225-8781-b7c69bdd3f66-image.png
          • my example is for a different UDL, so it uses the extension nppexec, which means any blah.nppexec should be automatically opened with the UDL I showed
          • you would put sas if you wanted blah.sas to open with that UDL. After making that change, whenever you open a file with that extension, it should automatically use the UDL syntax highlighting.

        (Language menu entries do not get macro-recorded, even for the built-ins; and because they are dynamically allocated menu entries, UDL entries cannot be correctly recorded either; you would have to delve into the details of the macro language to be able to create a macro to do that, which you said you didn’t want to do.)

        Dan EastwoodD 1 Reply Last reply Reply Quote 2
        • Dan EastwoodD
          Dan Eastwood @PeterJones
          last edited by

          @PeterJones said in Setting a UDL as default for extension:

          However, if you first installed an older Notepad++ some time ago, and upgraded to something v8.7.8-or-newer, then your configuration files might be out of date, …

          This is the case.

          @PeterJones said in Setting a UDL as default for extension:

          So if your config files are out-of-date – and if you can see Language > S > SAS but Settings > Style Configurator > Language: SAS doesn’t exist, then the files are out-of-date

          Also the case.

          @PeterJones said in Setting a UDL as default for extension:

          or (2) use my ConfigUpdater plugin to do the update for you. If you are in this situation, and want help with either (1) or (2), share your ?-menu’s Debug Info, …

          Yes let’s do that. :-)
          I installed that plugin, but Language–>S-SAS doesn’t work, which must be where the “help” come in.

          Notepad++ v8.8.5   (64-bit)
          Build time: Aug 14 2025 - 00:32:39
          Scintilla/Lexilla included: 5.5.7/5.4.5
          Boost Regex included: 1_85
          Path: C:\Program Files\Notepad++\notepad++.exe
          Command Line: "H:\Projects H\Chung\prog\Chung_ReadMe.txt" -multiInst -nosession -x848 -y-1588 -lnormal -n1 -c1
          Admin mode: OFF
          Local Conf mode: OFF
          Cloud Config: OFF
          Periodic Backup: OFF
          Placeholders: OFF
          Scintilla Rendering Mode: SC_TECHNOLOGY_DIRECTWRITE (1)
          Multi-instance Mode: monoInst
          asNotepad: OFF
          File Status Auto-Detection: cdEnabledNew (for current file/tab only)
          Dark Mode: OFF
          Display Info:
              primary monitor: 1920x1200, scaling 150%
              visible monitors count: 3
              installed Display Class adapters: 
                  0000: Description - Intel(R) Graphics
                  0000: DriverVersion - 32.0.101.6881
          OS Name: Windows 11 Enterprise (64-bit)
          OS Version: 24H2
          OS Build: 26100.6584
          Current ANSI codepage: 1252
          Plugins: 
              mimeTools (3.1)
              NppConverter (4.6)
              NppExport (0.4)
          
          

          Anything else you need?

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Dan Eastwood
            last edited by

            @Dan-Eastwood said in Setting a UDL as default for extension:

            I installed that plugin, but Language–>S-SAS doesn’t work, which must be where the “help” come in.

            Did you install the plugin before or after grabbing the Debug Info? Because the Debug Info you pasted does not show the ConfigUpdater plugin installed.

            Once it’s installed, run Plugins > ConfigUpdater > Update Config Files:
            2b83c3b7-0461-4f31-8993-9edaa3090b4b-image.png

            It will pop up a dialog showing some progress, and will probably ask you to let it restart with Elevated UAC (“Administrator mode”) permission; that will allow it to fix the config files in the installation directory as well, so I recommend it. When it restarts, you will have to rerun the plugin command. When it’s done, it will prompt you to let it re-run Notepad++ in normal mode again (staying in Admin mode is a bad idea). Once that sequence is done, you should be able to see SAS in both the Language menu and in the Style Configurator, and opening blah.sas should syntax highlight. (Depending on your theme, you might not see much syntax highlighting, so if you don’t like the colors chosen, use Style Configurator to change the colors for SAS to fit your liking based on your theme.)

            Going forward, whenever you update Notepad++, if the release notes show something about adding a new syntax highlighter or language, or whenever you find you are missing a language or named style that someone else says they have, run Update Config Files again, and it should get you back to the most up-to-date config files.

            Dan EastwoodD 1 Reply Last reply Reply Quote 1
            • Dan EastwoodD
              Dan Eastwood @PeterJones
              last edited by

              @PeterJones said in Setting a UDL as default for extension:

              Once that sequence is done, you should be able to see SAS in both the Language menu and in the Style Configurator, and opening blah.sas should syntax highlight.

              I have run Update Config Files several times, and I have a validation error. I will try to abbreviate ConfigUpdaterLog so you don’t get all 400 lines:

              …


              — ConfigUpdater run at Wednesday, September 24, 2025 1:06:42 PM
              — Checking Styler/Theme File: ‘C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\stylers.xml’

              • Lexer ‘actionscript’: added missing style #128=‘USER KEYWORDS 1’
              • Lexer ‘actionscript’: added missing style #129=‘USER KEYWORDS 2’
              • Lexer ‘actionscript’: added missing style #130=‘USER KEYWORDS 3’
                [SNIP]
              • Lexer ‘lua’: added missing style #130=‘USER KEYWORDS 7’
              • Lexer ‘lua’: added missing style #131=‘USER KEYWORDS 8’
                ! Lexer ‘php’: renamed styleID#121 from ‘WORD’ to ‘KEYWORDS’
              • Lexer ‘php’: added missing style #213=‘PREDEFINED’
              • Lexer ‘php’: added missing style #214=‘FUNCS AND METHODS 1’
              • Lexer ‘php’: added missing style #215=‘FUNCS AND METHODS 2’
                {SNIP]
              • Lexer ‘typescript’: added missing style #134=‘USER KEYWORDS 7’
              • Lexer ‘typescript’: added missing style #135=‘USER KEYWORDS 8’
                ! Lexer ‘verilog’: renamed styleID#2 from ‘TAGNAME’ to ‘COMMENT LINE’
              • Lexer ‘xml’: added missing style #192=‘USER ATTRIBUTES 1’
              • Lexer ‘xml’: added missing style #193=‘USER ATTRIBUTES 2’
                [SNIP]
              • GlobalStyles: Added missing WidgetStyle:‘Tab color dark mode 3’
              • GlobalStyles: Added missing WidgetStyle:‘Tab color dark mode 4’
              • GlobalStyles: Added missing WidgetStyle:‘Tab color dark mode 5’
                ! Validation of C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\stylers.xml failed on line#1683:

              XML validation FAILED: ‘2’ is a duplicate key for the unique Identity Constraint ‘unique-WordsStyle-styleID’.

              Line#1683:
              <WordsStyle name=“COMMENT LINE” styleID=“2” fgColor=“008000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“”/>
              — Checking Styler/Theme File: ‘C:\Program Files\Notepad++\themes\Bespin.xml’
              ! Directory ‘C:\Program Files\Notepad++\themes’ not writable. Will prompt for UAC.
              !!!
              !!! Run Plugins > ConfigUpdater > Update Config Files after Notepad++ restarts !!!
              !!!

              — Checking Language File: ‘C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\langs.xml’

              • Language ‘actionscript’: add missing Keywords group:‘substyle1’
              • Language ‘actionscript’: add missing Keywords group:‘substyle2’
                [SNIP]
              • Language ‘xml’: add missing Keywords group:‘substyle8’
              • Languages: Sorted Language elements alphabetically (keeping “normal” at the beginning and “searchResults” at end)
              • Validation: Confirmed VALID Langs XML for C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\langs.xml
                — ConfigUpdater done. —
                !!! There was at least one validation error. Recommend you run Plugins > ConfigUpdater > Validate Config Files !!!

              — ConfigUpdater run at Wednesday, September 24, 2025 1:08:19 PM
              — Checking Styler/Theme File: ‘C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\stylers.xml’

              • LexerStyles: Sorted LexerType elements alphabetically (keeping “searchResults” at end)
                ! Validation of C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\stylers.xml failed on line#1683:

              XML validation FAILED: ‘2’ is a duplicate key for the unique Identity Constraint ‘unique-WordsStyle-styleID’.

              Line#1683:
              <WordsStyle name=“COMMENT LINE” styleID=“2” fgColor=“008000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“”/>
              — Checking Styler/Theme File: ‘C:\Program Files\Notepad++\themes\Bespin.xml’
              ! Directory ‘C:\Program Files\Notepad++\themes’ not writable. Will prompt for UAC.
              !!!
              !!! Run Plugins > ConfigUpdater > Update Config Files after Notepad++ restarts !!!
              !!!

              — Checking Language File: ‘C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\langs.xml’

              • Languages: Sorted Language elements alphabetically (keeping “normal” at the beginning and “searchResults” at end)
              • Validation: Confirmed VALID Langs XML for C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\langs.xml
                — ConfigUpdater done. —
                !!! There was at least one validation error. Recommend you run Plugins > ConfigUpdater > Validate Config Files !!!

              — ConfigUpdater run at Wednesday, September 24, 2025 1:16:15 PM
              — Checking Styler/Theme File: ‘C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\stylers.xml’

              • LexerStyles: Sorted LexerType elements alphabetically (keeping “searchResults” at end)
                ! Validation of C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\stylers.xml failed on line#1683:

              XML validation FAILED: ‘2’ is a duplicate key for the unique Identity Constraint ‘unique-WordsStyle-styleID’.

              Line#1683:
              <WordsStyle name=“COMMENT LINE” styleID=“2” fgColor=“008000” bgColor=“FFFFFF” fontName=“” fontStyle=“0” fontSize=“”/>
              — Checking Styler/Theme File: ‘C:\Program Files\Notepad++\themes\Bespin.xml’
              ! Directory ‘C:\Program Files\Notepad++\themes’ not writable. Will prompt for UAC.
              !!!
              !!! Run Plugins > ConfigUpdater > Update Config Files after Notepad++ restarts !!!
              !!!

              — Checking Language File: ‘C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\langs.xml’

              • Languages: Sorted Language elements alphabetically (keeping “normal” at the beginning and “searchResults” at end)
              • Validation: Confirmed VALID Langs XML for C:\Users\DEASTWOOD\AppData\Roaming\Notepad++\langs.xml
                — ConfigUpdater done. —
                !!! There was at least one validation error. Recommend you run Plugins > ConfigUpdater > Validate Config Files !!!
                …

              I tried running Validate Config Files, but I don’t know what to do with it.

              NOW it occurs to be that when I moved to a new computer last week, I copied over the config files to keep my macros, and this might have inadvertently created some of these errors. Would it help to reinstall from scratch?

              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Dan Eastwood
                last edited by PeterJones

                @Dan-Eastwood said in Setting a UDL as default for extension:

                NOW it occurs to be that when I moved to a new computer last week, I copied over the config files to keep my macros, and this might have inadvertently created some of these errors. Would it help to reinstall from scratch?

                From scratch? I wouldn’t recommend that. But if you grab the most recent portable from https://notepad-plus-plus.org/downloads/v8.8.5/ , and then copy the themes directory from that unzip into c:\program files\Notepad++\themes\ , that would fix all the validation errors (except the ones in stylers.xml). If you haven’t customized your colors on languages in the default theme (stylers.xml), then you can delete %AppData%\Notepad++\stylers.xml and the next time you run Notepad++, it will create it again from scratch, without validation errors.

                (Oddly enough, after replacing all the installed themes, you will still have to run my plugin again, because the developer only distributes, not maintains, the themes other than stylers.xml and DefaultDarkMode.xml – the other ones only get updated if a volunteer does the update. That’s actually one of the reasons I made the plugin, because anyone who uses a theme other than the two official ones will be missing a lot of language possibilities in their Style Configurator.)

                Dan EastwoodD 1 Reply Last reply Reply Quote 2
                • Dan EastwoodD
                  Dan Eastwood @PeterJones
                  last edited by

                  @PeterJones

                  Testing some files, and the SAS styler is now available and highlighting as it should, so maybe the validations errors are irrelevant.

                  I still have to set the style manually, so it doesn’t seem to be recognizing the SAS extension. I looked in Settings–>Style Configuator–> Default (stylers.xml)–>Language: SAS, and I see the “sas” extension. What am I missing?

                  PeterJonesP 1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @Dan Eastwood
                    last edited by

                    @Dan-Eastwood ,

                    Do you still have the UDL version of SAS as well as the built-in? (It would be shown beneath the horizontal bar in the Language menu, below the User Defined Language > submenu, because it could be conflicting.

                    53f30738-fa9d-4643-94c2-86ccd3a84d86-image.png

                    If so, Language > User Defined Language > Define Your Language, pick the SAS UDL from that dropdown, and Remove it.

                    Dan EastwoodD 1 Reply Last reply Reply Quote 2
                    • Dan EastwoodD
                      Dan Eastwood @PeterJones
                      last edited by

                      @PeterJones

                      That seems to have done the trick!

                      Thank you so much for all your help today.
                      alt text

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors