Skip to content

Semantic coloring in attributes (clear blue) and locals (brown) is missing. #18

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

Closed
angelozerr opened this issue Mar 12, 2016 · 18 comments
Closed
Milestone

Comments

@angelozerr
Copy link
Owner

Semantic coloring in attributes (clear blue) and locals (brown) is missing.

@angelozerr
Copy link
Owner Author

To support that :

  • tsserver should provide a command for that. I don't know if it's possible.
  • JSDT should provide teh capability to override syntax color. today it's not possible. See JSX syntax coloration #11

@micaelgallego
Copy link

I'm curious about why have you based TypeScript editor in JSDT editor. What are the benefits of this dependency? I'm afraid that issues like https://bugs.eclipse.org/bugs/show_bug.cgi?id=486961 limit TypeScript editor features

@angelozerr
Copy link
Owner Author

@micaelgalluego my goal was not to develop from scratch an editor. It's a big work.

But I tell me more and more if I must start from scratch the editor. If I can manage my idea with TextMate, I think I will develop my own editor.

@micaelgallego
Copy link

+1 to have a custom editor to be fully configurable. But I can't help with it as my limited experience developing Eclipse plugings

@angelozerr
Copy link
Owner Author

@micaelgallego developping an editor from scratch is a big work. More JSDT guys are improving a lot to be more extensible. But it will take time.

I think I will be very motivated to develop custom editor if I can support JSX coloration with TextMate like VSCode does. After that I could contribute to JSDT with TextMate.

I have started to port https://github.com/Microsoft/vscode-textmate (written in TypeScript) to Java code, but it's a really big work -( More vscode-textmate is based on oniguruma and we must the same lib in Java (it seems that it's joni).

If you think you could help me to develop this port of textmate in Java, and if we can support it inside Eclipse, it will be fantastic (and it will not only for TypeScript but for other languages).

This port of texmate is not depepdendent from Eclipse, it could be used for Swing or other GUI. If you think you could help me, I can create a github project. Tell me...

@micaelgallego
Copy link

I'm very sorry but I don't have enough time for now to collaborate in such a big project. I cannot commit myself to help you.

In the meantime, until vscode-textmate is ported to Java, what do you think in execute it using https://github.com/eclipsesource/J2V8 or Nashorn? I now it is a bit hacky, but it may be worthwhile for a prototype.

@angelozerr
Copy link
Owner Author

In the meantime, until vscode-textmate is ported to Java, what do you think in execute it using https://github.com/eclipsesource/J2V8 or Nashorn? I now it is a bit hacky, but it may be worthwhile for a prototype.

I would liek to avoid doing that. Syntax coloration must be very fast and this solution required Java8 or installation of J2V8.

@angelozerr
Copy link
Owner Author

@micaelgallego I have ported vscode textmate for eclipse https://github.com/angelozerr/textmate.java but it'.s little slow (freeze the editor) when ts file is big

VSCode is too slow but it doesn't feeze the UI editor. see https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/model/textModelWithTokens.ts

Syntax coloration is done on bakground. I don't know how to do that with eclipse.

@micaelgallego
Copy link

It is amazing that you have implemented textmate for Java. Good job!

Sorry I can't help you with eclipse editor coloring in background. Can't you create a Thread to do the job in background and when result is ready apply it to current editor?

@angelozerr
Copy link
Owner Author

@micaelgallego I have improved a lot https://github.com/angelozerr/textmate.java and I have the intention to integrate to typescript.java.

Here the result:
ce
typescriptsyntaxcoloration

The coloration is based on TypeScript TextMate from VSCode, so we should have the same colorization. It's a little slower than the current colorization but as it is done on background, it should (I hope) have not freeze.

My idea is to add a preferences like TypeScript > Editor -> Syntax Color and have a checkbox with "Use Textmate" or "Advanced colorization". This preferences will be disabled by default (and in the future we could set this preferences by default if textmate.java works well according users feedback).

@nimo23 @jcompagner if you know Eclipse plugins you can start to play with https://github.com/angelozerr/textmate.java and give me some feedback. Thanks!

@jcompagner
Copy link

i will look at it (i know how eclipse plugins work our tool has loads of them)
Problem is a bit that writing a good text editor is not just about coloring .. Its also about selection and so on. For example why i like this type script plugin better then others (that made there own text editor) is that i can double click after { and the whole block is selected so i can very easily see where it ends.
And you have loads of that nitty gritty things, what is a "word" (if i double click on a word) or control-arrow keys moving over the code..

@angelozerr
Copy link
Owner Author

angelozerr commented Dec 8, 2016

i will look at it (i know how eclipse plugins work our tool has loads of them)

Thanks!

Problem is a bit that writing a good text editor is not just about coloring ...

Yes sure! But with TextMate you will have advanced syntax colorization (like highlight parameter variable of function different color from private variable) and more I should be able to highlight HTML syntax for angular @template (I must study that).

that i can double click after {

TextMate feature should not break this feature (I hope). The idea is just to replace the IPresentationReconcilier (used for syntax color) of the TypeScriptEditor by the TextMate presentation reconcilier

@jcompagner
Copy link

i have now 2 typescript editors right?
The matching of brackets doesn't work for that new editor (that has more coloring)
also the coloring is a bit slow, i first see everything in black when i open an editor then it is colored

@jcompagner
Copy link

also as an example what i mean with what are "words" in the new editor if i double click on:

$rootScope

then only "rootScope" is selected instead of "$rootScope"

the "old" editor works correctly in this scenario.

@angelozerr
Copy link
Owner Author

i have now 2 typescript editors right?

For the moment yes, but the TypeScript editor from textmate.java is just a sample. My idea is just to use the TMPresentationReconcilier inside typescript.java

The matching of brackets doesn't work for that new editor (that has more coloring)

also as an example what i mean with what are "words" in the new editor if i double click on:

As I said you it's just a sample TypeScript editor which manage coloration. So matching of bracket will continue to work once I will merge the 2 editors.

also the coloring is a bit slow, i first see everything in black when i open an editor then it is colored

Yes the coloration is done on background. If start textmate.jav ain debug mode it's very slow. Please test with run as.

@jcompagner
Copy link

i did test it but i think that line for line syncing to the event thread is what makes it perceived as slow.
Is it not possible to tokenize the first time the whole thing at once?

The sample plugin.xml does give me an error because i am not on 4.7 (Unknown extension point: 'org.eclipse.ui.genericeditor.presentationReconcilers')
But that doesn't seem to affect much

@angelozerr
Copy link
Owner Author

i did test it but i think that line for line syncing to the event thread is what makes it perceived as slow.

Have you a big ts file? I have done like this like VSCode does it.

The sample plugin.xml does give me an error because i am not on 4.7 (Unknown extension point: 'org.eclipse.ui.genericeditor.presentationReconcilers')

Yes it's just sample with GeneridEditor coming from Oxygen and the cool LanguageServer project

@angelozerr angelozerr added this to the 1.2.0 milestone Dec 14, 2016
@angelozerr
Copy link
Owner Author

Done with #114 (comment)

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