karatelabs / vscode-extension

Karate Visual Studio Code Extension
https://marketplace.visualstudio.com/items?itemName=karatelabs.karate
9 stars 1 forks source link

Angular brackets (< >) break syntax highlighting #19

Closed gitgc closed 8 months ago

gitgc commented 11 months ago

This is the exact same problem that was raised in issue 13 (and closed without a fix) - if angular brackets are used to evaluate a value (e.g. call a method instead of print the method name), the syntax highlighting stops working. Remove the angular brackets, it works again.

Please excuse the weird example below, I've had to anonymize our real tests to post this bug, but pasting these examples into VSCode with the latest version of the Karate plugin will reproduce.

Example with angular brackets that breaks syntax highlighting:

Feature:

  Background:
    * url someUrl
    * def dg = call read('classpath:com/DataGenerator.feature')

  Scenario Outline: 
    Given def something = somethingElse
    And somethingElse.a = <a>
    And somethingElse.b = <b>

  Examples:
    | testSubject          | a             | b                 |
    | dg.newSubject()      | dg.method1()  | dg.method2()      |

Removing the angular brackets will fix the syntax highlighting, but code no longer works as it will not call the methods:

Feature:

  Background:
    * url someUrl
    * def dg = call read('classpath:com/DataGenerator.feature')

  Scenario Outline: 
    Given def something = somethingElse
    And somethingElse.a = a
    And somethingElse.b = b

  Examples:
    | testSubject          | a             | b                 |
    | dg.newSubject()      | dg.method1()  | dg.method2()      |

Not working with angular brackets: Screenshot 2023-12-15 at 4 13 00 PM

Working with angular brackets removed, but code won't work now - it will just print the name of the method as if it was a string example, instead of calling the function. Screenshot 2023-12-15 at 4 14 25 PM

ptrthomas commented 8 months ago

should be fixed in latest version. while not perfect at least it won't break the rest of the file.