Skip to content

haskell-session-change-target should list available targets #534

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

Closed
ivan-m opened this issue Mar 19, 2015 · 12 comments
Closed

haskell-session-change-target should list available targets #534

ivan-m opened this issue Mar 19, 2015 · 12 comments

Comments

@ivan-m
Copy link
Contributor

ivan-m commented Mar 19, 2015

There's already a few functions that deal with finding sections, but none to find all sections and return them in a list (e.g. for use with ido).

@vlatkoB
Copy link
Contributor

vlatkoB commented Oct 15, 2015

Isn't this already solved?

@ivan-m
Copy link
Contributor Author

ivan-m commented Oct 15, 2015

Yes, though it's not as nice a representation as the one presented by ebal (not to mention that it currently seems to be providing lots of extraneous values such as the description, etc.).

@vlatkoB
Copy link
Contributor

vlatkoB commented Oct 15, 2015

haskell-session-change-target calls haskell-cabal-enum-targets to get the list of targets and displays them in ido. haskell-cabal-enum-targets returns target names only. As in

("target1" "test")

Have I understood you correctly, you want the target list to have descriptions as ebal?

@ivan-m
Copy link
Contributor Author

ivan-m commented Oct 15, 2015

I do like having the lib:, exe:, etc. prefixes.

And haskell-cabal-enum-targets doesn't seem to work very well; for example, the is the result of running it on my graphviz project:

("library provides bindings for the Dot language used by the" "(<http://graphviz.org/>) suite of programs for visualising" ", as well as functions to call those programs." "features of the graphviz library include:" "head" "test-parsing" "{" "graphviz-testsuite {" "graphviz-printparse {" "graphviz-testparsing {")

Or fgl:

("inductive representation of manipulating graph data structures." "website can be found at <http://web.engr.oregonstate.edu/~erwig/fgl/haskell>." "head" "{" "fgl-tests {")

Included in here seems to be portions of the description field, and also the source-repository labels (not to mention all the {).

@vlatkoB
Copy link
Contributor

vlatkoB commented Oct 15, 2015

Must say this is the first time I see curly braces in .cabal. :-)
I removed the braces, indented Description:'s description, and now I got this:

("head" "test-parsing" "" "graphviz-testsuite" "graphviz-printparse" "graphviz-testparsing")

Seems .cabal parser doesn't honour braces but is indentation dependent.
It also doesn't filter targets only, but I made a PR to correct that.

gracjan added a commit that referenced this issue Oct 15, 2015
Filter only sections bearing targets - fixes #534
@vlatkoB
Copy link
Contributor

vlatkoB commented Oct 15, 2015

Should somewhere be a note that haskell-mode does not support curly braces in .cabal file?

@ivan-m
Copy link
Contributor Author

ivan-m commented Oct 15, 2015

Well, then that behaviour is wrong: it is perfectly acceptable to use braces to denote blocks in .cabal files.

vlatkoB added a commit to vlatkoB/haskell-mode that referenced this issue Oct 16, 2015
@vlatkoB
Copy link
Contributor

vlatkoB commented Oct 16, 2015

Looks like .cabal parser simply ignores curly braces, which means that enumerating targets works with or without them, so I fixed haskell-cabal-enum-targets function.

Indentation inside braces is another thing.
Hope this helps.

@gracjan gracjan reopened this Oct 16, 2015
@gracjan
Copy link
Contributor

gracjan commented Oct 16, 2015

Reopening due to curly braces.

@ivan-m
Copy link
Contributor Author

ivan-m commented Oct 19, 2015

@vlatkoB it seems your patch doesn't work, as if you try and change to the library you get an error of:

cabal: Unknown build target 'library'. There is no component 'library' or module 'library'.

As a workaround, hitting C-j in the ido list seems to work.

vlatkoB added a commit to vlatkoB/haskell-mode that referenced this issue Oct 20, 2015
@vlatkoB
Copy link
Contributor

vlatkoB commented Oct 20, 2015

Yes, I became aware of that when I realized I tested it on a non-library project, but had no time to fix it before.
Please try this on your projects and let me know.

@gracjan
Copy link
Contributor

gracjan commented Oct 20, 2015 via email

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