Community
    • 登入

    How to change default language for file extension

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    8 貼文 3 Posters 8.8k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • R
      Ruairí Murphy
      最後由 編輯

      I’m working with express applications at the moment using handlebars (.hbs files). How can i make HTML the default language for .hbs files? (I’ve tried “settings/preferences/file associations” but I can’t seem to edit anything)

      1 條回覆 最後回覆 回覆 引用 0
      • PeterJonesP
        PeterJones
        最後由 PeterJones 編輯

        @Ruairí-Murphy said in How to change default language for file extension:

        How can i make HTML the default language for .hbs files?

        Settings > Style Configurator > Language: HTML, User Ext: = hbs (or, if there were already one, like User Ext: hta, then change to space separated hta hbs (no dots))

        see also: Style Configurator doc

        1 條回覆 最後回覆 回覆 引用 2
        • dbdonbD
          dbdonb
          最後由 編輯

          Hi,

          I did that, however, the settings don’t take effect. I was in admin mode while making those settings and despite restarting NPP, the settings don’t seem to take any effect.

          Any clue where I’m going wrong?
          Thanks.

          PeterJonesP 1 條回覆 最後回覆 回覆 引用 0
          • dbdonbD
            dbdonb
            最後由 編輯

            Sorry for the double post.

            Just wanted to add that my NPP version is v7.8.7 64bit

            1 條回覆 最後回覆 回覆 引用 0
            • PeterJonesP
              PeterJones @dbdonb
              最後由 編輯

              @dbdonb said in How to change default language for file extension:

              I did that, however, the settings don’t take effect. I was in admin mode while making those settings and despite restarting NPP, the settings don’t seem to take any effect.

              You shouldn’t need to be in Admin Mode for that change.

              The following sequence works just fine for me:

              1. Go to Settings > Style Configurator > HTML, and type rbs into the User ext. box, then hit Save & Close
                e536cdd3-d57f-485e-9d17-52bef42bfb64-image.png
              2. File > New
              3. File > Save As, select Save as type as either All Types (*.*) or Hyper Text Markup Language file (*.html; ...), and type blah.rbs, then Save
              4. At this point, the status bar shows (in the lower left, if the window is wide enough) that blah.rbs is a Hyper Text Markup Language file, and if I enter HTML or pseudo-html, it highlights as expected:
                52efcbe4-2831-4414-8784-55388b071de0-image.png

              This feature has worked for me in every version of Notepad++ I have used for the last 5+ years, including v7.8.7-64bit.

              If your experience is different, you will have to give an explanation of the exact sequence of steps, and we can try to replicate your problem.

              But for now, “it works for me”

              dbdonbD 1 條回覆 最後回覆 回覆 引用 2
              • dbdonbD
                dbdonb @PeterJones
                最後由 編輯

                @PeterJones Thanks a lot for this splendid explanation. I really appreciate it. Apologies for my delayed response.

                However, I realised that the reason a particular custom extension wasn’t working for me was that it is already defined in the default of another language.

                I need “inc” to be opened in C language, however, it’s by default defined in Pascal. I guess if I am able to remove it from the Pascal defaults, things would work for me.

                66f817ff-d645-4535-ac4a-86bb498130e2-image.png

                I Would be grateful if you could kindly guide me in how to remove a default extension from a language.

                Regards

                1 條回覆 最後回覆 回覆 引用 0
                • dbdonbD
                  dbdonb
                  最後由 dbdonb 編輯

                  Update:

                  Sorry for double posting. The edit time is way too less (3 minutes!)

                  I figured out editing the default extension I guess. I edited the langs.xml and removed inc from Pascal.

                  It now loads the custom syntax hughlighting ( C Language) for .inc

                  However, I hope what I’ve done won’t break anything else in the system, and also hope that this is how it’s supposed to be done.

                  Kindly correct me if wrong.

                  Regards

                  PeterJonesP 1 條回覆 最後回覆 回覆 引用 2
                  • PeterJonesP
                    PeterJones @dbdonb
                    最後由 編輯

                    @dbdonb ,

                    hope that this is how it’s supposed to be done.

                    You are given access to plaintext (XML) config files in Notepad++ because the developers want you to be able to have as full control over the application as you can. Edit config files to your heart’s content. :-)

                    1 條回覆 最後回覆 回覆 引用 2
                    • 第一個貼文
                      最後的貼文
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors