Community
    • Login

    File extension List

    Scheduled Pinned Locked Moved General Discussion
    11 Posts 5 Posters 1.0k 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.
    • Mark Davies 0M
      Mark Davies 0
      last edited by

      Hi All, is it possible to edit the list of file extensions in the ā€˜Open’ dialogue box? By default the list is quit big. Thanks

      PeterJonesP 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Mark Davies 0
        last edited by PeterJones

        @Mark-Davies-0 ,

        Every language in %AppData%\Notepad++\langs.xml šŸ›ˆ (or your installation’s equivalent config file location) will show up in the Open and Save As dialog file-type lists.

        To get rid of entries in that list, you would have to could remove the <Language ... </Language> section for each of the entries that you don’t want from the langs.xml (following the sequence for editing Notepad++ config files) then restart Notepad++. However, the major caveat for that is that if you remove a given language from langs.xml, Notepad++ will not be able to correctly syntax-highlight that language.

        As an alternative suggestion: the order of the file types is determined by the order in langs.xml – so if you have just 2-5 languages you normally use, then you could move it so those were the first 2-5 languages (after <Language name="normal" ext="txt"/>) – after restarting, then those more-frequent languages would be your first few choices in the pulldown, so they are easier to choose when opening or saving a file, without losing access to the syntax highlighting on languages you use less often.

        update: see below, there is another option

        1 Reply Last reply Reply Quote 3
        • PeterJonesP
          PeterJones @Mark Davies 0
          last edited by

          @Mark-Davies-0 ,

          After my above post, I had another idea that I experimented with: there is actually another way: you can use Settings > Preferences > Language dialog. If you move languages from the Available items to the Disabled items, as in the screenshot below:

          2cf44f1d-06be-4689-80a7-62de7f80f82d-image.png

          … then after restarting, the only languages that show up in the Open and Save As file-type drop-downs are the ones in the Available items list:

          dac5782e-e231-42eb-8227-99d8e5808942-image.png

          So that’s a simpler way of removing them from the list

          Alan KilbornA Mark Davies 0M 2 Replies Last reply Reply Quote 3
          • Alan KilbornA
            Alan Kilborn @PeterJones
            last edited by

            @PeterJones

            I don’t know if you’d call these techniques ā€œhacksā€ (probably), but my first thought about them is that it might be nice to pull this info into the user manual so that it is not ā€œlostā€ for the future. But maybe since they are hacks, they don’t belong there.

            PeterJonesP 1 Reply Last reply Reply Quote 1
            • PeterJonesP
              PeterJones @Alan Kilborn
              last edited by

              @Alan-Kilborn ,

              The ā€œdelete from langs.xmlā€ is definitely a hack. The reorder is borderline hacky. But it would make sense to document that the Language list affects the open/save-as pulldowns.

              1 Reply Last reply Reply Quote 1
              • Mark Davies 0M
                Mark Davies 0 @PeterJones
                last edited by

                @PeterJones Thanks Peter thats great, really appreciate your help with this, do you know if there a way to add a language / file extension tyoe to the list? I use it for editing Bentley MX input files so *.inp

                PeterJonesP Mark OlsonM 2 Replies Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones @Mark Davies 0
                  last edited by

                  @Mark-Davies-0 ,

                  You cannot arbitrarily add languages to the langs.xml and expect it to fully work, because langs.xml was made to control the built-in languages, not add arbitrary language or control UDL.

                  However, my experiments show that when I add an unknown language to langs.xml, like

                          <Language name="normal" ext="txt"/>
                          <Language name="BentleyMX" ext="inp" />
                          ...
                  

                  (and restart after changing/saving langs.xml, so Notepad++ re-reads langs.xml)

                  Then when I do an Open (or Save As), it will show up as a second Normal Text in the pulldown:
                  3ab446a5-d2e5-4e03-a64f-fe23832a8bc6-image.png
                  … so it’s not perfect (because it calls it Normal text again, instead of BentleyMX), but it does add a new mask to the pulldown, which might be enough for you

                  If you also have a User Defined Language (UDL) defined – for example, I created one called BentleyMX that has Ext.: defined as inp – then when you open the blah.inp file, it will automatically apply the UDL styling (which you would have to set up) to it.
                  ca5ee359-56d8-42d3-a516-b488b25bb1b8-image.png

                  (Per Alan’s note, I would call adding a unknown language to langs.xml a ā€œhackā€. But it does seem to ā€œworkā€ per your use-case, insofar as Open and Save As dialogs are concerned.)

                  For the right way to do it: Notepad++ , in theory, could have a way to add the UDL types with their extensions to that list, and I requested that years ago but it hasn’t been implemented yet. If having a native implementation, where Notepad++ automatically includes those in the list as you create more UDL, you could go over there and ā€œupvoteā€ (click on the thumbs-up) and/or comment, agreeing that you’d like it implemented.

                  Mark Davies 0M PeterJonesP 2 Replies Last reply Reply Quote 1
                  • Mark OlsonM
                    Mark Olson @Mark Davies 0
                    last edited by

                    @Mark-Davies-0 said in File extension List:

                    do you know if there a way to add a language / file extension tyoe to the list?

                    Are you talking about user-defined languages? Follow that link for relevant documentation.

                    1 Reply Last reply Reply Quote 1
                    • Mark Davies 0M
                      Mark Davies 0 @PeterJones
                      last edited by

                      @PeterJones Hi Peter, thats great thanks so much for your help!

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

                        @PeterJones said in File extension List:

                        I requested that years ago but it hasn’t been implemented yet.

                        Prompted by this, and the thought, ā€œI should be able to figure out how to take the list of UDL extensions, which should be available in a data structure already, and add them to the other list of filters for the SaveAs/Open dialogsā€, I tried it out, even though I don’t have much experience in the codebase: I was able to figure it out, and put in a PR for it – that PR has been merged, so that means the SaveAs/Open dialog filters will show all UDL extensions in the file-type filter, starting in the next release. šŸŽ‰

                        Lycan ThropeL 1 Reply Last reply Reply Quote 4
                        • Lycan ThropeL
                          Lycan Thrope @PeterJones
                          last edited by

                          @PeterJones ,
                          Bravo @PeterJones. Hope to get to that point, someday.
                          :-)

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