Coder Social home page Coder Social logo

scalameta / metals-vscode Goto Github PK

View Code? Open in Web Editor NEW
298.0 19.0 74.0 15.27 MB

Visual Studio Code extension for Metals

Home Page: https://marketplace.visualstudio.com/items?itemName=scalameta.metals#overview

License: Apache License 2.0

TypeScript 98.32% JavaScript 0.63% CSS 1.05%
scala vscode-extension vscode language-client lsp hacktoberfest

metals-vscode's Introduction

scalameta

Build Status

User documentation

Head over to the user docs to learn more about the project and its roadmap.

Tutorial

If you'd like to find out how to use scalameta, see this tutorial.

Team

The current maintainers (people who can merge pull requests) are:

An up-to-date list of contributors is available here: https://github.com/scalameta/scalameta/graphs/contributors.

metals-vscode's People

Contributors

adpi2 avatar alexarchambault avatar arthurm1 avatar benhutchison avatar ckipp01 avatar dependabot-preview[bot] avatar dependabot[bot] avatar dlobsinger avatar dos65 avatar gabro avatar giggiux avatar hmemcpy avatar iusildra avatar jkciesluk avatar kacperfkorban avatar kasiamarek avatar kpbochenek avatar kpodsiad avatar laughedelic avatar mergify[bot] avatar mlachkar avatar mliarakos avatar mzarnowski avatar olafurpg avatar pityka avatar sswistun-vl avatar tanishiking avatar tgodzik avatar yoshinorin avatar z1kkurat avatar

Stargazers

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

Watchers

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

metals-vscode's Issues

Scalameta fails to import project using Java 11

From the latest release notes, I'm assuming that OpenJDK Java 11 is now supported, at least partially.
However, I still have isses using Java 11:

  • I have set the JAVA_HOME for metals and can see it is being used by the output.
  • I have a plain SBT project.

Output tab shows:

Java home: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
logging to file /Users/wfaler/dev/chaordic/cddhub/server/.metals/metals.log
time: initialize in 0.78s
skipping build import with status 'Failed'

Log file shows:

INFO  shutting down Metals
INFO  time: initialize in 0.78s
INFO  skipping build import with status 'Failed'

I initially suspected the issue was due to using a JDK module in .sbtopts like so:

-J-XX:MaxMetaspaceSize=512M
-J-Xmx2G
-J--add-modules=jdk.crypto.ec

But removing the sbt opts all together did not change the outcome when restarting.
Any ideas on how to further debug this? The log file sheds very little light.

Improve error message for failed download due to HTTP proxy

Followup of scalameta/metals#529

We should document how to configure HTTP proxies if the Metals download step fails

`Failed to download Metals, make sure you have an internet connection and` +
`the Java Home '${javaPath}' is valid. You can configure the Java Home in the settings.`
);
} else {
return (
`Failed to download Metals, make sure you have an internet connection, ` +
`the Metals version '${serverVersion}' is correct and the Java Home '${javaPath}' is valid. ` +
`You can configure the Metals version and Java Home in the settings.`

Detect build tool in subfolder of workspace?

I have a workspace containing multiple subfolders, which only one of them is Scala where my build.gradle is located.

Is there a way that I can configure the path/file detection pattern?

No symbol completion or go-to-definition in build.sbt

Describe the bug

Nothing happens when I Ctrl+click on a symbol in build.sbt. Ctrl+Space completion yields only textual completions, not smart ones. These functions work correctly in source files, just not in build.sbt. There is still syntax highlighting in build.sbt.

To Reproduce Steps to reproduce the behavior:

  1. Install sbt 1.2.8 and metals-vscode 1.5.2.
  2. Create a new project with sbt new scala/scala-seed.g8.
  3. Open the new project in VS Code.
  4. Open build.sbt.
  5. Attempt to Ctrl+click on Dependencies on the first line. Nothing happens.
  6. Place the cursor in the middle of Dependencies.
  7. Press Ctrl+Space. Observe that completions are of the “abc” kind only.
  8. Open src/main/scala/example/Hello.scala.
  9. Ctrl+click on println. Observe that it goes to the definition of that symbol.

Expected behavior

There should be smart completions and go-to-definition, even in build.sbt.

Installation:

  • Operating system: Debian sid, Linux, amd64
  • VSCode version: VSCodium 1.36.1
  • VSCode extension version: 1.5.2
  • Metals version: 0.7.0

TypeError: line.startsWith is not a function

Describe the bug

With version 1.2.6 metals fails to start, leaving the following messages in the Output window:

Java home: /usr/lib/jvm/java-8-openjdk-amd64/
Using JAVA options set in JAVA_OPTS
Unable to find Java 8 home. To fix this problem, update the 'Java Home' setting to point to a Java 8 home directory
TypeError: line.startsWith is not a function

I have set the Java Home setting, but no avail. I presume it's some other error swallowed by this overly broad catch.

To Reproduce Steps to reproduce the behavior:

Load some Scala workspace.

Expected behavior

metals loads.

Installation:

  • Operating system: Linux
  • VSCode version: 1.30.2
  • VSCode extension version: 1.2.6
  • Metals version: (found in VSCode settings, under metals.serverVersion): 0.4.4

Additional context

I searched for startsWith, and it only appears twice, and this code looks relevant, since it changed in 1.2.6.

Guessing, I'd that shell-quote.parse return an array with some non-strings inside. It's type definitions also imply that it can return non-strings in some cases. I know that I suggested the package, but I wasn't aware of this behaviour, it just looked like the best package to use for this job.

I wonder why typescript compiled nonetheless? You didn't add the typings as far as I can see (I guess you should), but without types tsc should have warned about inferring any, shouldn't it?

Scaladoc comments do not auto-insert * on line break

Consider the following snippet, with a Scaladoc written in Javadoc style (*s are aligned with the first * on the starting line):
https://gist.github.com/torkelrogstad/9fc9d3e6241b1a230f6115d3d27a80ee

If your cursor is at the end of line 3 and you press , a new * is inserted. This is the correct and desired behavior.

Consider this other snippet, with a Scaladoc written in Scaladoc style (*s are aligned with the second * on the starting line):
https://gist.github.com/40db7e876cfedad296f73227ca43252f

If your cursor is at the end of line 3 and you press , a new * is not inserted. I would expect the same behavior as in the first snippet.

Installation:

  • Operating system: Linux
  • Editor: Visual Studio Code
  • Metals version: v0.5.2

Search terms
scaladoc javadoc formatting format

Add -Dmetals.input-box=on by default

Currently, the Metals master enables this option by default for vscode clients but that breaks when using older vscode clients. It's better to let the extension declare what features it supports.

Running Metals in VS Code Snap build under Ubuntu fails

Describe the bug

Unable to download Metals. Error message
Failed to download Metals, make sure you have an internet connection and the Java Home ...

Maybe is related to #67, as a Snap build of VS Code seem similar to flatpak.

It works fine when installing the .deb package (64 bit) described here https://code.visualstudio.com/docs/setup/linux

To Reproduce Steps to reproduce the behavior:

  1. Install VS Code from Ubuntu Snap store.
  2. Start VS Code and open metals enabled project.
  3. See error

Installation:

  • Operating system: Ubuntu 19.04
  • VSCode version: 1.36.1
  • VSCode extension version: 1.5.1
  • Metals version: 0.7.0

image

Search terms

Failed to download Metals, make sure you have an internet connection and the Java Home '/usr/lib/jvm/java-8-openjdk-amd64/bin/java' is valid. You can configure the Java Home in the settings.See https://scalameta.org/metals/docs/editors/vscode.html#http-proxy for instructions if you are using an HTTP proxy.

Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.12/1.1.0-M13-2/coursier-cli_2.12-1.1.0-M13-2-standalone.jar: /home/rva/.coursier/cache/v1/.structure.lock (No such file or directory), ignoring it

Clicking "learn more" for doctor message should focus on existing doctor webview

To reproduce

  • import build with old scala version
  • get doctor message "navigation doesn't work for any project", click "learn more" and it opens a doctor tab as expected
  • upgrade scala version in build for one project but leave another project unchanged
  • change tab to *.scala file, import build
  • a new message appears with "navigation doesn't work for one project", click "learn more", nothing happens. I expected to change tab focus to the existing doctor panel

Related code

function getDoctorPanel(): WebviewPanel {
if (!doctor) {
doctor = window.createWebviewPanel(
"metals-doctor",
"Metals Doctor",
ViewColumn.Active
);
context.subscriptions.push(doctor);
doctor.onDidDispose(() => {
doctor = undefined;
});
}
return doctor;
}
we should focus on the tab if it's already open

Register placeholder commands for when Metals didn't start because of Dotty

Metals won't start when a project is identified as a Dotty project, so not to conflict with the Dotty IDE extension.

This causes Metals extension commands not to be registered, leading to confusing errors.

We should register placeholder commands that - when invoked - say something along the lines of

Metals is not running, because this appears to be a Dotty project

import mill project on MacOS 10.15 with Metals 0.8.0 doesn't work

Describe the bug
When attempting to import a simple mill project with metals 0.8.0 in vscode, I'm getting "import project failed, no functionality will work."

Appears to be attempting to write to /.metals/download instead of my home directory, which is odd, because in metals/src/main/resources/millw the download path is set like so:

MILL_DOWNLOAD_PATH="${HOME}/.mill/download"

Perhaps it can't pick up $HOME in the context it's running in?

To Reproduce
Steps to reproduce the behavior:

  1. Download my super simple mill project (or create one): https://github.com/tylerprete/little-mill
  2. Attempt vscode/metals import from cmdline with code . in checkout folder.
  3. Run "Metals: Import Build" manually if VSCode doesn't suggest it automatically
  4. See error

Expected behavior
Metals is able to download mill successfully and setup bloop.

Screenshots

Installation:

  • Operating system: macOS Catalina (10.15)
  • Editor: Visual Studio Code
  • Metals version: v0.8.0

Additional context
metals.log contain this:

INFO  started: Metals version 0.8.0 in workspace '/Users/tprete/repos/little-mill'
INFO  time: initialize in 0.32s
INFO  running '/var/folders/tp/p9cbzcjj5nb268sl3bnth19w0000gn/T/metals5540375500728896923/millw --mill-version 0.5.2 --predef /var/folders/tp/p9cbzcjj5nb268sl3bnth19w0000gn/T/metals5540375500728896923/predef.sc mill.contrib.Bloop/install'
INFO  Downloading mill 0.5.2 from https://github.com/lihaoyi/mill/releases ...
INFO    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
INFO                                   Dload  Upload   Total   Spent    Left  Speed
100   605    0   605    0     0   1563      0 --:--:-- --:--:-- --:--:--  1563
100 49.9M  100 49.9M    0     0  22.1M      0  0:00:02  0:00:02 --:--:-- 41.9M
INFO  mkdir: /.mill/download: Read-only file system
INFO  build tool exit: 1
INFO  time: ran 'mill bloopInstall' in 2.48s
ERROR Mill command failed: /var/folders/tp/p9cbzcjj5nb268sl3bnth19w0000gn/T/metals5540375500728896923/millw --mill-version 0.5.2 --predef /var/folders/tp/p9cbzcjj5nb268sl3bnth19w0000gn/T/metals5540375500728896923/predef.sc mill.contrib.Bloop/install
INFO  shutting down Metals

Search terms
failed mill project import

Support launch.json configuration to run and debug Scala code

Is your feature request related to a problem? Please describe.
I would like to start Run/Debug of scala not from a Code Lens but from the launch configuration so I can add custom configuration and be more flexible. I also find code lenses not nice and I now need to have them enabled.

Describe the solution you'd like
Support a "scala" launch type in launch.json and use it through the debug panel of VSCode

Describe alternatives you've considered
I'm not aware of any.

Prefer JDK over JRE

I tried the extension in a Windows VM and I noticed that the extension picked JRE 8 instead of JDK 8 causing Goto Definition to not work for JDK symbols. We should pick the JDK over JRE when possible so that we can index JDK sources.

Can't download metals0.7.5

Automatically pick up .jvmopts when launching server

I'm trying to set up metals in VSCode on Windows machine that happens to use proxy to go to the internet.
When I start it I get the following error:
Error while downloading:
https://oss.sonatype.org/content/repositories/releases/io/get-coursier/coursier-cli_2.12/1.1.0-M9/coursier0cli_2.12-1.1.0-M9-standalone.jar:oss.sonatype.org, ignoring it
I've tried adding proxy info to .sbtops/.jvmops but that didn't seem to work.
Could you please help me to set it up?
Thanks, Alex

Metals fails to download in VSCode behind a HTTP proxy

Describe the bug
I get a connection refused error in VSCode when the metals extension (v 1.2.0) activates the first time.

I'm behind a corporate HTTP proxy, but it's properly configured in the http.proxy setting of VSCode. I also tried to set the http.proxySupport to on, but no avail.

To Reproduce
Steps to reproduce the behavior:

  1. Get behind a HTTP proxy.
  2. Install the metals extension and reload the window.
  3. Open a folder with a build.sbt.

Expected behavior
metals installs properly.

Screenshots
vscode metals

Installation:

  • Operating system: Linux
  • Editor: Visual Studio Code
  • Metals version: v0.4.0

Search terms
HTTP Proxy

Warn users if serverVersion is older than default

Reporting an idea from @olafurpg

Given:

  • a metals.serverVersion value containing a semver-compliant version
  • a metals.serverVersion set to an older release than the default value

we should warn the user upon extension activation.

I would probably exclude SNAPSHOT versions from this check.

Can't start Metals due to conflicting GC settings

Describe the bug

Metals crashes when starting in a workspace with .jvmopts that declares custom GC options

To Reproduce Steps to reproduce the behavior:

git clone monix/monix
code monix

Removing -XX:+UseConcMarkSweepGC from https://github.com/monix/monix/blob/baed192092b7c78624f0ea757d041909dda340e2/.jvmopts#L8 works around the issue.

Expected behavior

Metals should start like normal.

The bug lies here

!line.startsWith("-Xms") &&
!line.startsWith("-Xmx") &&
!line.startsWith("-Xss")
Instead of blacklisting memory options, we should consider whitelisting only HTTP proxy settings.

Confusing error message: Failed to download Metals

Describe the bug

The following error message is confusing: "Failed to download Metals, make sure you have an internet connection, the Metals version '0.4.0' is correct and the Java Home '/usr/lib/jvm/java-1.8.0-openjdk/bin/java' is valid. You can configure the Metals version and Java Home under settings."

Suggestions for improving the message

  • test if env variable FLATPAK_SANDBOX_DIR is defined, if so may be to blame https://flatpak.org/
  • don't warn againt the version '0.4.0' if it's the default version, we know it's correct then

Use custom icon for worksheet files

Currently, *.sc files don't have any icon.

Screenshot 2019-11-13 at 23 25 59

It would be nice if those files had some icon that resembled the Scala icon but was still distinct.

Metals fails to launch, when not in a workspace

When opening a file, without opening a workspace/folder beforehand, Metals doesn't launch, but instead reports the following error:

Unable to find Java 8 home. To fix this problem, update the 'Java Home' setting to point to a Java 8 home directory
TypeError: Path must be a string. Received undefined

The problem is that during the configuration of the launch,
the workspace.rootPath is used twice:

  1. return path.join(workspace.rootPath, ".dotty-ide-artifact");

  2. const jvmoptsPath = path.join(workspace.rootPath, ".jvmopts");

path.join will fail in this case, because workspace.rootPath is undefined.

Two possible solutions:
Test if workspace.rootPath is undefined and then

  1. ignore the rest of the configuration or
  2. Return a meaningful error message, telling that metals only works in a workspace/folder.

Any way to avoid opening Output panel?

Hi,

I was wondering if there is any way to prevent Metals from opening the Output panel (and closing it right after) whenever it is running. The reason is that I usually keep a terminal open while developing (to run tests etc) and this behavior forces me to re-open it every time.

Thanks in advance!

Unable to download metals on Windows, possibly due to coursier

When trying to open any scala/sbt project with VSCode and Metals (1.4.2), I get the following (weird) error:

Error while downloading https://oss.sonatype.org/content/repositories/releases/io/get-coursier/coursier-cli_2.12/1.1.0-M9/coursier-cli_2.12-1.1.0-M9-standalone.jar: C:\Program Files\Microsoft VS Code\WARNING: git not in path\Coursier\cache\v1\.structure.lock (The filename, directory name, or volume label syntax is incorrect), ignoring it

This seems to be coming from coursier. It seems it has some issue finding the cache directory, I tried manually passing it to the download command line (edited extension.ts to pass the --cache flag, as well as tried setting COURSIER_CACHE manually - it didn't help.

What's weird about this warning is the bit about git not in path. I really don't know what that's about, as my git is definitely in the path.

I also tried downloading the latest coursier (with curl -L -o coursier https://git.io/coursier) and replacing it in the extension directory - didn't help.

Any hints?

  • Operating system: Windows 10
  • VSCode version: Version: 1.35.1 (system setup)
  • VSCode extension version: 1.4.2
  • Metals version: 0.6.1

Installation instructions not working

Hi,
I tried to install Metals in VS Code on MacOS. Versions:
Metals 0.1.0
VS Code 1.25.1
MAC OS 10.14.2
locally installed Scala is 2.12.1

I followed the instructions on the website verbatim, and Metals does not work!

After installing Metals, I opened an existing sbt / scala project, opened several scala files and there was no "Import project" option anywhere. Furthermore, the metals.log file consisted of:

Jan 09, 2019 1:21:54 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.6.5.Final
Jan 09, 2019 1:21:54 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.6.5.Final
Jan 09, 2019 1:21:54 PM org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 2.3.0.Beta2
INFO  Started Metals http server at http://127.0.0.1:5032
INFO  shutting down Metals

Which appears to offer no help in understanding why it does not work.
Is your project broken, or are the instructions wrong?
Regards,
Alan

Automatic build import is not supported for sbt <unknown>

When I run the command "Metals: Import build", error comes:
Automatic build import is not supported for sbt . To fix this problem, upgrade to sbt v0.13.17+

My settings of Metals is null (I didn't change any default setting of metals )

Metals prompts for custom java 8 setting even if java 11 is available

Describe the bug

On OpenJDK11 under Ubuntu 18.04, Metals for VS Code v 1.5.2 prompts for Java 8 and suggests to provide path to Java 8 in settings, BUT release notes already for 1.5.0 said "upgrade to 0.7.0" claiming support for Java 11 https://scalameta.org/metals/blog/2019/06/28/thorium.html

To Reproduce Steps to reproduce the behavior:

  1. Install OpenJDK on Ubuntu
  2. Import a build
  3. The prompt is shown for missing Java 8 with a tip to set javahome manually
  4. See error
    "Unable to find Java 8 home. To fix this problem, update the 'Java Home' setting to point to a Java 8 home directory"

Expected behavior
Metals should just work with Java11 available

  • Operating system: Tested on Ubuntu both 18.04 and 16.04 with OpenJDK11
  • VSCode version: 1.37
  • VSCode extension version: 1.5.2
  • Metals version: 0.7.0

Search terms

Metals Java 11 support

Commands missing from command palatte

Describe the bug

When opening the command palette, it used to be the case that you could type metals and see a bunch of Metals commands; in the README there is a screenshot of a user searching >import and Metals: import build appearing. As of version 1.3.1, these commands no longer appear. Typing metals or import results in an empty list.

To Reproduce Steps to reproduce the behaviour:

  1. ctrl-shift-P
  2. type metal
  3. see no results

Expected behavior

Items such as Metals: import build should be present

Installation:

  • Operating system: Linux
  • VSCode version: 1.33.1
  • VSCode extension version: 1.3.1
  • Metals version: 0.5.0

Enforce proper formatting on CI

We should make sure that the code is not randomly reformatted and it is checked on CI using a default prettier version.

Yes, it's sufficient to yarn add --dev prettier and then run yarn prettier --check on the CI.

Metals starts even when project is not a scala project

I'm using the metals vscode plugin, and it works great in my Scala / SBT projects.

However I see that metals is being started even when the directory I open is not a scala project.

This leads to the creation of a .metals directory in the project.

To Reproduce Steps to reproduce the behavior:

  • Open a directory that is not a scala project
  • Metals is starting
  • .metals directory is created.

Expected behavior

  • No .metals directory, or starting of metals at all.

Installation:

  • Operating system: macOS
  • VSCode version: 1.36.1
  • VSCode extension version: 1.5.2
  • Metals version: 0.7.0

Metals fails on VS Code Dev Container

Yesterday, [VS Code Remote] was announced. Unfortunately, I ran into some problems getting Dev Container running on a Scala project.

When opening the dev container, right after metals is installed and starts, the following is logged:

Java home: /docker-java-home
logging to file /workspaces/stryker4s/.metals/metals.log
[Error - 20:12:43] Server initialization failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.io.FileNotFoundException: /workspaces/stryker4s/.metals/metals.log (No such file or directory)
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
	at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:647)
	at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632)
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
	at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
	at scala.concurrent.java8.FuturesConvertersImpl$CF.apply(FutureConvertersImpl.scala:21)
	at scala.concurrent.java8.FuturesConvertersImpl$CF.apply(FutureConvertersImpl.scala:18)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
	at scala.concurrent.BatchingExecutor$Batch.processBatch$1(BatchingExecutor.scala:67)
	at scala.concurrent.BatchingExecutor$Batch.$anonfun$run$1(BatchingExecutor.scala:82)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85)
	at scala.concurrent.BatchingExecutor$Batch.run(BatchingExecutor.scala:59)
	at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:874)
	at scala.concurrent.BatchingExecutor.execute(BatchingExecutor.scala:110)
	at scala.concurrent.BatchingExecutor.execute$(BatchingExecutor.scala:107)
	at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:872)
	at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:72)
	at scala.concurrent.impl.Promise$DefaultPromise.$anonfun$tryComplete$1(Promise.scala:288)
	at scala.concurrent.impl.Promise$DefaultPromise.$anonfun$tryComplete$1$adapted(Promise.scala:288)
	at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:288)
	at scala.concurrent.Promise.complete(Promise.scala:53)
	at scala.concurrent.Promise.complete$(Promise.scala:52)
	at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:187)
	at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: /workspaces/stryker4s/.metals/metals.log (No such file or directory)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileWriter.<init>(FileWriter.java:107)
	at scribe.writer.file.IOLogFileWriter.writer$lzycompute(IOLogFileWriter.scala:7)
	at scribe.writer.file.IOLogFileWriter.writer(IOLogFileWriter.scala:7)
	at scribe.writer.file.IOLogFileWriter.write(IOLogFileWriter.scala:9)
	at scribe.writer.file.LogFile.write(LogFile.scala:69)
	at scribe.writer.FileWriter.write(FileWriter.scala:27)
	at scribe.handler.SynchronousLogHandler$.$anonfun$log$3(SynchronousLogHandler.scala:26)
	at scribe.handler.SynchronousLogHandler$.$anonfun$log$3$adapted(SynchronousLogHandler.scala:24)
	at scala.Option.foreach(Option.scala:274)
	at scribe.handler.SynchronousLogHandler$.log(SynchronousLogHandler.scala:24)
	at scribe.handler.SynchronousLogHandler.log(SynchronousLogHandler.scala:18)
	at scribe.Logger.$anonfun$log$4(Logger.scala:41)
	at scribe.Logger.$anonfun$log$4$adapted(Logger.scala:41)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at scribe.Logger.$anonfun$log$3(Logger.scala:41)
	at scribe.Logger.$anonfun$log$3$adapted(Logger.scala:40)
	at scala.Option.foreach(Option.scala:274)
	at scribe.Logger.log(Logger.scala:40)
	at scribe.Logger.$anonfun$log$6(Logger.scala:42)
	at scribe.Logger.$anonfun$log$6$adapted(Logger.scala:42)
	at scala.Option.foreach(Option.scala:274)
	at scribe.Logger.$anonfun$log$3(Logger.scala:42)
	at scribe.Logger.$anonfun$log$3$adapted(Logger.scala:40)
	at scala.Option.foreach(Option.scala:274)
	at scribe.Logger.log(Logger.scala:40)
	at scribe.package$.log(package.scala:10)
	at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$withTimer$1(MetalsLanguageServer.scala:1209)
	at scala.util.Success.$anonfun$map$1(Try.scala:255)
	at scala.util.Success.map(Try.scala:213)
	at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
	at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
	... 5 more

Steps to reproduce:

  1. git clone https://github.com/hugo-vrijswijk/stryker4s && git checkout vscode-devcontainer
  2. Open the folder in VS Code Insiders with the extensions from above article installed
  3. Click 'Reopen in container'
  4. Wait for a while, then 'Internal error' notification shows up
  5. Observe logs in Metals output

Expected behavior

Metals is installed in the container and runs amazingly as usual

Installation:

  • Operating system: Windows
  • VSCode version: 1.34.0-insider
  • VSCode extension version: 1.3.2
  • Metals version: 0.5.1

Consolidate client commands registration and validation

We currently register client commands in several locations.

Ideally, we should:

  • define commands and their params in a single centralized point
  • register them in bulk
  • validate their arguments at runtime and use a typesafe model from then on (io-ts can help here)

Missing changelog

Please consider adding a changelog, so that changes introduced in future releases can be easily reviewed from within the VSCode plugin manager.

Discoverability could be improved

Metals does not show up in the first results for a search on "scala" in the VSCode plugin manager.

One possible way of improving discoverability may be to change the name of the plugin to something like Scala (metals) (similar to Scala (sbt)), Scala Language Server or Scala Language Server (metals) (similar to Lulian Dragos' old plugin or the Dotty one).

Override default value for editor.suggestSelection setting to be "first"

The default behavior in VS Code is to preselect completion items based on what you have selected before. For example, if you select toString once then vscode will preselect that method the next time it appears. However, Metals has better understanding of the context of the source code, for example we use type-aware sorting to highlight the most relevant completion items in pattern matching

Screenshot 2019-03-08 at 13 48 13

Related discussion microsoft/vscode#54203 (comment)

The Metals VS Code extension should either

  • automatically set the value of editor.suggestSelection to be "first" in Scala sources
  • highly recommend that users configure this setting when they use Metals for the first time

Custom repositories for fetching Coursier are not picked up

This looks like its related to #126, but since that one is closed, I've opened a new one.

Using Metals in VSCode:
I have set the Metals: Custom Repositories but these are not picked up by the coursier fetching itself:

I know I have a MITM corporate proxy which should never be used for this. And I want it to pick up my internal Maven Repository, but Maven.org is always used, no matter what I put in the aforementioned setting.

Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-publish_2.12/2.0.0-RC5-3/coursier-publish_2.12-2.0.0-RC5-3.jar: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, ignoring it
Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-cache_2.12/2.0.0-RC5-3/coursier-cache_2.12-2.0.0-RC5-3.jar: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, ignoring it
Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-install_2.12/2.0.0-RC5-3/coursier-install_2.12-2.0.0-RC5-3.jar: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, ignoring it
Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.12/2.0.0-RC5-3/coursier-cli_2.12-2.0.0-RC5-3.jar: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, ignoring it

Used version:

Name: Scala (Metals)
Id: scalameta.metals
Description: Scala language server with rich IDE features
Version: 1.7.1
Publisher: Scalameta
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=scalameta.metals

Log stdout on download error

Reported by @jvican

jvican

The error message is likely hidden in stdout but we don't log it because stdout should contain the fetched coursier classpath.

Code completion

I am current using the ensime plugin which provides some code completion. I would love to switch to this, is auto-completion actively being worked on?

Failing to run in Windows 10

Describe the bug

I'm having real trouble getting a simple project to setup and compile. Quite open to it being something I've done wrong but I haven't really deviated from the setup instructions. (I'm having separate issues when using WSL but for now this is local development on Windows 10.)

