andriyko / sublime-robot-framework-assistant

Robot Framework plugin for Sublime Text3
MIT License
109 stars 43 forks source link

Using a different set of characters as cell separator #200

Open knight-corvi opened 6 years ago

knight-corvi commented 6 years ago

I currently use | as a separator (There is a space right after the | character) instead of the usual four spaces. As of now, it highlights everything in one single color. Unless I misunderstood the instruction, changing the value in Robot.tmLanguage didn't work for me. i.e. I'm trying to replicate the Pipe and space separated format as described in the RF docs.

Here is the content of the file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Robot Framework Preferences</string>
    <key>scope</key>
    <string>source.robot</string>
    <key>settings</key>
    <dict>
        <key>shellVariables</key>
        <array>
            <dict>
                <key>name</key>
                <string>RF_CELL</string>
                <key>value</key>
                <string><![CDATA[| ]]></string>
                <!-- <string><![CDATA[    ]]></string> -->
            </dict>
        </array>
    </dict>
    <key>uuid</key>
    <string>23650265-9dfb-4d5f-9ed0-0928ba59a796</string>
</dict>
</plist>
aaltat commented 6 years ago

I don't actively use and therefore I don't always remember to test pipe separated syntax. It very well might be that you have found a bug. But to fully understand your problem, would it be possible see a screen capture it example file which demonstrates the problem.

knight-corvi commented 6 years ago

Here is the code:

*** Settings ***
Library       OperatingSystem

*** Variables ***
${MESSAGE}    Hello, world!

*** Test Cases ***
My Test
    [Documentation]    Example test
    Log    ${MESSAGE}
    My Keyword    /tmp

Another Test
    Should Be Equal    ${MESSAGE}    Hello, world!

*** Keywords ***
My Keyword
    [Arguments]    ${path}
    Directory Should Exist    ${path}

# Using Pipe Space Syntax
| *Settings* |
| Library | OperatingSystem |

| *Variables* |
| ${MESSAGE} | Hello world |

| *Test Cases* |
| My Test |
|  | [Documentation] | Example test |
|  | Log | ${MESSAGE} |
|  | My Keyword | /tmp |

| Another Test |
|  | Should Be Equal | ${MESSAGE} | Hello world |

| *Keywords* |
| My Keyword |
|  | [Arguments] | ${path} |
|  | Directory Should Exist | ${path} |

and a screenshot: screen shot 2017-09-27 at 7 08 47 pm

aaltat commented 6 years ago

Ah, now I see. The problem is in the syntax highlighting definitions. Which is defined in here: https://github.com/andriyko/sublime-robot-framework-assistant/blob/master/Robot.YAML-tmLanguage and is the last definition in the file.

The keyword regexp is too aggressive at the moment and does not take in consideration the pipe separated format. The definitions are regexp and plain text files which everyone can edit. Would you be interested to find a fix and send a pull request? I am currently busy with SeleniumLibrary 3.0 release and I don't have time to investigate the problem deeper in the near future.

knight-corvi commented 6 years ago

Sure! I will look into it

On Wed, Sep 27, 2017 at 10:12 PM, Tatu Aalto notifications@github.com wrote:

Ah, now I see. The problem is in the syntax highlighting definitions. Which is defined in here: https://github.com/andriyko/ sublime-robot-framework-assistant/blob/master/Robot.YAML-tmLanguage and is the last definition in the file.

The keyword regexp is too aggressive at the moment and does not take in consideration the pipe separated format. The definitions are regexp and plain text files which everyone can edit. Would you be interested to find a fix and send a pull request? I am currently busy with SeleniumLibrary 3.0 release and I don't have time to investigate the problem deeper in the near future.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/andriyko/sublime-robot-framework-assistant/issues/200#issuecomment-332729486, or mute the thread https://github.com/notifications/unsubscribe-auth/ADS0WDLEkoUcjxyO07kLPNUL2OT0sV2yks5smyq5gaJpZM4PmGQv .

knight-corvi commented 6 years ago

n00b question: how do I go to test my changes? simply modifying the YAML-tmLanguage file doesn't seem to have any effect

aaltat commented 6 years ago

It could be that then it was this file, Sublime has strange syntax definition: https://github.com/andriyko/sublime-robot-framework-assistant/blob/master/Robot.tmLanguage

Also reboot of Sublime is needed

aaltat commented 6 years ago

Did you happen to solve the problem? If yes could perhaps provide pull request to solve the problem?

knight-corvi commented 6 years ago

Still working on it, I'm still fairly new to regex. So far, I have managed to get the Table keywords to get highlighted properly. I'm currently have problems delimiting the scope of some of the highlighting keywords. I will start working on it again in the next few days since I have been busy with at work.

aaltat commented 6 years ago

No worries, take your time. It's good that you had some progress on the matter.

Unfortunately I am not able to help you with the problem solving, because my time is spent on the SeleniumLibrary release 3.0.

knight-corvi commented 6 years ago

Alright, I will adding some of the changes to my fork within these days if anyone is interested

On Wed, Oct 11, 2017 at 1:17 AM, Tatu Aalto notifications@github.com wrote:

No worries, take your time. It's good that you had some progress on the matter.

Unfortunately I am not able to help you with the problem solving, because my time is spent on the SeleniumLibrary release 3.0.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/andriyko/sublime-robot-framework-assistant/issues/200#issuecomment-335727693, or mute the thread https://github.com/notifications/unsubscribe-auth/ADS0WJHjG4kIPZDYClIcvD_-DF6jLvGwks5srHmIgaJpZM4PmGQv .

aaltat commented 6 years ago

Could you send a pull request? It doesn't have to fully ready but it would be nice to see the changes.

pavoltravnik commented 6 years ago

Could be also nice to have fixed highlighting if somebody use TABs instead of spaces.

aaltat commented 6 years ago

@pavoltravnik please raise an separate issue about the tab support.