vscode-abap icon indicating copy to clipboard operation
vscode-abap copied to clipboard

Syntax highlighting seems broken

Open Chris2011 opened this issue 3 years ago • 3 comments

I'm adding basic syntax highlighting for ABAP via your textmate lexer to Apache NetBeans. I figured out a problem with this example https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abengame_2048_abexa.htm. It seems that the ending of a string is not correct, or maybe the example is wrong? The screenshot shows how it looks like. You can also test it in VS Code. It is the same problem.

image

As you an see at line 77 until the end, everything seems to be inside of the string. Sometimes inside of the string, not everything is captured as a string, but most of it. So I think this is not correct. If yes, please correct me :)

Chris2011 avatar Jul 28 '21 17:07 Chris2011

yea, its a bug in syntax highlighting

pull requests welcome

I'm planning to add https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide via the abaplint extension sometime

larshp avatar Jul 28 '21 18:07 larshp

despite some improvements to interpolated strings this is still broken

header = REDUCE string( ##NO_TEXT
      LET  w = 360 / n IN
      INIT h =
        `<html><head><style type="text/css">` &
        `.t0{background-color:#cbbdb0}` &
        `td{border:1px solid bbada0;color:#776e65` &
        `;text-align:center;vertical-align:center` &
        `;font-family:'Century Gothic',sans-serif;font-weight:bold` &&
        |;width:{ w }px;height:{ w }px;font-size:{ w / 2 }px\}|
      FOR i = 1 UNTIL i > 11
      NEXT h =
        |{ h }.t{ ipow( base = 2 exp = i ) }\{| &
        |background-color:#{ segment( val   = tile_colors
                                      index = i ) }| &
        |{ COND #( WHEN i >= 3  THEN `;color:#f9f6f2` ) }| &
        |{ COND #( WHEN i >= 10 THEN |;font-size:{ w / 4 }px|
                   WHEN i >= 7  THEN |;font-size:{ w / 3 }px| ) }\}| ).
    header = header &&  `div{text-align:center}</style><script type="text/javascript">` &
     `function okd(e)` &
     `{c=window.event.keyCode;window.location='sapevent:'+c;}` &
     `document.onkeydown = okd;</script></head> <body scroll=no ` &
     `style="background-color:#bbada0;color:white;font-size:20pt">`.
    SET HANDLER at_click.

FreHu avatar Nov 05 '21 18:11 FreHu

How to add custom highlighting for the "@" character in escaped host variables? I can't seem to find any way to make it work via the editor.tokenColorCustomizations section of the settings.json

TheLazyHangman avatar Sep 12 '23 13:09 TheLazyHangman