projectfluent / fluent

Fluent — planning, spec and documentation
https://projectfluent.org
Apache License 2.0
1.4k stars 45 forks source link

Improve integration with others tools #312

Open macabeus opened 4 years ago

macabeus commented 4 years ago

Would be very useful to add support for highlight at others tools, such as vscode and github.

I'm creating this "meta issue" mainly to track the progress and know if someones already started that before. I looked before on others repositories but I didn't before, I'm sorry if it's a repeated issue.

On play we are using Ace with fluent mode but there is no mode with that name. To add support to GitHub we should firstly add support to Ace and so update this file. Would be nice also add support to CodeMirror, to be able to have syntax highlighting while editing the file on web. VS Code (and probably others editors) uses TextMate syntax.

Pike commented 4 years ago

For ace/github, we'll need to see what the conflicts over the file extension .ftl means.

Are there other extensions with multiple modes already?

There's a starting point for Atom, too, https://github.com/tree-sitter/tree-sitter-fluent.

For VSCode, it's a bit sad that doing support for VSCode doesn't mean we get support for the Monaco editor.

tobias47n9e commented 4 years ago

GtkSourceview already has support for ftl files: https://gitlab.gnome.org/GNOME/gtksourceview/-/merge_requests/87

macabeus commented 4 years ago

I started a plugin for vscode: vscode-fluent

image

@Pike Atom also support for TextMate syntax: https://flight-manual.atom.io/hacking-atom/sections/creating-a-legacy-textmate-grammar/ (despite that it's legacy)

If someone want to add support to Atom, could use as start point the code that I already wrote on vscode-fluent.

alerque commented 4 years ago

Regarding Linguist (and hence GitHub / GitLab / Ace / Etc.), the conflict with *.ftl being used by FreeMarker and Fluent has been reported on their issue tracker before but they haven't been real helpful so far citing lower Fluent usage and hence closing issues related to disambiguating them. It does look like they might be open to a PR, but it would need to add both Fluent support and a heuristic for determining what any random FTL file is likely to be. They also require at least "hundreds" of GitHub repositories using the file type in the wild as a minimum bar.

macabeus commented 4 years ago

@Pike Hey, I'm developing the Fluent extension for vscode, and I would like to use Fluent's logo on the extension, to display on vscode's marketplace. image

But since Fluent uses Apache License, its trademarks are limited and I need an authorization from someone to use the logo. Could you help me to do that, please? I need to send an email to Mozilla or post on some forum?

rkh commented 3 years ago

Pull Request to add Fluent support to Rouge (which is used for syntax highlighting by tools like Jekyll and Middleman): https://github.com/rouge-ruby/rouge/pull/1697

alerque commented 3 years ago

Since my previous comment, GitLab has switched from linguist to Rouge, so the PR @rkh mentions should bring partial support there too! Unfortunately their Web IDE uses Monaco, which has syntax highlighting via Monarch.

rkh commented 3 years ago

FWIW it looks like GitHub now highlights ftl files and also allows fluent in GFM code blocks:

# Simple things are simple.
hello-user = Hello, {$userName}!

# Complex things are possible.
shared-photos =
    {$userName} {$photoCount ->
        [one] added a new photo
       *[other] added {$photoCount} new photos
    } to {$userGender ->
        [male] his stream
        [female] her stream
       *[other] their stream
    }.

This seems to have done the trick: https://github.com/github/linguist/pull/5341 – thanks @alerque.

macabeus commented 3 years ago

@rkh Thanks! Reading the PR, I noticed that they are using the grammar that I wrote on vscode-fluent! I'm happy to know that my grammar will be more used :smile: