madskristensen / TextmateBundleInstaller

A Visual Studio extension
Other
68 stars 23 forks source link

Missing support for .mq4 files #560

Open LorneCash opened 4 years ago

LorneCash commented 4 years ago

File Types: should include .mq4, .mql4, .mq5, and .mqh MetaTrader 4 is the largest forex trading platform in the world. It's language is very similar to C++. MQL4 Documentation - https://docs.mql4.com/ MQL5 Documentation - https://www.mql5.com/en/docs Parent Company - https://www.metaquotes.net/

Someone on GitHub made an MQL4.tmLanguage file here however, I found few problems with this.

  1. The xml has a syntax error (easily fixed)
  2. The code folding defined in *.tmLanguage files appears to have no affect in VS
  3. The snippets are for Sublime Text

To Resolve these issues:

  1. I submitted a pull request for this fix from my cloned repo.
  2. From my testing is seems that the code folding defined in the *.tmLanguage file is completely ignored by visual studio so I left it as is although I would like to see it more like C# if that were an option.
  3. Although I was able to find a Sublime to VS Code converter on GitHub, I was not able to get any snippets working in Visual Studio manually or otherwise. I created this StackOverflow question regarding this issue because I've haven't found anything on the subject that could help:
LorneCash commented 4 years ago

@madskristensen Can you help me understand why I can't get a snippet to work for this language? I posted my question on Stack Overflow so maybe just leave a note there. I'm asuming I'm not wrong in that it should be possible to get snippets working for non-supported languages. I've attached the files that I believe should work here. Any help would be greatly appreciated. mq4.zip

I would be more than willing to do any laborious work myself and create a pull request if I could understand how to get snippets working.

madskristensen commented 4 years ago

Those snippets i think are VS Code snippets and not Textmate syntax. See this example:

<?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>bundleUUID</key>
    <string>465b9420-4438-4dfc-9c97-4939c581ef3c</string>
    <key>content</key>
    <string>; Replace "JavaScript" with any of the supported languages
; Languages: "Basic", "C/C++", "CSharp", "CSS", "HTML", "JavaScript", "SQL_SSDT", "XML"
[\$RootKey\$\\Languages\\CodeExpansions\\JavaScript\\Paths]
"Awesome"="\$PackageFolder\$\\Awesome"$0
    </string>
    <key>tabTrigger</key>
    <string>lisa</string>
    <key>name</key>
    <string>Comment Heading</string>
    <key>scope</key>
    <string>source.pkgdef</string>
    <key>uuid</key>
    <string>3ed0c5d5-fad7-4bae-a8a1-889969c56ba9</string>
  </dict>
</plist>

Make sure the scope name match with your .tmLanguage

LorneCash commented 4 years ago

@madskristensen Still having trouble. I created a file called MyTest.plist in C:\Users\<user>\.vs\Extensions\mq4\Snippets\. Here's the snippet I'm trying:

<?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>bundleUUID</key>
        <string>2e4df8f9-23a2-4202-8bf2-646d03c86ef1</string>
        <key>content</key>
        <string>ObjectSet( ${1:str name}, ${2:int index}, ${3:dbl value} )${0}</string>
        <key>tabTrigger</key>
        <string>objectset</string>
        <key>name</key>
        <string>ObjectSet</string>
        <key>scope</key>
        <string>source.mq4</string>
        <key>uuid</key>
        <string>b927e440-7ee4-479d-b7eb-8d575cf197b9</string>
    </dict>
</plist>

In my .tmLanguage file I have this so I believe my scope does match: (.tmLanguage file is included in zip file from my previous post) `

scopeName
<string>source.mq4</string>

`

I generated new GUIDs for bundleUUID and uuid and

I'm having trouble finding documentation specific to Visual Studio and textMate. If you have any resources please share the link.

This is the best link I found but it's for Mac not Visual Studio so I'm not sure what differences might apply. https://macromates.com/manual/en/

I also found another of your extensions "Textmate Grammar Template" which contained a link to this github project: https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/TextmateGrammar but no help with snippets there either