• Login
Community
  • Login

How to remove the space when commenting lines?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
11 Posts 2 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.
  • T
    Terry R
    last edited by May 19, 2020, 11:41 PM

    @Willy said in How to remove the space when commenting lines?:

    the text is commented in this way:

    If you were to read the Notepad++ documentation, specifically the config files it may help. See:
    https://npp-user-manual.org/docs/config-files/

    Look for the langs.xml file detail. I presume you have a specific language you are using, perhaps ASM files. It would appear that you can define the comment start characters by editing this file.
    I haven’t tried this.

    Good luck
    Terry

    1 Reply Last reply Reply Quote 2
    • W
      Willy
      last edited by May 20, 2020, 12:55 AM

      @Terry-R Hi, that’s what you’re saying is to change the character for another one, that’s not my problem, my problem is that notepad++ always adds a space when I comment and that’s what I want to avoid, I read the langs.xml file and look at this line for the Ruby language:

      <Language name="ruby" ext="rb rbw" commentLine="#">
      

      As you see there are no spaces in the “#” character so it’s not like I can do anything to take the space away, it’s something from Notepad++

      T 1 Reply Last reply May 20, 2020, 1:47 AM Reply Quote 0
      • T
        Terry R
        last edited by Terry R May 20, 2020, 1:18 AM May 20, 2020, 1:17 AM

        @Willy said in How to remove the space when commenting lines?:

        As you see there are no spaces in the “#” character

        Actually from my limited knowledge of this setting I’d say NPP isn’t interpreting your code as Ruby, otherwise it would have used the # as you show from the langs.xml file, not the ; . I also note that # is the comment line for Ruby in the real world. What file extensions are you using? That may be how NPP is acknowledging the code, so look in the langs.xml file again for the extensions you are using and check the relevant comment info.

        Terry

        1 Reply Last reply Reply Quote 1
        • T
          Terry R @Willy
          last edited by Terry R May 20, 2020, 1:49 AM May 20, 2020, 1:47 AM

          @Willy said in How to remove the space when commenting lines?:

          not like I can do anything to take the space away, it’s something from Notepad++

          You may be right here. I’ve completed some testing selecting various languages and each time I press the Ctrl-Q shortcut it inserts the comment character(s) for the selected language, and then appends a space. It does prove you aren’t selecting Ruby as the language or using the ruby file extensions though as you get the ;, not the # character.

          So regardless of which language is selected it would appear the default setting is to append a space behind the commentLine character specified (in langs.xml file) according to language/file extensions. This would need to be raised as a bug (? not sure bug is the right word, the developer has probably just decided that’s the correct approach) on GitHub I think. I believe that’s where all these things are worked on, not on this forum.

          Terry

          W 1 Reply Last reply May 20, 2020, 2:16 AM Reply Quote 2
          • W
            Willy @Terry R
            last edited by May 20, 2020, 2:16 AM

            @Terry-R “my problem is that notepad++ always adds a space when I comment”

            So no matter what language I’m working on, I’ll use Ruby, C, C++, Assembler whatever and I don’t want the space when commenting, that’s it.

            I didn’t say Notepad++ was changing the “#” to “;” or anything like that, I just picked a language at random and it was Ruby, all languages have the comment character without the space in langs.xml so where should I go? Github?

            If I go to Github what I’d be asking is that they implement the function and obviously that takes time, I wanted something fast, maybe something I was ignoring.

            You insist that Github is my only option? If so, I’ll go to Github.

            1 Reply Last reply Reply Quote 0
            • T
              Terry R
              last edited by Terry R May 20, 2020, 2:23 AM May 20, 2020, 2:21 AM

              @Willy said in How to remove the space when commenting lines?:

              my problem is that notepad++ always adds a space when I comment

              And I agreed (after testing) with that statement. I’m also saying I don’t think it’s a bug. Consider what you are doing. You are entering a comment. Regardless of which language you code in comments are ALWAYS regarded as “free speech” (to my knowledge). I don’t see the issue with having a space before your “comments”. If indeed there is an issue then it can’t be a real comment, it would seem you are using this “code type” for other purposes, thus needing an exact format.

              You can look through various posts here (use search) for github to find the links, however as I say, consider what you are asking for. I doubt VERY much it would be considered a bug at all. I don’t see it anywhere in settings/preferences so it’s not overridable (to my knowledge).

              Terry

              W 1 Reply Last reply May 20, 2020, 2:26 AM Reply Quote 0
              • T
                Terry R
                last edited by May 20, 2020, 2:26 AM

                Actually, why not consider it a “feature request”.

                See:
                https://community.notepad-plus-plus.org/topic/15741/faq-desk-feature-request-or-bug-report

                Terry

                1 Reply Last reply Reply Quote 0
                • W
                  Willy @Terry R
                  last edited by May 20, 2020, 2:26 AM

                  @Terry-R No, I don’t consider it a error/bug, I just need that functionality, and yes, you are right that a comment is a comment and that space shouldn’t matter, it even seems a bit immature the request but the code already has that style in several lines and I can’t ruin the code with a different style, it wouldn’t be constant.

                  Use whatever style you want but be constant and don’t mix styles, I was taught that way.

                  1 Reply Last reply Reply Quote 0
                  • T
                    Terry R
                    last edited by May 20, 2020, 2:30 AM

                    @Willy said in How to remove the space when commenting lines?:

                    don’t mix styles

                    That’s a fair comment. Why not use a regex (regular expression) that you run as you do the final save of the file. It can remove that space at the start of the comment lines fairly easily. Otherwise go through ALL the old code and change them to suit the current format. That’s probably going to be the quickeest way to sort it out (short to medium term). Then ask for a feature request. It’s a valid request, but I don’t think it’s a valid bug.

                    Terry

                    W 1 Reply Last reply May 20, 2020, 2:40 AM Reply Quote 1
                    • W
                      Willy @Terry R
                      last edited by May 20, 2020, 2:40 AM

                      @Terry-R These are valid options and I did think of them, but I was hoping there was a way to configure notepad++ without doing anything, I’ll try my luck on Github and thanks for everything.

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