At the moment it appears to build the Bloop config fine but then pops up with:

Missing configuration directory in /c:/Users/Nick/Code/scala-sandbox/.bloop.

  1. Did you run bloop outside of the working directory of your build?
    If so, change your current directory or point directly to your .bloop directory via --config-dir.
  2. Did you forget to generate configuration files for your build?
    Check the installation instructions https://scalacenter.github.io/bloop/setup

The directory definitely does exist.

To Reproduce Steps to reproduce the behavior:

  1. Open a folder with a simple build.sbt
  2. Run import build

Installation:

  • Operating system: Windows 10
  • VSCode version:
    Version: 1.36.0-insider (user setup)
    Commit: c089daa858f34631f5f827ff8a0313bf1e2ded6d
    Date: 2019-06-07T05:19:15.188Z
    Electron: 4.2.3
    Chrome: 69.0.3497.128
    Node.js: 10.11.0
    V8: 6.9.427.31-electron.0
    OS: Windows_NT x64 10.0.17763
  • VSCode extension version: 1.3.3
  • Metals version: 0.5.2

Additional context

metals.log appears to have run Bloop fine - there are some warnings that may be related but don't tell me much.

INFO time: ran 'sbt bloopInstall' in 18s
INFO shutdown request received: build/shutdown
INFO running installed 'bloop bsp --protocol tcp --host 127.0.0.1 --port 50703'
INFO The server is listening for incoming connections at tcp://127.0.0.1:50703...
INFO Accepted incoming BSP client connection at tcp://127.0.0.1:50703
INFO tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\Nick\AppData\Local\scalameta\metals\cache\bsp.trace.json
INFO request received: build/initialize
INFO time: connected to build server in 1.27s
INFO disconnected: build server
INFO BSP initialization handshake complete.
ERROR Empty build targets. Expected at least one build target identifier.
ERROR Empty build targets. Expected at least one build target identifier.
ERROR Empty build targets. Expected at least one build target identifier.
INFO time: imported build in 0.1s
INFO time: indexed workspace in 0.24s
ERROR timeout: build server 'bloop' during shutdown

