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

UI TextMate Preferences #32

Closed
angelozerr opened this issue Jan 12, 2017 · 9 comments
Closed

UI TextMate Preferences #32

angelozerr opened this issue Jan 12, 2017 · 9 comments

Comments

@angelozerr
Copy link
Contributor

angelozerr commented Jan 12, 2017

It should be cool to provide a global TextMate preferences with those preferences pages:

  • TextMate
    • Editor: this page display a table which show links between content type and TextMate grammar. Those links comes from:
      • extension point
      • user preference (provide an Add/Remove buttons to add/remove links between content type and grammar)
    • Grammar: this page display a table which show regsitered grammars:
      • extension point
      • user preference (provide an Add/Remove buttons to add/remove a TextMate grammar.
    • Theme: this page display a table which show regsitered themes (CSS and TextMate themes):
      • extension point
      • user preference (provide an Add/Remove buttons to add/remove a theme.

@mickaelistria what do you think about this idea? Do you like preference page names?

angelozerr added a commit that referenced this issue Jan 12, 2017
@mickaelistria
Copy link
Contributor

This seems totally good. However, I have a few suggestions:

  • Using editor as page name may be confusing as there is no TextMate editor per-se
  • The content of the editor page seems to be a candidate for the grammar page directly. So the grammar page could allow to view/define grammars and to associate them with content-type

@angelozerr
Copy link
Contributor Author

angelozerr commented Apr 25, 2017

@mickaelistria I have started to work on preferences page. For the moment it's basic. It provides list of grammars and list of themes.

Here the result:

image

image

image

Please note it's not finished! At this step we have:

  • TextMate main page which references grammar and theme preference page

  • a grammar page which display a list of registered grammar. I would like to improve like this:

    • Implement Remove/Add button to register user grammar
    • Add a preview source viewer to see the result of the coloration. I think we should have an extension point which provides a snippet code to fill the preview textfield.
    • add a table which shows binding with content type. When you select a grammar, the table is filled with bounded content type. User will have the capability to add a content type to link to the selected grammar
  • add a table which shows grammars which update the grammars with 'injection'. We could have a checkbox to desactivate the injection.

  • add a theme section to bind the grammar the the prefered theme. Or perhaps this feature should be into Theme preference page. to avoid having a big UI.

  • in the theme preference page add a list of grammar linked to the theme.

It's just some ideas, any feedback are welcome!

@mickaelistria
Copy link
Contributor

This look good so far.
There is a dependency on #81 first as it requires the internal grammar and theme registries to allow usage of Preferences as well as extensions.
I suggest you start by merging that and create dedicated issues for each of the possible improvements, that will help to prioritize and distribute work.

@akurtakov
Copy link
Contributor

Few things I don't see mentioned for the themes :

@angelozerr
Copy link
Contributor Author

This logis is already done with extension point (it should be done no by preferences too).

By default it uses TextMate SolarizedLight theme https://github.com/eclipse/tm4e/blob/master/org.eclipse.tm4e.ui/plugin.xml#L38 and if you switch to E4 dark theme it uses TextMate Dark theme https://github.com/eclipse/tm4e/blob/master/org.eclipse.tm4e.ui/plugin.xml#L44

If you switch to E4 dark theme, your editor should use TextMate Dark theme, no?

@angelozerr
Copy link
Contributor Author

This look good so far.

Thanks!

There is a dependency on #81 first as it requires the internal grammar and theme registries to allow usage of Preferences as well as extensions.
I suggest you start by merging that and create dedicated issues for each of the possible improvements, that will help to prioritize and distribute work.

Using preferences means that user will have the capability to define grammar and after link this grammar to a content type. But my main problem is how to create a custom content type with preferences

It seems that in Oxygen it is possible. After that I need to choose an editor which supports TMPresentationReconciler. To do that there are 2 options:

  • provide a TMEditor which extends TextEditor and consumes a TMPresentationReconciler. It will work with Neon which doesn't provide GenericEditor
  • using GenericEditor, it means that it will work only with Oxygen. User should manage associations between custom content type and GenericEditor with "FileAssociations" preferences or Defines "org.eclipse.core.runtime.text" GenericEditor #17 is possible?

As you see, there are so many questions to define custom binding between grammar and custom content type and editor.

I would like in the first step display information of grammar, themes in the preferences. But if you can help me to find solution to bind a grammar with a custom content type without extension point, any idea are welcome!

@mickaelistria
Copy link
Contributor

To be honest, for the use-cases I've worked on or I have in mind, I don't care about Neon and wouldn't use a dedicated TMEditor as TM isn't enough to make useful editors; it's only a way to provide a part of it.
With Oxygen, one can manually add a content-type and associate file-types to it. But the content-type editor association still can't be done manually, and user has to go through the File Assocation prefer page additionally.
In Oxygen, We can think of TM4E contributing a "TextMate supported files", associate the Generic Editor (in Oxygen) or TMEditor with it, and let users add children and supported file names to that content-type manually. Then file matching the content-type would open with the right editor; and users would "only" still have left to associate the new content-type with the grammar.
Then, in a next iteration, we can imagine the TextMate preference page able to create those content-types directly using the right APIs, in order to merge those 2 actions into a single one.

angelozerr added a commit that referenced this issue Apr 28, 2017
@angelozerr
Copy link
Contributor Author

angelozerr commented Apr 28, 2017

Thanks @mickaelistria for your answer. I will study your comment and give you feedback.

I have do a big refactoring to associate theme. Now you can associate theme with E4 Theme and scope name too.

I have displayed that in the Grammar preferences. Here a demo with preview:

tmgrammarpreferencesdemo

@akurtakov I will implement preview too in Theme preferences #91, but you can for the moment play with preview in the Grammar preferences.

It misses "injections" information and after it will be finished. Next step is to persist thoses preferences.

I tell me too if we should provide "snippet" extension to fill the preview textfield when a language is selected. @mickaelistria what do you think? See #93

Any feedback are welcome!

@angelozerr angelozerr changed the title TextMate preferences UI TextMate Preferences Apr 28, 2017
@angelozerr
Copy link
Contributor Author

I close this issue. For User preferences see #94

mickaelistria pushed a commit to mickaelistria/textmate.java that referenced this issue Sep 10, 2017
mickaelistria pushed a commit to mickaelistria/textmate.java that referenced this issue Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants