SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

More build configuration options – making grammar packages work with Atom #59

Closed daaain closed 9 years ago

daaain commented 9 years ago

I'm trying to make my Sublime package work with Atom, which should be a fairly straightforward thing as Atom takes the exact same JSON format as I got generated by AAAPackageDev to avoid having to edit the XML directly.

The only problem is, Atom expects the extension to be .json, however if I rename the file (from .JSON-tmLanguage) then the build system will generate a .plist instead of .tmLanguage.

I can make it work by adding the override comment as instructed by the readme, but then I'm left with an invalid JSON file which Atom will choke on.

I guess there are many ways to make it work, but wanted to put the use case forward and see if maybe you have something in mind already which could address it?

FichteFoll commented 9 years ago

The best way is likely to create a (project-specific) build system that provides the target extension (and format) without needing the "comment frontmatter".

The build system should be as follows:

{
    "target": "convert_file",
    "target_format": "plist",
    "ext": "tmLanguage",

    "selector": "source.json, source.json-tmlanguage"
}

(I knew making these customizable as command arguments would be a good idea. :+1: )

daaain commented 9 years ago

Brilliant, thank you so much!

Took me a bit to figure out that I need to paste this into a .sublime-build file and then choose Tools > Build System > .sublime-build to make everything magically work, so thought I should write it down in case someone finds this issue.

FichteFoll commented 9 years ago

For the future: http://docs.sublimetext.info/en/latest/file_processing/build_systems.html

daaain commented 5 years ago

@FichteFoll sorry for resurrecting this issue, but the method you suggested above doesn't seem to work any more, which I guess isn't surprising as I can't even find these properties in the build system documentation now.

Do you have any suggestions on how to change the config file so I can achieve the same result? Thanks a lot 🙏

FichteFoll commented 5 years ago

The build system system hasn't changed in years and the command that PackageDev exposes hasn't been changed or removed either, just moved.

Do you see any errors in the console?