Page 1 of 2

Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Fri May 06, 2016 7:32 am
by Antonio Linares
Look for *.tmLanguage in c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\
and you will find the required below randomName. You may find some different ones. Try all them.

c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\<randomName>\Starterkit\Extensions\

If so, I have found that creating a Harbour folder there, with this structure:

Harbour
+ Syntaxes

and placing there this file:
https://bitbucket.org/fivetech/fivewin-contributions/downloads/Harbour.tmLanguage
then we have automatic syntax coloring for PRG files.

That file was originally created and published by Rafa Carmona:
https://github.com/rafathefull/harbour/blob/master/Harbour.tmLanguage
but there are some sections that are not fine for Visual Studio, thats why I have modified it.

All credits to Rafa! :-)

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Fri May 06, 2016 9:35 am
by Antonio Linares
Simplified version with better colors support

Download Harbour.tmLanguage again from here:
https://bitbucket.org/fivetech/fivewin-contributions/downloads/Harbour.tmLanguage

Image

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Fri May 06, 2016 10:18 am
by Antonio Linares
These are the different colors that I have identified:

storage.type.harbour BLUE
keyword.other.harbour BLUE

constant.other.harbour RED

constant.numeric.harbour LIGHT_BLUE

keyword.control.harbour PURPLE

comment.line.double-slash.harbour GREEN

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Fri May 06, 2016 10:31 am
by Antonio Linares
You can try using different colors:

