dragos / dragos-vscode-scala

Other
253 stars 39 forks source link

Loading...(vscode) #78

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi, sorry in advance - I may need some very basic help here, but I cannot seem to get this to work. I am running visual studio code.

What I have done:

  1. added addSbtPlugin("org.ensime" % "sbt-ensime" % "2.1.0") to ~/.sbt/1.0/plugins/plugins.sbt
  2. installed the scala language server plugin
  3. in my project directory ran sbt ensimeConfig and currently have a .ensime file in my project directory
  4. read through the documentation and searched...a lot.

My issues:

  1. When I start vscode i get No .ensime file in directory. Run 'sbt ensimeConfig' to create one.
  2. When I hover over some code a box pops up that says Loading...

If anyone knows why this is happening and what I am missing I would be extremely grateful. Any other info you need, please let me know.

dragos commented 6 years ago

Are you starting code in the right directory? I usually start it from the command line, after cd-ing into the project root dir. Do you see .ensime in the left panel?

ghost commented 6 years ago

Thanks for the suggestion - I didn't know to start code from the project root. Unfortunately still no luck though. the .ensime file is in the project's root (in the left panel) and it's fully populated with all of the project's info and correct directories. Should I be starting code with any flags set or anything like that?

ddalex commented 6 years ago

I second this issue; I have the .ensime file generated, I start code in the current directory (code .), and when pressing F12 (or mousing over) it gets stuck at 'Loading...'

There is no significant output in Developer logs of VSCode...

dragos commented 6 years ago

Anything in pc.stdout.log?

Isnor commented 6 years ago

I had a lot of trouble getting this extension to work as well, but in my case it wasn't so bad. Can you post the output of env | grep JDK_HOME In my case, it's JDK_HOME=/usr/lib/jvm/java-8-openjdk If it isn't set, the extension probably won't work. I also incorrectly had it set to the /bin folder and that cause some ClassDefNotFound errors. If you want to try without logging out and back in,

export JDK_HOME="/path/to/jdk"
code

The biggest confusion for me was that code has to be open in the project root directory. CTRL+K,CTRL+O will open a new folder. I initially had code open in a folder with several projects and was confused for a while as to why it wouldn't work. It seems like only one can be open. I think those were my only issues, but I did try some other stuff, maybe it will work for you:

Close code
cd project_root/
sbt ensimeClearCache;ensimeServerIndex

I also ran sbt ensimeConfigProject. From my .ensime:

java-home "/usr/lib/jvm/java-8-openjdk"
 :java-flags ("-XX:ReservedCodeCacheSize=128m" "-XX:MaxMetaspaceSize=256m" "-Xss2m" "-Xms512m" "-Xmx4g" "-XX:MaxMetaspaceSize=256m" "-XX:StringTableSize=1000003" "-XX:+UnlockExperimentalVMOptions" "-XX:SymbolTableSize=1000003" "-Dscala.classpath.closeZip=true")
 :java-sources ("/usr/lib/jvm/java-8-openjdk/src.zip")
:root-dir "/home/user/workspace/test/foobar"
 :cache-dir "/home/user/workspace/test/foobar/.ensime_cache"

I also added Coursier to my global sbt plugins: cat 'addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.1")' >> ~/.sbt/1.0/plugins/plugins.sbt

What is your project structure like?

PallasKat commented 5 years ago

I also second the issue and in my case it's pretty bad: I've got the Loading... issue, and also the process is using all my computing resources and doesn't stop until I either kill it or stop vscode:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 5686 xxxxxxx  20   0 6428216 1.168g  23584 S 897.0  3.7   51:25.71 java

I try to let it run for a while (i.e. ~15-20 min) hoping that was an indexing that is done only one time.

Regarding the memory usage, it seems constant round 1.7GB (I also add that I extended java heap memory max with -Xmx20g in the .ensime config file).

I tired to run code from the root directory and all other suggestions in this thread but nothing helped. I also didn't spot anything interesting in the log files.

If this is of any help: my visual studio code version is 1.27.2, java is openjdk version 1.8.0_181 and I use the extension available on the vscode market.