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

Add a means of setting the Idris -p option #29

Closed
david-christiansen opened this issue Jun 12, 2015 · 14 comments
Closed

Add a means of setting the Idris -p option #29

david-christiansen opened this issue Jun 12, 2015 · 14 comments
Milestone

Comments

@david-christiansen
Copy link
Member

Idris has a global library installation directory which is divided into packages. The prelude and base packages are always available for import, but further packages need to be enabled by passing Idris the -p PKGNAME command-line option.

This is something that's project-specific, so it doesn't really make sense in the global Idris configuration area (though that can be a temporary stopgap).

In the Emacs mode, we set this option in two ways:

  1. We check if the user has set an Emacs file variable to a list of packages, and use them if so. File variables allow an Emacs Lisp variable to have a particular value when editing a particular file, and the value is stored in a specially-formatted comment. I'm not sure if Atom has a similar feature or not.
  2. If the file being edited is in a directory that contains a .ipkg file, or a subdirectory of such a directory, that file is processed to find the list of packages that a command-line invocation of idris would get from the package commands (e.g. --build, --install). These are then passed to the Idris subprocess.

I don't know the right solution for Atom, but it's pretty important to be able to do this.

@archaeron archaeron added this to the 0.3.0 milestone Jul 3, 2015
@david-christiansen
Copy link
Member Author

Probably we should set up Idris to (a) find the .ipkg file, if one exists, and (b) report back the contents of its fields, rather than re-implementing all this in every editor...

@archaeron
Copy link
Member

I support this idea :D

In the interim I we could just search for an ipkg file in the open directory and use that one without recursing through higher directories.
I'm pretty sure atom doesn't have file variables, so that option is out.

Would we have to parse the ipkg file, search for the opts opts and pass them to the compiler?
e.g.:

package highlighter

sourcedir = src
modules = SExpParse, Main
executable = highlighter
main = Main
opts = "-p lightyear --typeintype"

would result in

idris --ide-mode -p lightyear --typeintype SExpParse.idr

@david-christiansen
Copy link
Member Author

In the interim I we could just search for an ipkg file in the open
directory and use that one without recursing through higher directories.

This will only work for the simplest Idris programs - anything with a
hierarchical namespace will fail mysteriously. I don't think that's likely
to be so useful.

I'm pretty sure atom doesn't have file variables, so that option is out.

OK

Would we have to parse the ipkg file, search for the opts opts and pass
them to the compiler?
e.g.:

package highlighter

sourcedir = src
modules = SExpParse, Main
executable = highlighter
main = Main
opts = "-p lightyear --typeintype"

would result in

idris --ide-mode -p lightyear --typeintype SExpParse.idr

That's what idris-mode does.

/D

@archaeron
Copy link
Member

This will only work for the simplest Idris programs - anything with a
hierarchical namespace will fail mysteriously. I don't think that's likely
to be so useful.

When I open for instance https://github.com/archaeron/highlighter my project looks like this
highlighter_file_structure

so even if the ipkg file and the source files are not in the same directory it would work.

If on the other hand I'd just open the source folder it wouldn't.

But at least you'd see what ipkg file it would use.

@archaeron
Copy link
Member

or is this one of the simple idris programs you where talking about? :)

@david-christiansen
Copy link
Member Author

I hadn't realized that Atom had a notion of "current open directory" that was different from the directory that the file is in. This should work fine, then!

@archaeron
Copy link
Member

perfect, thanks for the answer 👍

@david-christiansen
Copy link
Member Author

:-)

@NobbZ
Copy link

NobbZ commented Aug 17, 2015

Is there some workaround to get -p support until 0.3.0 gets released? I try to play around with effects and so this plugin does only provide nice colors but nothing else… Nearly all idris related functionality is cancelled with “can't find import Effects/”.

@archaeron
Copy link
Member

there is a branch where there is some rudimentary ipkg support.
it's working for me, but I haven't tested it too much. So you could clone the repo to your packages folder and checkout the ipkg branch

@NobbZ
Copy link

NobbZ commented Aug 17, 2015

Will I get any update notifications when I switch over or do I need to pull
regularly then?

archaeron [email protected] schrieb am Mo., 17.08.2015, 20:22:

there is a branch where there is some rudimentary ipkg support.
it's working for me, but I haven't tested it too much. So you could clone
the repo to your packages folder and checkout the ipkg branch


Reply to this email directly or view it on GitHub
#29 (comment)
.

@archaeron
Copy link
Member

When I'm working on a feature branch that has not yet the newest version in the config file it tells me that there is a newer version available. But I've never tried updating then trough the official channel.

@NobbZ
Copy link

NobbZ commented Aug 18, 2015

ignore the noise… I managed to install from feature branch

@archaeron
Copy link
Member

this is now in v0.3.0

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

3 participants