Giter Club home page Giter Club logo

scala-ide-insynth-integration's People

Contributors

dragos avatar huitseeker avatar ikuraj avatar rkrzewski avatar skyluc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

scala-ide-insynth-integration's Issues

Duplicated snippets

Duplicated snippet suggestions are probably due to coercion functions applications (since they appear invisible in the final snippet).

The following example illustrates the issue:

package wtv

import scala.util.Random

case class EvaluationT(examples: Seq[Int => Boolean]) {

  val random: Random = 

}

object EvaluationT {  
  val MAX_RANDOM_VALUE = 100    
  val random = new Random(System currentTimeMillis)  
}

Note that in this example EvaluationT.random is not suggested for some reason.

extractors are not recognized

When typing

object X {
 val xs = List(1)
  val List(a) = |
}

on | there is nothing suggested to get a List. Furthermore:

object X {
  val xs = List(1)
  val | = xs
}

on | no extractor is suggested.

Show simple method call not in operator notation

For local/imported methods there is always shown full operator notation obj op param instead of simply op(param):

object X {
  |
}

On | there is shown Predef println instead of a simple println.

object X {
   def meth = 0
   val i: Int = |
}

On | there is shown meth() which is correct, but also new X().meth() which can never work.

Operator names are not shown

When one types val i: Int = | and activate completion (on |), there is shown among other things: this.$hash$hash()

It would be nice if instead of the internal encoding the real name of a symbol is shown, in this case: this.##()

Hide apply method

On val xs: Array[Int] = | on | there is suggested Array apply 0 instead of Array(0) .

apply method of case class companion not shown

For case classes there is shown only a call to the ctor and not to the companions apply method:

case class C(i: Int)
object X {
  val c: C = |
}

On | there is shown among others: new C(0) but not C apply 0 or C(0)

Synthesis failure on simple operation in Scala 2.10

The problem : synthesis failure on very simple infix operations on Scala 2.10 (exclusively: those do not seem to happen on 2.9).

To reproduce :

  • install the Scala IDE 3.0 for 2.10 (e.g. as an integrated download)
  • download the ecosystem builder and integrate the feature file for InSynth ( scala-ide/ecosystem#7 ), removing the dev sections to accelerate the build.
  • build the ecosystem (mvn -Pecosystem-builds exec:java, cd target/builds, mvn -Pbuild clean package, mvn -Ppackage clean package)
  • add the generated ecosystem :
    file:/path/to/ecosystem/target/builds/stable-scala210-e37-base/target/site/ as a local update-site to the above version of Scala
  • Install Insynth, along with dependencies
  • enter a simple new class in a Scala project:
package tastytest

class Test2 {

  val S = "A String"

  val T = "hey" + 

}
  • the problem should be also reproducible with integers.
  • observed behavior : at the point of completion, Insynth logs that InnerFinder$ - InSynth synthesis failed.. The log is riddled with the (repeated) following stack trace :
2013-04-09 17:01:19,079 ERROR [main] - InnerFinder$ - InSynth synthesis failed.
java.lang.Exception: Desired Type not found in: ch.epfl.insynth.loader.TLoader$Loader
    at ch.epfl.insynth.loader.TLoader$Loader.load(Loader.scala:96)
    at ch.epfl.insynth.InSynth.getSnippets(InSynth.scala:29)
    at ch.epfl.insynth.core.completion.InnerFinder$$anonfun$apply$1.apply(InsynthCompletionProposalComputer.scala:82)
    at ch.epfl.insynth.core.completion.InnerFinder$$anonfun$apply$1.apply(InsynthCompletionProposalComputer.scala:52)
    at scala.tools.eclipse.ScalaPresentationCompiler.withSourceFile(ScalaPresentationCompiler.scala:99)
    at scala.tools.eclipse.ScalaProject$$anonfun$withSourceFile$1.apply(ScalaProject.scala:602)
    at scala.tools.eclipse.ScalaProject$$anonfun$withSourceFile$1.apply(ScalaProject.scala:601)
    at scala.tools.eclipse.ScalaProject$$anonfun$withPresentationCompiler$1.apply(ScalaProject.scala:595)
    at scala.tools.eclipse.ScalaProject$$anonfun$withPresentationCompiler$1.apply(ScalaProject.scala:594)
    at scala.tools.eclipse.util.Cached$class.apply(Cached.scala:41)
    at scala.tools.eclipse.ScalaProject$$anon$1.apply(ScalaProject.scala:96)
    at scala.tools.eclipse.ScalaProject.withPresentationCompiler(ScalaProject.scala:594)
    at scala.tools.eclipse.ScalaProject.withSourceFile(ScalaProject.scala:603)
    at scala.tools.eclipse.InteractiveCompilationUnit$class.withSourceFile(InteractiveCompilationUnit.scala:66)
    at scala.tools.eclipse.javaelements.ScalaSourceFile.withSourceFile(ScalaSourceFile.scala:50)
    at ch.epfl.insynth.core.completion.InnerFinder$.apply(InsynthCompletionProposalComputer.scala:106)
    at ch.epfl.insynth.core.completion.InsynthCompletionProposalComputer.computeCompletionProposals(InsynthCompletionProposalComputer.scala:176)
    at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:318)
    at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:267)
    at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:283)
    at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:243)
    at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1830)
    at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)
    at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)
    at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
    at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1656)
    at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:183)
    at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
    at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
    at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
    at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
    at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
    at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
    at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
    at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
    at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1531)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1257)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1294)
    at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:730)
    at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3019)
    at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
    at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
    at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
    at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8422)
    at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245)
    at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
    at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2276)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

The visual state of the IDE is the following (no errors UI side):
InSynth_2 10

The inhabited String element I'm interested in (S above) is not proposed by Insynth, and is proposed as a completion in alphabetic order (that is, very low in the list).

  • expected behavior : as in 2.9, I would want to see S as one of the first completions suggested.

Scala 2.10 build fails

This seems strange I am not sure what is causing the problem. It is definitely related to the Scala (presentation) compiler or to its invocation.

I made a separate branch for easier and controlled testing.
InSynth 2.10 build can be executed with command to execute only a single test class: "mvn install -P scala-ide-master-scala-trunk -DtestClassArg=ch.epfl.insynth.test.completion.InSynthCompletionTests".
This test is executed.
I think that the problem is here which invokes some compiler calls and then InSynth two times subsequently (it tests both snippet code styles).
In the first call InSynth returns all expected snippets. On the second one it does not.
The problem is definitely that InSynth does no see proper declarations the second time it is invoked (and thus cannot reconstruct expected solutions). The problem is not in the extraction part but it is that the compiler returns somewhat broken tree.
Note that, if one of these calls is commented then the test passes (this suggests that the second time, compiler indeed does not return a proper tree).

Do you have any ideas what can be the problem? I think its evident that it is not an issue with InSynth directly (also because it is working well for 2.9).

Perhaps it is because of these calls:

    project.withSourceFile(unit) { (src, compiler) =>
      val dummy = new Response[Unit]
      compiler.askReload(List(src), dummy)
      dummy.get

      val tree = new Response[compiler.Tree]
      compiler.askType(src, true, tree)
      tree.get

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.