Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textmate #9

Open
konsumer opened this issue Oct 14, 2022 · 5 comments
Open

Textmate #9

konsumer opened this issue Oct 14, 2022 · 5 comments

Comments

@konsumer
Copy link

konsumer commented Oct 14, 2022

I would like to convert textmate JSON language definitions (like those used in VSCode) to this format (so I can convert to other things.) Is this possible? Has someone already made a tool for this?

@foo123
Copy link
Owner

foo123 commented Oct 15, 2022

Hello, I don't use Textmate so I cannot really tell. But if you follow the instructions in the documentation and get help from the examples for some languages like PHP, HTML, CSS, .. I think it is perfectly possible.
The grammar tool is about editors like CodeMirror, ACE, Prism, Highlight.js and SyntxHilighter. The same grammar format (with the exception of the Style Model) can be used the same on all those editors. Hope these help.

@konsumer
Copy link
Author

The grammar tool is about editors like CodeMirror, ACE, Prism, Highlight.js and SyntxHilighter. The same grammar format (with the exception of the Style Model) can be used the same on all those editors.

That is the appeal of using it with textmate format for me, since Atom, VSCode, Sublime, and lots of others can use that format. I am not good at converting synhi grammars by hand, so I am hoping to automate and centralize it.

@foo123
Copy link
Owner

foo123 commented Oct 16, 2022

I am not sure I understand what you want to achieve.. Can you provide an example of the Textmate format and how it would relate to the grammar addon and/or format? Do you mean using Textmate format with CodeMirror or ACE or something different than that?

@konsumer
Copy link
Author

konsumer commented Oct 16, 2022

Do you mean using Textmate format with CodeMirror or ACE or something different than that?

Yes, that is my eventual goal. Sorry, I will write a concrete example.

So, the umka language seems great. I want to add syntax-highlighting to their playground and this other cool playground. I am dyslexic, and code without syntax-highlighting is very hard for me to read, but it seems like a fun language.

It has sublime text language def. Someone else wrote textmate def and vim. This is great, and textmate is used in many editors now (vscode, for example) but none of them can be converted directly to any web-based code-editors (like codemirror or Ace.)

I saw this project, which appears to have the goal of being a single grammar-type that can be converted into other things. That seems perfect, as I can get the format in something central, and convert it to codemirror, in this case. I am not great with language-parsing grammars, so I think "maybe there is some existing tool, or this is a feature someone who is better than me at this can implement" so I make an issue over here and here, looking for help.

My goal is "if your editor-grammar doesn't support editors like sublime and vscode, it could, and that would even be more useful." In this case it would mean I can convert the sublime YAML def or textmate JSON into an online code-editor.

So I want to go like this:

graph TD
    subl[Sublime Text] --> eg[editor-grammar] --> Codemirror
    txm[Vscode/Textmate] --> eg[editor-grammar]
Loading

But might also be cool to go like this:

graph TD
     eg[editor-grammar] --> subl[Sublime Text]
     eg[editor-grammar] --> txm[Vscode/Textmate]
     eg[editor-grammar] --> vim[Vim]
    eg[editor-grammar] --> cm[Codemirror]
    eg[editor-grammar] --> ace[Ace]
Loading

And then I can try to port the Textmate grammar to editor-grammar (maybe with some help from umka people,) and have all the editors covered with 1 grammar.

@foo123
Copy link
Owner

foo123 commented Oct 18, 2022

Ah, I see now. The second option is only possible if the editor is implemented in javascript (eg Textmate run in javascript) or a new editor-grammar tool is implemented in the language of the editor (eg in C instead of javascript). For the first option (transform a textmate grammar to editor grammar to be used with codemirror) it is possible, but I don't know of an automated way to do this, but going step-by-step one can transform a grammar in textmate format to a grammar for editor-grammar most easily. I will label this question, to remind me to chek textmate format and maybe integrate it into editor-grammar if I find time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants