Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Notepad++ 6.2 released!

Don HO
2012-10-09
2015-05-04
<< < 1 .. 6 7 8 (Page 8 of 8)
  • P1h3r1e3d13
    P1h3r1e3d13
    2014-07-02

    Hi Loreia,

    I'm having some trouble with nesting two delimiters when one contains the other. Specifically, MediaWiki's ''' and '' markup for bold and italic.

    Here's my configuration:

    • Delimiter 5:
      • Open & close: ''' (triple has to come before double, otherwise it will never catch)
      • Style: bold
      • Nesting: 5 & 6
    • Delimiter 6:
      • Open & close: ''
      • Style: italic
      • Nesting: 5 & 6

    Here's my test string:
    regular''italic'''boldanditalic'''italic'''regular

    In a wiki, the text style would be what it says in each place:

    regularitalicboldanditalicitalicregular

    (In N++, I expect the “boldanditalic” part will just be bold, but that's fine.)
    The problem is that the first two characters of ''' are closing the '' section, so I get:

    regular''italic'''boldanditalic'''italic''regular

    Do you have any tips for a more robust setup of these delimiters? Or should closing delimiters only be matched on a backward search to make this work?

    (This would also apply to markdown's ** and * syntax, which I ironically had to use to write my examples above.)

    Thanks for such a helpful addition!
    –Jack

     
  • Loreia2
    Loreia2
    2014-07-03

    Hi Jack,

    this is a tough problem. UDL's delimiter handling logic is:

    if in delimiter, check forward type keywords in this order:
    1) escape sequence
    2) line continuation sequence
    3) end of delimiter sequence
    4) nested operator and delimiter start sequence

    MediaWiki syntax breaks this logic because delimiter start and end sequence overlap. There is no way to make this work in current UDL version.

    UDL3.0 will support control of whitespace around delimiter open and close sequences, which should be enough in this case, but I wonder if I should extend this functionality?

    Anyway, in UDL3.0 if you define "start" and "end" as delimiter start and end sequences, than UDL3.0 will allow you to define whether X,Y,W,Z must or must not be whitespace:

    XstartY  .... delimiter body .... WendZ
    

    Perhaps in UDL3.1 I could allow users to define X,Y,W,Z as a list of strings? We'll see if such functionality is needed.

    Regards,
    Loreia

     
  • Piet the Elder
    Piet the Elder
    2015-01-22

    Hi,

    The UDL is really useful, and I have been using it for months now.
    But, only this week have I attempted to add code folding, and have found this bizarre occurrence where it starts for fold lines that don't match the deliminaters -- or it misses valid deliminaters completely.

    I have attached a screen shot example, that also shows my set-up in "Folding 2" -- changing to "folding 1" doesn't help much either. Neither does removing the "#ifdef" -- nor removing the " marks.

    NPP is the "Je suis Charlie" edition -- Jan 10, 2015 build

    Any ideas for this would be appreciated.

    Thanks,

    PtE
    
     
    • Piet the Elder
      Piet the Elder
      2015-01-22

      My apologies, I have since found the error causing the problem.

      In my single line comments definition, I had placed ((EOL)) in the "close" -- removing this fixed the folding.

       
  • Loreia2
    Loreia2
    2015-01-22

    Hi Piet,

    that is a known bug that will be fixed in next version (3.0), in the mean time, you can use an older version available here: http://goo.gl/Bo3emS

    Best regards,
    Loreia

     
    Last edit: Loreia2 2015-01-22
  • James Benson
    James Benson
    2015-01-27

    I'm having trouble with UDL not recognizing the following character as a word boundary:
    http://www.unicodelookup.com/#%E3%80%80/1

    Can support for this be added?

     
  • Loreia2
    Loreia2
    2015-01-27

    Hi James,

    words are delimited by whitespace (in UTF-8 any character < 32). Changing this functionality would require rewrite of entire UDL. I think more elegant solution would be to define "IDEOGRAPHIC SPACE" character as Operator1 type. In this way it automatically becomes a word boundary.

    Best regards,
    Loreia

     
  • slateraptor
    slateraptor
    2015-02-20

    Hi Loreia,

    I'm attempting to create a UDL for a language called C/ATLAS (unfortunately, not in the UDL List) but I'm running into show-stopper issues due to the language's quirky syntax.

    For example, a comment is valid iff C is the first character of a line, and uses the same closing delimiter $ as regular statements.

    C       THIS IS A VALID SINGLE-LINE COMMENT $
    
    C
            ****************************************************************
            * THIS IS A VALID MULTI-LINE COMMENT
            ****************************************************************
            $
    
     C      THIS IS NOT A VALID COMMENT $
    
     000001 BEGIN, ATLAS PROGRAM 'EXAMPLE' $
         05 INCLUDE, ATLAS MODULE 'STDPROC' $
    

    Observe that the first column of any line outside of a comment is treated special; indeed, the first 7 characters of any statement is special. If I set comment style Open=C and Close=$ then the above comments will highlight correctly, however, the C in INCLUDE (or any instance of C that doesn't fall within a defined delimiter) will undesirably mark everything to the next $ as comment.

    Is there a solution around this? If not, would it be possible support a feature that constrains a delimiter to beginning of line?

    Thanks for your contributions to the community! ^^

     
  • slateraptor
    slateraptor
    2015-02-20

    Just wanted to create a separate post for a wishlist item.

    Being able to highlight numbers and units independently would be immensely useful. Consider the following:

    CASE1: 12 VDC
    CASE2: -12VDC
    

    CASE1 is inherent by listing units keywords and controlling color with its group styler. Caveat is that for at least certain human-readable languages, the same keywords can be functionally different depending on context. Pseudo-example:

    FORMAT BNR 1 WORD, UNSIGNED $ // units
    WORD = 32 BITS $              // not units
    

    CASE2 isn't quite as flexible by using number style suffix. Independent units color control is consequently lost. This limitation also manifests in keyword prefix mode.

    Having independent control number style prefix/suffix and keyword appendages when prefix mode is set would be immensely useful.

    Just a suggestion, and thanks again for your contributions. ^^

     
  • Loreia2
    Loreia2
    2015-02-20

    Hi slateraptor,

    Is there a solution around this? If not, would it be possible support a feature that constrains a delimiter to beginning of line?

    Actually, this is already implemented in UDL3 (which is still being developed). So, you can only wait until I release UDL3.0 because current UDL2.X series does not support this option.

    Having independent control number style prefix/suffix and keyword appendages when prefix mode is set would be immensely useful.

    Keyword prefix/suffix option has also already been implemented in UDL3. But if I understand correctly, you would like to set prefix/suffix mode only on keywords that are preceded/followed by a number. This is not possible.

    Best regards,
    Loreia

     
    • slateraptor
      slateraptor
      2015-02-24

      Thanks for your response, Loreia.

      But if I understand correctly, you would like to set prefix/suffix mode only on keywords that are preceded/followed by a number.

      Understood. It was worth the inquiry. ^^

      Just to clarify, and as it stands in v2.x, if VDC were listed as a valid Number suffix, then the whole context would be highlighted, e.g.
      -12V
      20mA
      100DegC

      What would be very useful is the ability to clearly disambiguate context by independently controlling the color of a number and its prefix/suffix, e.g.
      -12V
      20mA
      100DegC

      Would this be viable as a v3.0 wishlist item?

       
  • Loreia2
    Loreia2
    2015-02-24

    Hi slateraptor,

    What would be very useful is the ability to clearly disambiguate context by independently controlling the color of a number and its prefix/suffix, e.g.
    -12V
    20mA
    100DegC
    Would this be viable as a v3.0 wishlist item?

    Not in 3.0 cycle, it has been dragging on endlessly, and I would like to focus on releasing it. New features are possible only if they are minor. Numbers are one area that I would like to skip in UDL 3.0 cycle. In fact it is the only part of code that went almost untouched in 3.0 development.
    I plan to rework numbers in 3.x phase, until then they will remain as they are.

    But generally speaking, this sounds like a good feature. I like it.

    Best regards,
    Loreia

     
  • slateraptor
    slateraptor
    2015-03-11

    Greets Loreia,

    Was wondering if there was a particular Npp version that you were planning to align UDL 3.0's release with? Admittedly had an excitement false alarm with v6.7.5's release earlier today. =P

     
  • Loreia2
    Loreia2
    2015-03-11

    Hi slateraptor,

    these days I am working from 8h to 20h each day on my regular job, UDL stuff is hardly moving forward. Few lines here and there over the weekend, but that is it. It will be like this at least few more weeks.

    When I get back to UDL, and make something presentable, I will first open a new thread on forum for beta testers and early adopters. Subscribe to this thread and you will get a notification about it.

    And only when beta testing is done, and application is stable, and feature list is definitely set, only then UDL can be integrated with current version of Notepad++.
    There is no date set, it all depends on my free time.

    Best regards,
    Loreia

     
  • Chris Dyer
    Chris Dyer
    2015-04-29

    Hi Loreia,

    I am attempting to write a UDL for an in house scripting language we use at my company.
    I am having a little trouble trying to get block comments to work, which may well be unachievable with UDL but I thought I'd ask.

    Our functions are of the form

    (operator argument1 argument2)
    

    where each argument may also be a nested function. i.e.

    (operator1 (operator2 argument1) argument2)
    

    These may also flow over multiple lines

    (operator1
        (operator2 argument1)
        argument2
    )
    

    Comments are basically another operator using ! of the form (! this is a comment)

    My issue comes in where I want to block comment out a whole section.
    As the comment closing character is the same as any other function closing character ")"
    the first hit of of a closing parenthesis ends the comment.

    (! (commented_operator1
        (operator2 argument1) ## Comment ends here
        argument2
    ))  ## Comment should end here
    

    I guess I would need something similar to how our parser works and essentially ignore one closing parenthesis for each opening parenthesis within the comment. Unless there is a combination of the current functionality that would work?
    Any thoughts?

    Cheers,
    Chris

     
  • Loreia2
    Loreia2
    2015-04-29

    Hi Chris,

    If we look at your last code sample, does the comment start at exclamation mark or at first brace? If it is the exclamation mark, set UDL like this:

    1. Delimiter1:
      Open: !
      Close: )
      Allow nesting of Delimiter2

    2. Delimiter2:
      Open: (
      Close: )
      Allow nesting of Delimiter1

    Problem here is that Delimiter2 sticks out of Delimiter1 (presuming they have different style). So I would advice to define also Delimiter3 identical in definition to Delimiter2, but with coloring style of Delimiter1, and to set Delimiter1 to nest Delimiter3 only. In this way entire comment will look like one solid block of code.

    Is that good enough?

    Best regards,
    Loreia

     
    • Chris Dyer
      Chris Dyer
      2015-04-30

      Hi Loreia,
      Thanks for your speedy response!

      Theoretically, the comment starts at the first brace, but it would be acceptable to go from the '!'.

      I did try a few different combinations and orders of your suggestion but couldn't quite get it functioning for all use cases which are probably a little more complex than my examples.

      I originally had braces '(' and ')' set up as operators as I didn't want to highlight everything between (could go either way here), and I also have situations where there is no whitespace between a keyword and a brace, which was causing issues where I have a prefix mode keyword using '$'.
      We can define functions as per example

      (define function_name $argument1 $argument2
        (+ $argument1 $argument2)
      )
      

      Here, the second keyword use $argument2 includes the ending brace unless I have it as an operator.

      I can't seem to nesting to work with the correct precedence with multiple instances of the same delimiter. I thought I almost had it at one stage but it seems to be messing with the brace matching and I don't end up with the expected results (my brace highlighting gets confused and can't find the matching brace until I disable the delimiters).

      The syntax might just be a little awkward to try to match.
      Cheers again for the suggestions!
      Chris

       
  • Loreia2
    Loreia2
    2015-04-30

    Hi Chris,

    can you write here all the corner cases so I could see if there is a way to "twist" UDL enough to highčight correctly your language.

    Best regards,
    Loreia

     
    • Chris Dyer
      Chris Dyer
      2015-05-01

      Hi Loreia,
      While attempting to create a test version of a file to post I did end up managing to get something that seems to work in all the cases I have come across so far.
      I did end up basically using you original method you posted, but with the first comment delimiter as (! which fixed all my brace matching and seemed to make the rest of the settings work.
      It was pretty late when I was playing around with it :)

      The only issue I ran into after that was the numbers were being highlighted when they formed part of a function name like

      (define get-switch2 .....)
      

      which would highlight the 2 as a number.

      I managed to get around this by adding all my numbers as a keyword in prefix mode.
      And then only nest the keyword instead of numbers in my () delimiter.
      I thought it might potentially be nice to have an option to force numbers to require a preceding whitespace to highlight (excluding the specified prefixes of course).
      But that may not make any sense.

      Hopefully I don't hit any more snags now, I'll wait until someone finds another edge case :)
      Thanks again,
      You have been very helpful!
      Chris

       
  • Loreia2
    Loreia2
    2015-05-04

    Hi Chris,

    numbers should not be highlighted when part of a string. This looks like a bug. Can you share your userDefine.xml file, I'd like to inspect this?

    Best regards,
    Loreia

     
  • Chris Dyer
    Chris Dyer
    2015-05-04

    Sure, I have attached the xml and some test script.

    This is currently set up with the workaround? to work for numbers.

    To remove this, Switch Delimiter 3 to Nest Numbers instead of Keyword 7.

    With this done, you should see get-mir1 will highlight the 1 as a number and the rest of the string as per Delimiter 3.

    Cheers,
    Chris

     
<< < 1 .. 6 7 8 (Page 8 of 8)