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

OPTIONS and LANGUAGE completion using ghci #444

Merged
merged 5 commits into from
Apr 22, 2015

Conversation

ikirill
Copy link
Contributor

@ikirill ikirill commented Jan 22, 2015

Similar to a previous PR, this adds completion for LANGUAGE and OPTIONS ghc pragmas inside comments, using ghci's :complete repl ":set ...", which understands all language/option flags.

It's not spectacularly useful because normally (?) you'd need to type the first three (?) characters yourself before completion kicks in.

I also made a small change to some previous code to avoid some unnecessary string -> symbol -> string conversion.

symbol-at-point => thing-at-point 'symbol

Also thing-at-point, then bounds-of-thing-at-point looks it up twice,
which is unnecessary.
@hvr
Copy link
Member

hvr commented Jan 22, 2015

The allowed LANGUAGE and OPTIONS_GHC values are static information (and can hence be cached indexed by ghc-version, no need to reach out to GHCi for each single completion here).

IIRC, those lists already collected elsewhere at startup by quering ghc --supported-languages and ghc --show-options respectively for use by Haskell snippets (which is an alternative, and in some way more efficient way to input and complete LANGUAGE/OPTIONS_GHC pragmas IMHO).

Also, move option/language-pragma lists out of haskell-yas, because it's
nothing to do with yasnippet, and they are needed for completion.
@ikirill
Copy link
Contributor Author

ikirill commented Jan 22, 2015

I see, I found it: it's in haskell-yas, and you have to type "lang" by itself, not inside a comment, and it will expand to a LANGUAGE pragma inside a proper comment and offer completions. I missed that, I didn't look in the yasnippet menu carefully.

I can't find an OPTIONS snippet, I think it's not there.

I would still like for ordinary non-snippet completion to work for these too.

I changed it to precompute the list of completions properly.

@gracjan
Copy link
Contributor

gracjan commented Jan 23, 2015

I vote to have @ikirill s version of completion instead of the yas snippet. See #435 for reference.

@ikirill
Copy link
Contributor Author

ikirill commented Jan 23, 2015

@gracjan I didn't remove the snippet, I added completion but it doesn't replace the snippet.

@hvr
Copy link
Member

hvr commented Jan 23, 2015

@gracjan those two facilities (snippet vs. completion-at-point) are not mutually exclusive (but rather complementary -- I use both), I just wanted to hint at that there's already infrastructure that could be shared.

lukehoersten added a commit that referenced this pull request Apr 22, 2015
OPTIONS and LANGUAGE completion using ghci
@lukehoersten lukehoersten merged commit 64cb818 into haskell:master Apr 22, 2015
@lukehoersten lukehoersten self-assigned this Apr 22, 2015
@lukehoersten
Copy link
Member

I just committed a change renaming haskell-ghc-supported-languages to haskell-ghc-supported-extensions to make it a bit more clear. The config variable is renamed and redocumented as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants