ocaml-ide icon indicating copy to clipboard operation
ocaml-ide copied to clipboard

Formatting doesn't seem to work - Ultimate 2017.2.4

Open AllanWang opened this issue 7 years ago • 11 comments

I did a basic test by building it and installing it in IntelliJ Ultimate 2017.2.4

With a basic test:

let test ab =
ab *. 2.0

Formatting the file resulted in:

null
java.lang.NullPointerException
	at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:876)
	at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2324)
	at org.ocaml.merlin.Merlin.makeRequest(Merlin.kt:102)
	at org.ocaml.merlin.Merlin.tellSource(Merlin.kt:45)
	at org.ocaml.ide.components.impl.MerlinServiceComponentImpl.reloadFileIfModified(MerlinServiceComponentImpl.kt:52)
	at org.ocaml.ide.components.impl.MerlinServiceComponentImpl.errors(MerlinServiceComponentImpl.kt:32)
	at org.ocaml.ide.highlighter.MerlinErrorHighlightingAnnotator.doAnnotate(MerlinErrorHighlightingAnnotator.kt:36)
	at org.ocaml.ide.highlighter.MerlinErrorHighlightingAnnotator.doAnnotate(MerlinErrorHighlightingAnnotator.kt:17)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.d(ExternalToolPass.java:211)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:47)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:158)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
	at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:277)
	at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:291)
	at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:246)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:417)
	at com.intellij.util.Alarm$Request.access$700(Alarm.java:344)
	at com.intellij.util.Alarm$Request$1.run(Alarm.java:384)
	at com.intellij.util.Alarm$Request.run(Alarm.java:395)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:237)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

AllanWang avatar Sep 29 '17 01:09 AllanWang

Looks like the merlin process is dying. I think this might be because the file doesn't exist yet. Will need to look into this.

sidharthkuruvila avatar Sep 29 '17 02:09 sidharthkuruvila

Can you send me the details of the version of merlin you are running?

sidharthkuruvila avatar Sep 29 '17 02:09 sidharthkuruvila

I'm still new to OCaml (learning it for a class). All I can find is that it is version 2.5.5. I installed everything recently

AllanWang avatar Sep 29 '17 02:09 AllanWang

A few more questions

  • What os are you running on?
  • Was merlin installed using opam?

sidharthkuruvila avatar Sep 29 '17 02:09 sidharthkuruvila

I'm on Windows 10. Yes, merlin was installed using opam

AllanWang avatar Sep 29 '17 02:09 AllanWang

Hmm, I haven't tested on Windows. The way I get the merlin command to run it as a small bash script.

If you have the path to the merlin command you can try replacing line 16 in OpamCommand.kt with return ProcessBuilder("<Full path to merlin command>")

sidharthkuruvila avatar Sep 29 '17 02:09 sidharthkuruvila

Let me know if that works. If it does, I should be able to figure out how to get things working on windows pretty easy.

sidharthkuruvila avatar Sep 29 '17 02:09 sidharthkuruvila

Maybe it didn't update (I'm using buildPlugin). But the directory is essentially C:/OCaml64/home/[user.home]/.opam/opam-init/init.zsh

AllanWang avatar Sep 29 '17 03:09 AllanWang

Can you share instructions on installing opam on windows? Will try and get a local setup working.

sidharthkuruvila avatar Sep 29 '17 04:09 sidharthkuruvila

This is what I used. It'll install OCaml & Opam and give you a shortcut to its terminal. From there you can install the rest. Note that the default path is C:/OCaml64/, followed by your user path.

Another way with windows 10 is to install it directly in bash (which is what I did), but I'm not sure if you can get a path for that.

AllanWang avatar Sep 29 '17 11:09 AllanWang

Hey @sidharthkuruvila

I'm testing the plugin on antergos now, and I still can't get formatting set. Are we meant to set an sdk or library to the project?

AllanWang avatar Nov 25 '17 04:11 AllanWang