Harbour.tmLanguage
Code: Select all  Expand view
<?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>fileTypes</key>
    <array>
        <string>prg</string>
        <string>ch</string>
    </array>
    <key>name</key>
    <string>Harbour</string>
    <key>patterns</key>
    <array>
        <dict>
            <key>comment</key>
            <string>n�s</string>
            <key>match</key>
            <string>\b(((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?))</string>
            <key>name</key>
            <string>constant.numeric.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>cadenas comillas simples</string>
            <key>match</key>
            <string>'[^']*'</string>
            <key>name</key>
            <string>string.quoted.single.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>cadenas comillas dobles</string>
            <key>match</key>
            <string>("[^"]*")</string>
            <key>name</key>
            <string>string.quoted.double.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>sentencias de control</string>
            <key>match</key>
            <string>(?i)\b(?:do|case|class|endclass|data|method|init|endcase|otherwise|switch|if|else|elseif|endif|while|end|enddo|exit|static function|function|return|for|next|stdout|ifndef)\b</string>
            <key>name</key>
            <string>keyword.control.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>operadores</string>
            <key>match</key>
            <string>(?i)\b(?:and|or|not|!)\b</string>
            <key>name</key>
            <string>keyword.other.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>declaraciones</string>
            <key>match</key>
            <string>(?i)\b(?:local|nil|default|field|static|public|static|external|request|private|global)\b</string>
            <key>name</key>
            <string>storage.type.harbour</string>
        </dict>
        <dict>
            <key>begin</key>
            <string>/\*</string>
            <key>captures</key>
            <dict>
                <key>0</key>
                <dict>
                    <key>name</key>
                    <string>punctuation.definition.comment.harbour</string>
                </dict>
            </dict>
            <key>comment</key>
            <string>in-line comment with /* */</string>
            <key>end</key>
            <string>\*/</string>
            <key>name</key>
            <string>comment.block.harbour</string>
        </dict>
    <dict>
      <key>comment</key>
            <string>in-line comment with //</string>
            <key>match</key>
            <string>(//).*?($\n?|(?=\?&gt;))</string>
            <key>name</key>
            <string>constant.other.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>definicion de constantes caracter</string>
            <key>match</key>
            <string>(?i)\b(?:include|ifdef|ifndef)</string>
            <key>name</key>
            <string>variable.language.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>boolean</string>
            <key>match</key>
            <string>(?i)(\.(t|f)\.)</string>
            <key>name</key>
            <string>constant.numeric.harbour</string>
        </dict>
        <dict>
            <key>comment</key>
            <string>BOOLEAN</string>
            <key>match</key>
      <string>(?i)(\.(T|F)\.)</string>
      <key>name</key>
            <string>constant.numeric.harbour</string>
        </dict>
        <dict>
      <key>comment</key>
      <string>FiveWin support</string>
      <key>match</key>
            <string>(?i)\b(?:define|window|dialog|activate|centered)\b</string>
      <key>name</key>
            <string>comment.line.double-slash.harbour</string>
        </dict>
        <dict>
            <key>match</key>
            <string>\:</string>
            <key>name</key>
            <string>constant.literal.harbour</string>
        </dict>
        <dict>
            <key>match</key>
      <string>(\:)|(\[)|(\])|(\()|(\))|(\{)|(\})</string>
            <key>name</key>
            <string>storage.type.harbour</string>
        </dict>
    </array>
    <key>scopeName</key>
    <string>source.harbour</string>
    <key>uuid</key>
    <string>56571807-d94d-4805-bbfc-87d347d189e4</string>
</dict>
</plist>


Image

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Mon May 16, 2016 10:28 pm
by TimStone
Actually, I just set VS to open the .prg files in UE Studio. I have the project open and VS open. I can click on either side and it opens the file in VS with all of its capabilities. It does work out fine.

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Mon May 16, 2016 10:55 pm
by Antonio Linares
Tim,

The Visual Studio built in source code editor is very good and now it works great with Harbour syntax too

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Mon May 16, 2016 11:21 pm
by TimStone
I looked at the instructions and looked for the place to store that file ( VS 2015 ) and could not find it. Did you simply create a Harbour folder under the Extensions subfolder, or did you select one of the random names and put it there ?

I did create an ..\extensions\harbour\syntax folder, placed it there, and then tried to see if it would apply. I can't find how to specify that it should use that file.

Also, your file is for Apple ... and we use Windows on a regular PC. Does that make a difference ?

Tim

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue May 17, 2016 8:34 am
by Antonio Linares
Tim,

Look for *.tmLanguage in c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\
and you will find the required below randomName. You may find some different ones. Try all them.


tmLanguage stands for TextMate language and it is the same format that SublimeText editor uses. I guess that
this started in Apple and still they use an Apple plist file format (it is a renamed XML file. You can use Visual
Studio to edit it).

Mine looks like this. Yours will have a different "random" name (1kztsa3m.wi0) folder:

c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\1kztsa3m.wi0\Starterkit\Extensions\Harbour\Syntaxes\Harbour.tmLanguage

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue May 17, 2016 3:32 pm
by TimStone
I have a long list of random names. Where can I find the proper one for the project ?

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue May 17, 2016 4:20 pm
by Antonio Linares
Tim,

Look for *.tmLanguage in those folders and you will find the right folders

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue May 17, 2016 4:23 pm
by TimStone
I did that yesterday and there were about 30 defined in different folders with random names. None of them are the obviously correct one.

What identifies the proper folder for this project ? Can I find the random name in the IDE ?

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue May 17, 2016 5:03 pm
by Antonio Linares
In my Visual Studio installation there were three folders that contained *.tmLanguage files

I tried it in each of them, and in one of them, once you exit from Visual Studio and start it again, it worked fine

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue May 17, 2016 7:27 pm
by TimStone
I have 5 folders. I've put it in each of them with no success.

Each of those folders has many options for programming languages.

Where in the IDE do you setup so it knows it is to use the Harbour file you installed ? I don't recall any place where we setup Harbour as a language within Visual Studio.

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue May 17, 2016 7:29 pm
by Antonio Linares
Tim,

Lets have a TeamViewer session

Re: Visual Studio Community 2015 PRGs/CHs syntax coloring

PostPosted: Tue Jul 26, 2016 7:35 pm
by vilian
Antônio,

I have the same problem that Tim. I found two directories with *.tmlanguages and saved Harbour files in both, but i can't see colors highlight on Visual C editor. What else i need to do?