emmetio / sublime-text-plugin

The essential toolkit for web-developers
https://emmet.io
MIT License
255 stars 30 forks source link

Doesn't work on CFML (Coldfusion) #101

Closed iamjarenz closed 4 years ago

iamjarenz commented 4 years ago

Hi,

This plugin is really useful when coding. I'm working on Coldfusion. However, it doesn't work now after the update.

I tried updating the package settings, but still not working. Might be using the wrong setting. Can anyone help?

    // e.g. plugin will mark text that user types as abbreviation
    "abbreviation_scopes": [
        "(text.html | text.xml | text.php | text.cfml | text.cfm) - source - meta - comment",
        "source.sass - meta.property-value - meta.property-name - string - punctuation - comment",
        "(source.css | source.scss | source.less | source.postcss) & meta.property-list",
        "(source.css | source.scss | source.less | source.postcss) - meta.property-value - meta.property-name - string - comment",
        "(source.tsx | source.js | source.jsx) - comment",
        // Inline CSS
        "text.html meta.attribute-with-value.style (string.quoted | source.css)"
    ]

Thanks!

sergeche commented 4 years ago

You should also specify that text.cfml and text.cfm belongs to HTML syntax. In syntax_scopes setting, update "html" as follows:

"html": "(text.html | text.cfml | text.cfm) - source - meta.attribute-with-value.style",

Make sure text.cfml and text.cfm are correct scope selectors

iamjarenz commented 4 years ago

Hi @sergeche ,

I tried adding this to the settings but still didn't work. I've already restarted sublime

    // Editor scope to Emmet syntax mapping
    "syntax_scopes": {
        "html": "(text.html | text.cfml | text.cfm) - source - meta.attribute-with-value.style",
        "xml": "text.xml - text.xml.xsl",
        "xsl": "text.xml.xsl",
        "jsx": "source.js.jsx | source.tsx | source.js | source.jsx",
        "haml": "source.haml",
        "jade": "text.jade | source.pyjade",
        "pug": "text.pug | source.pypug",
        "slim": "text.slim",

        "css": "source.css | source.postcss | meta.attribute-with-value.style.html string.quoted",
        "sass": "source.sass",
        "scss": "source.scss",
        "less": "source.less",
        "stylus": "source.stylus",
        "sss": "source.sss"
    },

Please advise. Thanks!

sergeche commented 4 years ago

Which package do use for CF?

iamjarenz commented 4 years ago

Hi @sergeche ,

I'm using this package: https://packagecontrol.io/packages/CFML

Thanks

sergeche commented 4 years ago

Check with package you’ve provided: Emmet works as expected by default, without any tweaks, since actual scope is text.html.cfml.

Can you restart ST, open ST console and send me it’s contents

iamjarenz commented 4 years ago

Hi @sergeche,

This is the console's contents:

executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/jan/Library/Application Support/Sublime Text 3/Packages
state path: /Users/jan/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/jan/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.522505
startup time: 0.596175
environment variables loaded using: /usr/local/bin/bash -l
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.detect_indentation
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin 0_package_control_loader.00-package_control
reloading plugin Alignment.Alignment
reloading plugin CFML.cfml_plugin
reloading plugin Emmet.main
reloading plugin LESS.less_completions
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin Preside CMS.preside_generate_form
reloading plugin Preside CMS.preside_generate_i18n
reloading plugin Preside CMS.preside_generate_view
plugins loaded
Package Control: Skipping automatic upgrade, last run at 2020-09-01 22:16:06, next run at 2020-09-01 23:16:06 or after
sergeche commented 4 years ago

Hmm, looks good. You don’t see any underline when you type div in CFML syntax?

iamjarenz commented 4 years ago

Oh, it works outside of <cfoutput> @sergeche , but emmet doesn't work inside? Is there a way to fix this?

sergeche commented 4 years ago

Add the following entry into abbreviation_scopes: "text.html.cfml - meta.tag"

iamjarenz commented 4 years ago

Aweseome man!! It worked. Thanks @sergeche!

sergeche commented 4 years ago

Could you create PR with updated scopes so other CF won’t struggle with the same problem? Also note that text.html.cfml - meta.tag might need some tuning: the reason for abbreviation_scopes is to not annoy you with false Emmet abbreviation matches in places where it’s not expected, for example, inside tag name, attribute etc. It was effectively filtered by text.html - meta scope, but yours for CF may allow abbreviation in unexpected places.

iamjarenz commented 4 years ago

Okay. Let me try that then. Thanks!

Edit: Nvm that, not quite sure how to do a PR. Anyway, thanks so much for the help!

michaelalandawson commented 4 years ago

I'm also a user of the CFML package.

Outside of a ColdFusion tag, typing div added an underline. Inside a ColdFusion tag, specifically cfoutput, did not add an underline. However, when I pressed the Tab key, the div expanded correctly.

What is the difference? What benefit did the "underline" provide that I might not know?

Also, I added the scopes to my Emmet settings and got the underline both inside and outside of CF tags. Thanks.

sergeche commented 4 years ago

What is the difference? What benefit did the "underline" provide that I might not know?

Underline means Emmet has captured entered text as abbreviation and will expand it if you press Tab: https://github.com/emmetio/sublime-text-plugin#expanding-abbreviation

In all other cases, default Tab key behaviour is used, e.g. indent, move to tabstop, expand snippet. In your case, non-underlined div is expanded as native ST snippet

michaelalandawson commented 4 years ago

@sergeche, thank you for the explanation.