Coursier bootstrap downloads from maven central without using custom repositories

Unable to download coursier-cli_2.12-1.1.0-M13-2-standalone.jar

To Reproduce Steps to reproduce the behavior:

  1. Go to 'install metals for vs code'
  2. See error
    Java home: C:\Program Files (x86)\Java\jdk1.8.0_201
    Error while downloading https://repo1.maven.org/maven2/io/get-coursier/coursier-cli_2.12/1.1.0-M13-2/coursier-cli_2.12-1.1.0-M13-2-standalone.jar: Connection timed out: connect, ignoring it

Expected behavior
Should allow to download this coursier.

Installation:

  • Operating system: macOS/Windows
  • VSCode version: 1.36.1
  • VSCode extension version:
  • Metals version: (found in VSCode settings, under metals.serverVersion) : 1.5.1

Additional context
I tried to install the metals in visual studio code but immediately got the above error. It is trying to download coursier from repo1.maven.org . But we have separate repository to download this part. not able to setup custom repository to download coursier. Also i did the proxy setting but it did not help. So all i want to update the repo to my custom repo. Also tried to do custom repo config option but that also did not help.

here is the settings i am using for custom repository which i did by adding environment variables :
COURSIER_REPOSITORIES="ivy2Local|central|sonatype:releases|jitpack|/"

Search terms
Unable to download coursier-cli_2.12-1.1.0-M13-2-standalone.jar

Enable formatting on type/paste by default

Currently, users need to manually enable the "format on type" and "format on paste" features in Metals. The Metals VS Code extension should enable these features by default for Scala by contributing the following configuration

{
  "[scala]": {
    "editor.formatOnPaste": true, 
    "editor.formatOnType": true
  }
}

Import Build not importing build

Describe the bug

I don't think it's a bug. I think it's something I'm doing wrong, but I've read A LOT of your docs and still can't figure it out:

Extension installs just fine, but does not attempt to import build when I open my build.sbt file, nor if I press Import Build

To Reproduce Steps to reproduce the behavior:

  1. Go to Metals Tab
  2. Click on Import Build
  3. Quick flicker, then nothin'

Expected behavior

It should install something or something, right?

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.