Community
    • Login

    With User Defined Languages, Can Comments be Limited to Beginning of Line?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 846 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.
    • Geoffrey OdhnerG
      Geoffrey Odhner
      last edited by

      When creating a user defined language, defining the comment style, there is a selection for “Line comment position” to “Force at beginning of line”, but it doesn’t force the comments to be placed at the beginning of the line as one might expect. Instead they are placed at the first word on the line, after the white space, despite the fact that I haven’t selected the alternate option “Allow preceding white space”. This seems as if the option is a meaningless option when defining the language! Ideally I should be able to define two different types of comments, one which is constrained to the beginnings of lines, and another which is not, but as it is, I am unable to define any that is constrained.

      Is there anyone who knows the language definition system who can help me with this conundrum? Thanks in advance for you help.

      Best regards,

      Geoff Odhner

      Meta ChuhM 1 Reply Last reply Reply Quote 0
      • Meta ChuhM
        Meta Chuh moderator @Geoffrey Odhner
        last edited by Meta Chuh

        @Geoffrey-Odhner

        welcome to the notepad++ community

        the line comment option “force at beginning of line” refers to the comment marker (delimiter), not to the comment itself.

        here’s a screenshot with a little example of what will and what won’t be interpreted as a comment if you use it. (comments are highlighted in green)

        alt

        you are correct about the global meaning of this setting, it is not possible to set one line comment delimiter string that will work everywhere and another one that’s only valid at the beginning of a line.
        the only workaround i know of is to use a comment line setting restricted to the beginning of the line and a block comment, which you could use everywhere, but which has to have separate open and close delimiters like /* and */ as they don’t end automatically at the break of a line

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