Oni: Help wanted trying to get ColdFusion Textmate Grammar to work

Created on 5 Apr 2018  Β·  6Comments  Β·  Source: onivim/oni

Hi,

I'm playing around trying to get the ColdFusion textmate bundle to work (NB: I'm aware this isn't the latest and greatest CF textmate grammar, there's a better one for VSCode but I couldn't get it working either so fell back to this one): https://github.com/textmate/coldfusion.tmbundle

Here's my oni config:

const activate = (oni) => {
};

module.exports = {
    "editor.fontSize": "14px",
    "editor.fontFamily": "Consolas",
    "oni.useDefaultConfig": true,
    "editor.textMateHighlighting.enabled": true,
    "language.cf.textMateGrammar": "D:/AMyers/dev/coldfusion.tmbundle/Syntaxes/ColdFusion.tmLanguage",
    "editor.textMateHighlighting.debugScopes": true,
    "editor.completions.enabled": true
}

Unfortunately when I load a cfm file it seems to not use the textmate grammar and loads the built in cf.vim syntax.

If I open a file with the .cfml extension, the debug message is:

`` [LanguageManager::_onBufferEnter] Setting language for file C:UsersAMyersDesktoptest.cfml to image

test.cfml file content is:

<cfoutput>
    #now()#
</cfoutput>

I'm not sure if this might be a windows path specific issue or not - I've tried backslashes, escaped backslashes all to no avail. Any other suggestions please?

bug

Most helpful comment

@am2605 @CrossR I think the required file type for textmate grammars is JSON - @bryphe I believe left a comment in the textmate json files in oni which say

Actually, we use the parser from VSCode - https://github.com/Microsoft/vscode-textmate - so we should support any format they support, too πŸ‘

@CrossR - thanks for trying it out! The screenshot / investigation you shared helps a lot - it looks like there is a bug where if the filetype is not set, we fall back to image. In this case, we're not recognizing the cfml file as a cf filetype.

IMO, the _ideal_ flow for this is you could just install the vscode-coldfusion plugin in Oni, and we'd pick up the stuff we can handle today - like the syntax files and everything! Unfortunately there are some quirks in that right now that block that from working (but it would be super cool if we could at least leverage parts of VSCode plugins). I hope we can get there and make that painless! πŸ‘ We could even communicate via the plugin sidebar which capabilities were able to load, and which we were not....

Anyway, I was able to get this working with a few steps:
image

(Note the cf filetype at the bottom)

1) Modify your __init.vim__ and add the following line:

au BufNewFile,BufRead *.cfml set filetype=cf

This fixes the issue we had where the filetype was being set to image by explicitly setting it as soon as Vim loads the file. Ideally, if we could understand the vscode plugin, you wouldn't need to do this (it has the same info in its manifest) - but for the time being, this will get things set. I prefer if users don't __need__ to go to their init.vim to customize πŸ˜„

2) Point to the CF grammar in your Oni config:
"language.cf.textMateGrammar": "E:/cfml.tmLanguage",

(I used the VSCode grammar - but I think you already have this part set, @am2605 )

3) Restart Oni

4) Open the coldfusion file

If it worked, you should see cf as the file type and get the syntax highlighting. I also enabled the editor.textMateHighlighting.debugScopes flag to true to make sure I was getting the highlighting from textmate.

Hope that helps, and hope we can streamline this soon πŸ‘ Let me know if you have questions with any of the steps, @am2605

All 6 comments

@am2605 You might find it easier to use the vim syntax highlighting, see: https://github.com/ernstvanderlinden/vim-coldfusion and https://github.com/onivim/oni/issues/2030.

[LanguageManager::_onBufferEnter] Setting language for file C:\Users\AMyers\Desktop\test.cfml to image implies something similar to #1673 I think....
That is, the file is not being recognised as cf and loading that grammar, it is instead being recognised as an image.

I've given it a try and set the grammar you mentioned to load for image instead and I go from:
image
image

Using:

    "language.image.textMateGrammar": "E:\\User Files\\Downloads\\ColdFusion.tmLanguage"

So I think we can safely say its being loaded as an image...Not 100% why though.

Whoa, that’s interesting! Thanks.

