joefitzgerald / go-plus

An Enhanced Go Experience For The Atom Editor
https://atom.io/packages/go-plus
Other
1.51k stars 128 forks source link

HTML Template support #48

Closed mfhholmes closed 9 years ago

mfhholmes commented 10 years ago

Apologies if this is covered elsewhere, I couldn't see it.

I use "gohtml" as my extension for html templates, and use [[ and ]] to delimit the template instructions to avoid clashing with Angular.

I don't want to create a new Atom package to deal with this... it'd be fantastic if go-plus could support this. Of course, it would need to understand the template library and tell me when I got a template instruction wrong.

Totally not an actual issue, just a feature request. Ignore at will, and keep up the amazing work :)

joefitzgerald commented 10 years ago

Hmm... at first glance this seems like something that would be best addressed by a grammar, and consequently, it'd be worth logging it over at https://github.com/atom/language-go. Does gohtml use a specific filename extension or convention?

cryptix commented 10 years ago

The extension is see the most is .tmpl, so not that specific.

I also know that the go package for sublime text recognizes the HTML markup and special template actions when they are declared in inline in const or vars. Also not that practical for larger sites/projects it's still nice to have, if feasible.

joefitzgerald commented 10 years ago

Yup, again - should be a Github issue at: https://github.com/atom/language-go/issues. Anything grammar or language related (e.g. snippets, syntax highlighting, etc.) belongs over there.

When autocomplete is done (#2), we could optionally add some specific functionality for files with a specific grammar, but that depends on the grammar existing. For that reason I'll leave this open but there's a few dependencies that need to occur first:

  1. Add any syntax highlighting / snippets to https://github.com/atom/language-go
  2. Optionally create a new grammar for this type of HTML template
  3. Complete work on the autocomplete-plus provider API (https://github.com/saschagehlich/autocomplete-plus/pull/99)
  4. Implement autocomplete provider(s) for:
    • gohtml
    • text/template
    • html/template
    • others
mfhholmes commented 10 years ago

Yes, I've seen .tmp and .tmpl used a lot (I wanted to differentiate between text templates and html templates so used .gohtml, and I've seen others do this too).

joefitzgerald commented 9 years ago

Let me know if this doesn't resolve the issue: https://github.com/atom/language-go/commit/e94e0b8825f3607e8d388f9d61c366da490aa4e5