• Login
Community
  • Login

Notepad sees files with .tcl extension as shell file

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
11 Posts 4 Posters 1.1k 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.
  • G
    Gor Abgaryan 0
    last edited by Oct 20, 2022, 8:17 AM

    Notepad sees a file with .tcl extension as a shell file although the default extension <tcl> is set for TCL language in Settings>Style configurator .

    E G 2 Replies Last reply Oct 20, 2022, 9:33 AM Reply Quote 0
    • E
      Ekopalypse @Gor Abgaryan 0
      last edited by Oct 20, 2022, 9:33 AM

      @Gor-Abgaryan-0

      this works for me, could it be that .tcl is added into the user ext setting of the bash lexer?

      4de6a3b3-a62d-4140-b2b6-e0d748776b48-image.png

      G 1 Reply Last reply Oct 20, 2022, 10:50 AM Reply Quote 1
      • G
        Gor Abgaryan 0 @Ekopalypse
        last edited by Oct 20, 2022, 10:50 AM

        @Ekopalypse
        Hi. Thanks for your feedback. Nope, there is only my username in extensions part
        ext.png

        1 Reply Last reply Reply Quote 0
        • G
          Gor Abgaryan 0 @Gor Abgaryan 0
          last edited by Oct 20, 2022, 11:11 AM

          @Gor-Abgaryan-0

          Found the issue, but still need to be fixed.
          The first 3 lines of the code are:

          #!/bin/sh
          #\
          exec tclsh $0 ${1+“$@”}

          removing these lines fixes the problem, but these lines need to be there

          A 1 Reply Last reply Oct 20, 2022, 11:39 AM Reply Quote 1
          • A
            Alan Kilborn @Gor Abgaryan 0
            last edited by Oct 20, 2022, 11:39 AM

            @Gor-Abgaryan-0 said in Notepad sees files with .tcl extension as shell file:

            #!/bin/sh

            Sorry, that line is going to override your file’s extension and set Notepad++ up to lex the document as shell.

            G 2 Replies Last reply Oct 20, 2022, 12:00 PM Reply Quote 1
            • G
              Gor Abgaryan 0 @Alan Kilborn
              last edited by Oct 20, 2022, 12:00 PM

              @Alan-Kilborn
              Thanks. Isn’t there a way to disable that and make npp read only the file extension for highlighting?

              A 1 Reply Last reply Oct 20, 2022, 12:15 PM Reply Quote 0
              • G
                Gor Abgaryan 0 @Alan Kilborn
                last edited by Oct 20, 2022, 12:02 PM

                @Alan-Kilborn
                And one more question about extensions.
                I have .v/.sv extensions for Verilog, but I need also .sv.bck to be read as Verilog. But it is not working. Is there a way to let it work?

                P 1 Reply Last reply Oct 20, 2022, 3:18 PM Reply Quote 0
                • A
                  Alan Kilborn @Gor Abgaryan 0
                  last edited by Alan Kilborn Oct 20, 2022, 12:16 PM Oct 20, 2022, 12:15 PM

                  @Gor-Abgaryan-0 said in Notepad sees files with .tcl extension as shell file:

                  Isn’t there a way to disable that and make npp read only the file extension for highlighting?

                  I don’t believe so.

                  I need also .sv.bck to be read as Verilog. Is there a way to let it work?

                  I don’t think so.

                  But I could be wrong. Perhaps someone will respond that has a different opinion.

                  1 Reply Last reply Reply Quote 0
                  • P
                    PeterJones @Gor Abgaryan 0
                    last edited by Oct 20, 2022, 3:18 PM

                    @Gor-Abgaryan-0 said in Notepad sees files with .tcl extension as shell file:

                    I need also .sv.bck to be read as Verilog

                    If you are editing blah.sv.bck and nothing else using the .bck extension, so that all .bck files that you are editing are Verilog, then you can just use bck in the User Extension list for Verilog. Reason why it didn’t work for you: When Notepad++ is doing the extension matching, it only looks from the final dot to the end, so it only compares the bck portion, which then doesn’t match a User Ext: sv.bck

                    With some effort, you can create a macro for changing the current file to Verilog, and assign that macro to a keyboard shortcut, so that you could then just use that shortcut anytime you load a .sv.bck file. (Unfortunately, Languages aren’t in the Shortcut Mapper, and changing Langauge isn’t macro-recordable; but if you manually edit your macro file to have a macro calling <Action type="2" message="0" wParam="46043" lParam="0" sParam="" />, and restart Notepad++, that Macro will then be available to assign a keyboard shortcut to, and it will do that action, even though you couldn’t record it.)

                    Or you could use a scripting plugin (like Python Script) to set up a callback which every time you open a new file, it checks the filename, and if that ends in .sv.bck then change the language to Verilog.

                    G 1 Reply Last reply Oct 26, 2022, 12:12 PM Reply Quote 1
                    • G
                      Gor Abgaryan 0 @PeterJones
                      last edited by Oct 26, 2022, 12:12 PM

                      @PeterJones
                      Thanks for the feedback.
                      And what about <#!/bin/sh> at the beginning of the tcl file? Is there a way to read this file as a TCL file? There were a feedback saying there is no way.

                      A 1 Reply Last reply Oct 26, 2022, 12:19 PM Reply Quote 0
                      • A
                        Alan Kilborn @Gor Abgaryan 0
                        last edited by Alan Kilborn Oct 26, 2022, 12:20 PM Oct 26, 2022, 12:19 PM

                        @Gor-Abgaryan-0 said in Notepad sees files with .tcl extension as shell file:

                        And what about <#!/bin/sh> at the beginning of the tcl file? Is there a way to read this file as a TCL file?
                        There were a feedback saying there is no way.

                        I still don’t believe this is currently possible, but I think a change is coming soon to Notepad++ to allow this to happen.

                        This ISSUE that came up recently describes a similar situation and links to some others discussing the impending code change.

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