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

bundle as many textmate files as possible to have out of the gate great support #63

Closed
maxandersen opened this issue Mar 22, 2017 · 15 comments
Labels

Comments

@maxandersen
Copy link

maxandersen commented Mar 22, 2017

see $subject

tm4e really should be in EPP together with a library of as many textmate files as possible IMO.

Should not require users to install additional libraries or having to do another tycho plugin buil dsetup just to get started on syntax highlighting imo :)

@angelozerr
Copy link
Contributor

Hey @maxandersen ! Glad tm4e could interesest you!

tm4e really should be in EPP together with a library of as many textmate files as possible IMO.

Totally agree with you, but today the problem is that you can link a TextMate grammar with an editor only with extension point:

  • you define a content type with extension point
  • you link a TextMate grammar with content type with extension point
  • you link TMPresentationReconclier to an editor with Java code or with extension point for Generic Editor.

To fix that, we need to fix GenericEditor issue #17 in other words gives the capability to link TMPresentationReconclier with any content type (org.eclipse.core.runtime.text)

Once we have will have this feature user will have the capability to register with TextMate Preferences a grammar #32 and link to this grammar the org.eclipse.core.runtime.text content type.

In other words, I'm waiting for https://bugs.eclipse.org/bugs/show_bug.cgi?id=507753#c2 will be fixed in GenericEditor to work on TextMate Preferences.

We could after provide too a plugin which resgister a lot of TextMate grammar (a catalog kind) binded to the org.eclipse.core.runtime.text content type and I think your issue will be fixed, is that?

@mickaelistria
Copy link
Contributor

Note that the issue of dynamically (without extension) detecting a textmate grammar for a given document/file isn't a blocker for this one.
We could imagine as a 1st iteration to have tm4e defining all 3 extensions for each of the given grammar. It's indeed a lot to copy-paste, but it's entirely doable already.

@mickaelistria
Copy link
Contributor

There are already a few one in the "TM Samples" bundle which is part of the p2 repo. However, those aren't registered in the generic editor.

mickaelistria added a commit to mickaelistria/textmate.java that referenced this issue Mar 27, 2017
Signed-off-by: Mickael Istria <mistria@redhat.com>
angelozerr added a commit that referenced this issue Mar 29, 2017
Issue #63: connect sample grammars to Generic Editor
@angelozerr
Copy link
Contributor

angelozerr commented May 4, 2017

@maxandersen just for your information, now you can register your TextMate grammar with user preferences. User must download the TextMate grammar but after you can consume it. Here a little demo:

textmatepreferencesdemo

As you can see, there is a basic TextMate Editor (extends TextEditor and configure it with TMPresentationreconciler), but my goal is to do that with GenericEditor too.

Please note that the first time the grammar is found because cs grammar was already registered. I runregister it with preferences (but demo don't show preferences page). The second time, when TextMate Editor is opened, grammar is not found and it suggest to register it)

Hope you will like it and any feedback are welcome!

@maxandersen
Copy link
Author

Excellent!

@angelozerr
Copy link
Contributor

Glad it please you @maxandersen :)

@moberhuber
Copy link

Hi experts,

I'm currently testing eclipse-committers-oxygen-M7, and I had put big hopes that the generic editor would deliver syntax highlighting for shellscript (*.sh) files.

I noticed that *.sh is by default associated with "Text Editor", so I used right-click > open with > Internal > Generic Editor to change that association. Alas, still no syntax highlighting :( From what I read here, it sounds I need to download a TextMate grammar myself, I'll try that next.

What would be needed to have *.sh syntax highlighting out of the box in Oxygen? Should I report it on Eclispe bugzilla as a first step? If yes, which project/component?

Thanks!
Martin

@moberhuber
Copy link

BTW @angelozerr your animated GIF from the demo crashes Safari reproducibly on OSX 10.11.6 :( but Chrome can handle it.

@angelozerr
Copy link
Contributor

angelozerr commented May 21, 2017

@moberhuber if I understand you wish to use tm4e (for syntax coloration) with Generic Editor?

If you wish to do that you can write a plugin for that to link GenericEditir with your sh TextMate grammar.

If you don't want to write plugin you can do that with TextMate Preferences (see the demo). For the moment it's a custom TextMate Editor but I think we could do that with GenericEditor too (I mean for user preferences). Any contribution are welcome (or be patient, I must find time to study how to that, @mickaelistria suggsted me some ideas, but just find time)!

If you are OK to use TextMate Editor, you must:

@moberhuber
Copy link

moberhuber commented May 21, 2017

Hey @angelozerr that was a quick answer :) I am fine using the TextMate editor, and just got it to work:

  • Downloaded http://download.eclipse.org/tm4e/snapshots/repository.zip since my Eclipse has no Internet access through our authenticating proxy
    • it might be a good idea adding this downloadable repo to your README.md
    • I also found the many categories confusing, I only installed TextMate Editor UI
  • Cloned https://github.com/textmate/shellscript.tmbundle
  • Selected my .sh , Open With > Internal > TextMate Editor
    • Note: A different icon would be good, maybe just add some colored overlay to differentiate against standard TextEditor?
  • From the pop-up, navigate to the ../Syntaxes/*.tmLanguage , voila :)

Notes:

  • If *.tmLanguage is a standard file extension for textMate grammars, it would be good notifying users about this (it was not exactly obvious for me)
  • I'm missing an Outline View for my bash functions, does the TextMate grammar API provide support for such a thing?

At any rate, it seems to be much faster than ShellEd (which I found unusable due to its slowness and its peculiar taste regarding indentation). I'll keep using Eclipse + TM4E for a while - if it's comparable in performance and features to gedit or vim, I'll be more than happy - I'll let you know what I find :)

Thanks and Cheers,
Martin

@mickaelistria
Copy link
Contributor

cc @akurtakov who can explain more about ShellEd vs TM4E and the future of ShellEd.

If *.tmLanguage is a standard file extension for textMate grammars, it would be good notifying users about this (it was not exactly obvious for me)

Sounds nice. Please create a new enhancement request for that.

I'm missing an Outline View for my bash functions, does the TextMate grammar API provide support for such a thing?

I don't know if this is something TM4E can provide. In many cases, outlines are produced by language servers nowadays. Maybe it would be worth creating a language server for bash? (cc @akurtakov )

@angelozerr
Copy link
Contributor

If *.tmLanguage is a standard file extension for textMate grammars, it would be good notifying users about this (it was not exactly obvious for me)

The wizard tell you that, no? Which feature do you want? Please create a new issue for that.

@akurtakov
Copy link
Contributor

well, making a language server for bash is beyond my time limits. Altough I would love to redo shelled ontop of one such. If/when I find time I plan on redoing shelled on top of tm4e or ideally someone would jump in to help with that, it's related with driving DLTK project ahead too as it's currently at Neon level and will need to jump to Oxygen first. I hope to make this happen soonish. The general plan for shelled is to be redone on top of generic editor with tm4e if a lang server pops up by then maybe even on top of lsp4e, but all this work is if/when time permits.

@mickaelistria
Copy link
Contributor

WIP at #374

@sebthom
Copy link
Member

sebthom commented Jul 1, 2022

TM4E 0.6.0 has been released providing a new language pack feature.

@sebthom sebthom closed this as completed Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants