Group: http://groups.google.com/group/scala-ide-dev/topics
- scalaide IRC channel [2 Updates]
- I want to add a small feature. Help me contribute? [2 Updates]
iulian dragos <jagu...@gmail.com> May 01 03:09PM +0200
We just created a scalaide room on IRC (freenode). We'd like to make it
easier for Scala IDE developers to find each other, share knowledge and
work on cool ideas in a more real-time environment. We hope this will lower
the barrier for people who want to contribute but find it hard to overcome
the steep learning curve.
I'll try to be there most of the times, and I hope others on this mailing
list will join me!
Hope to see you there!
iulian
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
Mirco Dotta <mirco...@typesafe.com> May 01 03:26PM +0200
Interest is growing fast, 3 users already connected! :)
On May 1, 2013, at 3:09 PM, iulian dragos wrote:
---------------
Mirco Dotta
PSE-D, 1015 Lausanne, Switzerland
Twitter: @mircodotta
See you at Scala Days 2013 in NYC!
June 10th - June 12th
www.scaladays.org
David Barri <japg...@gmail.com> Apr 30 09:49PM -0700
Hi all,
I want to add a small feature to the Scala Eclipse plugin and get it
accepted. I was wondering if you could help me and let me know what I need
to do to allow this to happen.
Starting small, what I want to do is this: Today I realised that the Scala
syntax highlighter/formatter allows you to provide a format for "Methods",
but then doesn't make the distinction between method declarations and
method invocations. One of the great things about Scala is its conciseness
and I find that when I have lots of small, one-line methods all close by,
it becomes hard to see. Therefore I'd like to make a change to the plugin
so that users can specify *separate* colours for the method name in the
signature, and for references to the method, so that I can leave the
references as is and have the method definitions shine.
Before starting I'd like to know if this change would be welcomed, and if
so, what I need to get a patch accepted once I create it.
And I don't know very much about Eclipse plugin dev either for that matter.
I'll figure it out, but any advice or points in the right direction would
be appreciated. :)
Thanks all!
David
Mirco Dotta <mirco...@typesafe.com> May 01 01:48PM +0200
> Hi all,
Hi David,
> I want to add a small feature to the Scala Eclipse plugin and get it accepted. I was wondering if you could help me and let me know what I need to do to allow this to happen.
Absolutely! We are glad to welcome new contributors to the project.
> Starting small, what I want to do is this: Today I realised that the Scala syntax highlighter/formatter allows you to provide a format for "Methods", but then doesn't make the distinction between method declarations and method invocations. One of the great things about Scala is its conciseness and I find that when I have lots of small, one-line methods all close by, it becomes hard to see. Therefore I'd like to make a change to the plugin so that users can specify separate colours for the method name in the signature, and for references to the method, so that I can leave the references as is and have the method definitions shine.
> Before starting I'd like to know if this change would be welcomed, and if so, what I need to get a patch accepted once I create it.
So, you want to have different colors for method declarations and references. I see the interest, so you have my +1.
About the implementation, I am considering two alternatives.
1) Add a new semantic class in the Semantic Highlighting component that will allow you to distinguish method declaration vs references. To do this, it should be enough to:
* Add a new Syntax class for method declarations in https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/syntaxcolouring/ScalaSyntaxClasses.scala#L6
* Add the above created SyntaxClass to the Scala Semantic category https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/syntaxcolouring/ScalaSyntaxClasses.scala#L59
* Set a default coloring for the above created SyntaxClass https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/syntaxcolouring/ColourPreferenceInitializer.scala#L72
* Rename `Method` into `MethodRef` and add a `MethodDecl` in https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/semantichighlighting/classifier/SymbolInfo.scala#L11
* Add the needed logic in https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/semantichighlighting/classifier/SymbolTests.scala#L38 to distinguish between declaration and reference
* Make sure both `MethodRef` and `MethodDecl` are returned by https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/semantichighlighting/classifier/SymbolClassification.scala#L58
* Write a test that shows `MethodRef` and `MethodDecl` are correctly categorized https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core.tests/src/scala/tools/eclipse/semantichighlighting/classifier/MethodTest.scala
* Add the preference https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/syntaxcolouring/SyntaxColouringPreviewText.scala#L8
* (Ask questions when you get stuck, as I'm sure I forgot a ton of other details :))
2) However, I am not convinced the one above is the best way to go. I'm thinking we should be able to categorize declaration while tokenizing the source, as the grammar of the language allows us to guess that any word following a `def` is a
method declaration. Basically, instead of plugging the functionality in Semantic Highlighting, we would do it in the Syntax Highlighting. I see the following interesting advantages: 1) it's much faster, 2) simpler, 3) we could easily do the
same for `val`, `var`, ..., and 4) you don't need to enable semantic highlighting. The only possible issue I see with this approach is that when semantic highlighting is enabled, the method declaration coloring that is applied during syntax
highlighting will be overruled by the one done during semantic highlighting :-/ I can't tell you for sure this will happen, but it's likely. Which means that you would need to also patch semantic highlighting to correctly handle this case.
* Add a new Syntax class for method declarations in https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/syntaxcolouring/ScalaSyntaxClasses.scala#L6
* The created SyntaxClass should be added to the Scala Semantic Category in this case https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/syntaxcolouring/ScalaSyntaxClasses.scala#L56
* Set a default coloring for the above created SyntaxClass https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/syntaxcolouring/ColourPreferenceInitializer.scala#L72
* The tokenizer is here https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/lexical/ScalaCodeScanner.scala#L62
* Figure out a way to prevent the semantic highlighting style to overrule the syntactic style. https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/semantichighlighting/ui/TextPresentationEditorHighlighter.scala#L141
I hope the above wasn't too much information :)
-- Mirco
---------------
Mirco Dotta
PSE-D, 1015 Lausanne, Switzerland
Twitter: @mircodotta
See you at Scala Days 2013 in NYC!
June 10th - June 12th
www.scaladays.org
You received this message because you are subscribed to the Google Group scala-ide-dev.
--
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.
You received this message because you are subscribed to the Google Groups "Scala IDE Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.