On Thu, 5 Apr 2018 at 9:08 pm, Ryan C notifications@github.com wrote:

[LanguageManager::_onBufferEnter] Setting language for file
C:UsersAMyersDesktoptest.cfml to image implies something similar to

1673 https://github.com/onivim/oni/issues/1673 I think....

That is, the file is not being recognised as cf and loading that grammar,
it is instead being recognised as an image.

I've given it a try and set the grammar you mentioned to load for image
instead and I go from:
[image: image]
https://user-images.githubusercontent.com/10038688/38362670-9af8961c-38c9-11e8-89a6-b51dc818f3ae.png
[image: image]
https://user-images.githubusercontent.com/10038688/38362743-db4c35c0-38c9-11e8-8226-3ce7c3c8bdbc.png

Using:

"language.image.textMateGrammar": "E:\\User Files\\Downloads\\ColdFusion.tmLanguage"

So I think we can safely say its being loaded as an image...Not 100% why
though.

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/onivim/oni/issues/2038#issuecomment-378900251, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAHUqZXq1pTzYX--oIAP_CLqTAUI3fh5ks5tlfs2gaJpZM4TIPAg
.

>

Sent from Gmail Mobile

Thanks - I’m aware of the excellent vim language support but I was
specifically interested in getting the TextMate one working, since most of
the coldfusion community effort seems to be going into the VSCode plugin.

On Thu, 5 Apr 2018 at 9:05 pm, Amadeus Folego notifications@github.com
wrote:

@am2605 https://github.com/am2605 You might find it easier to use the
vim syntax highlighting, see:
https://github.com/ernstvanderlinden/vim-coldfusion and #2030
https://github.com/onivim/oni/issues/2030.

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/onivim/oni/issues/2038#issuecomment-378899568, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAHUqRv349GM1OZ0e-v3qxKcxgiMc42Aks5tlfqBgaJpZM4TIPAg
.

>

Sent from Gmail Mobile

@am2605 @CrossR I think the required file type for textmate grammars is JSON - @bryphe I believe left a comment in the textmate json files in oni which say

"This file has been converted from https://github.com/atom/language-css/blob/master/grammars/css.cson",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."

@am2605 @CrossR I think the required file type for textmate grammars is JSON - @bryphe I believe left a comment in the textmate json files in oni which say

Actually, we use the parser from VSCode - https://github.com/Microsoft/vscode-textmate - so we should support any format they support, too πŸ‘

@CrossR - thanks for trying it out! The screenshot / investigation you shared helps a lot - it looks like there is a bug where if the filetype is not set, we fall back to image. In this case, we're not recognizing the cfml file as a cf filetype.

IMO, the _ideal_ flow for this is you could just install the vscode-coldfusion plugin in Oni, and we'd pick up the stuff we can handle today - like the syntax files and everything! Unfortunately there are some quirks in that right now that block that from working (but it would be super cool if we could at least leverage parts of VSCode plugins). I hope we can get there and make that painless! πŸ‘ We could even communicate via the plugin sidebar which capabilities were able to load, and which we were not....

Anyway, I was able to get this working with a few steps:
image

(Note the cf filetype at the bottom)

1) Modify your __init.vim__ and add the following line:

au BufNewFile,BufRead *.cfml set filetype=cf

This fixes the issue we had where the filetype was being set to image by explicitly setting it as soon as Vim loads the file. Ideally, if we could understand the vscode plugin, you wouldn't need to do this (it has the same info in its manifest) - but for the time being, this will get things set. I prefer if users don't __need__ to go to their init.vim to customize πŸ˜„

2) Point to the CF grammar in your Oni config:
"language.cf.textMateGrammar": "E:/cfml.tmLanguage",

(I used the VSCode grammar - but I think you already have this part set, @am2605 )

3) Restart Oni

4) Open the coldfusion file

If it worked, you should see cf as the file type and get the syntax highlighting. I also enabled the editor.textMateHighlighting.debugScopes flag to true to make sure I was getting the highlighting from textmate.

Hope that helps, and hope we can streamline this soon πŸ‘ Let me know if you have questions with any of the steps, @am2605

Was this page helpful?
0 / 5 - 0 ratings