Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support import $exec in Ammonite scripts #313

Open
chessman opened this issue Oct 30, 2021 · 1 comment
Open

support import $exec in Ammonite scripts #313

chessman opened this issue Oct 30, 2021 · 1 comment

Comments

@chessman
Copy link

Describe the bug

https://ammonite.io/#import$exec

This is similar to import $file, except that it dumps the definitions and imports from the script into your REPL session. This is useful if you are using a script to hold a set of common imports: using import $file to import a script doesn't propagate imports from that script into your REPL.

To Reproduce

Steps to reproduce the behavior:

imports.sc

object Imports {
  def hello() = println("hello, world!")
}
import Imports._

script.sc

import $exec.imports
hello()

Metals shows an error: "not found: value hello".

Expected behavior

Metals shows no errors.

Installation:

  • Operating system: Linux
  • Editor: Emacs
  • Metals version: v0.10.8
@tgodzik
Copy link
Contributor

tgodzik commented Nov 2, 2021

Thanks for reporting! Normally ammonite generates special files that we can use to make it all work with the $file imports. This doesn't seem to happen with $exec, not sure where it can be handled. @alexarchambault any pointer where we should look?

@tgodzik tgodzik transferred this issue from scalameta/metals Nov 2, 2022
@tgodzik tgodzik changed the title import $exec in Ammonite scripts is not supported support import $exec in Ammonite scripts Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants