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

Expose internal library #33

Closed
wants to merge 2 commits into from
Closed

Conversation

VeryMilkyJoe
Copy link

This allows usage of cabal-fmt as a library for other projects.
Specifically I would like to use this for a cabal-fmt plugin I wrote for Haskell Language Server (https://github.com/VeryMilkyJoe/haskell-language-server/tree/cabal-fmt).

@phadej
Copy link
Owner

phadej commented Jul 24, 2022

I'm sorry, but I'm not ready to commit to maintain cabal-fmt as a library.

@phadej
Copy link
Owner

phadej commented Sep 19, 2022

After giving it a proper thought (sorry it took some time), I don't want expose cabal-fmt-internal as is.

Please describe an interface you need for your use, and we can expose just that. If it's something like cabalFmt :: FilePath -> ByteString -> ByteString (location of the file, contents, to formatted file), then it will be ok. Exposing more would need a proper discussion.

@phadej phadej closed this Sep 19, 2022
@fendor
Copy link
Contributor

fendor commented Sep 19, 2022

Hi!
Yes, that is basically what we need in HLS. Plus, it would be great if we were able to specify tabs vs spaces, and the indentation (some basic configuration).

@phadej
Copy link
Owner

phadej commented Sep 19, 2022

specify tabs vs spaces, and the indentation (some basic configuration).

Indentation is meant to be specified in file with a pragma. (I'd hate if a contributor would mess up my .cabal file because their editor is configured differently).

There is no tabs in .cabal files.

@fendor
Copy link
Contributor

fendor commented Sep 19, 2022

Indentation is meant to be specified in file with a pragma.

Didn't know there was one, tbh. LSP sucks in that regard, as it practically forces you to support tabs and spaces, as well as configurable tab size. Otherwise, it feels very weird in the UX to be able to change the indentation style, but it has no effect on the formatter.

There is no tabs in .cabal files.

My mistake, I thought --tabular meant tabs 😅

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.

3 participants