haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

#2794 Initial HIndent support

Open uhbif19 opened this issue 3 years ago • 27 comments

I am not quite sure if I am using HIndent API correctly, but it does format something.

Currently I do not handle config, cuz not sure where to call getConfig :: IO Config (https://github.com/mihaimaruseac/hindent/blob/master/src/main/Main.hs#L77).

There is some story with [Extension] param. As far as I understand providing Config should be enough. (https://github.com/mihaimaruseac/hindent/blob/master/src/HIndent.hs#L71)

uhbif19 avatar May 07 '22 19:05 uhbif19

You will need to add the test suite to the GitHub CI test.yml

pepeiborra avatar May 08 '22 15:05 pepeiborra

Currently I do not handle config, cuz not sure where to call getConfig :: IO Config (https://github.com/mihaimaruseac/hindent/blob/master/src/main/Main.hs#L77).

You can setup a handler for the LSP Initialised event and call it there:

https://github.com/haskell/haskell-language-server/blob/65fbc5e41cf407ce98a03f5faa0a1b93c995b7d6/exe/Main.hs#L54-L57

pepeiborra avatar May 08 '22 16:05 pepeiborra

I think it would also be fine to call it in the handler, that's what the stylish-haskell plugin does, for example.

michaelpj avatar May 08 '22 20:05 michaelpj

Looks like some yak-shaving required to make this to build: https://github.com/mihaimaruseac/hindent/issues/583

uhbif19 avatar May 09 '22 03:05 uhbif19

Looks like getConfig is not exported from hindent. So I can either try to change hindent or copy getConfig with Path.File and bunch of dependencies. Which way is better?

uhbif19 avatar May 09 '22 04:05 uhbif19

So I can either try to change hindent

That would be ideal. Maybe open an issue and see what the maintainer thinks is the best way of doing it. People are typically happy to be included in HLS, so hopefully you'll get a response :)

michaelpj avatar May 09 '22 09:05 michaelpj

Issue created: https://github.com/mihaimaruseac/hindent/issues/585

uhbif19 avatar May 09 '22 17:05 uhbif19

Looks like upstream isn't very responsive at the minute. Perhaps copying getConfig is the least bad option in the short term?

michaelpj avatar Jun 14 '22 22:06 michaelpj

@michaelpj Maybe I will write universal config-looking function working for both HIndent and Stan? Where should I place it?

uhbif19 avatar Jun 15 '22 16:06 uhbif19

I don't think that necessarily makes sense since different projects have different config mechanisms. As much as possible we should use upstream.

michaelpj avatar Jun 15 '22 16:06 michaelpj

@michaelpj

getConfig was added and tests use configuration file now.

Where is still git-dependencty in cabal project, cuz build fix is not released yet.

uhbif19 avatar Jun 16 '22 17:06 uhbif19

Sorry, just one last thing I missed before - docs! Can you add this plugin to the "Features" doc and also add a line for it about GHC version support on the GHC version compatibility page.

michaelpj avatar Jun 17 '22 21:06 michaelpj

@michaelpj Circleci CI tasks are stalled. Can I do something to fix this?

uhbif19 avatar Jun 18 '22 14:06 uhbif19

Not sure tbh!

michaelpj avatar Jun 18 '22 15:06 michaelpj

They seem to be passing on other jobs, maybe just try pushing a trivial commit and see if they start up this time?

michaelpj avatar Jun 19 '22 16:06 michaelpj

@michaelpj Tried. Seems like it still does not work.

uhbif19 avatar Jun 19 '22 19:06 uhbif19

It does just seem to be this PR, I really have no idea why. Try making another PR with the same content?

michaelpj avatar Jun 19 '22 19:06 michaelpj

@michaelpj These PR seems stuck too:

https://github.com/haskell/haskell-language-server/pull/2949 https://github.com/haskell/haskell-language-server/pull/2956 https://github.com/haskell/haskell-language-server/pull/2908

uhbif19 avatar Jun 19 '22 19:06 uhbif19

CI fails on Nix builds. Nix tries to build hindent 5.3.2 while deps use another version, I do not know why.

uhbif19 avatar Jul 15 '22 14:07 uhbif19

@uhbif19 are you able to wrap up this PR?

pepeiborra avatar Aug 13 '22 09:08 pepeiborra

@pepeiborra Will try to fix fails in next couple of days.

uhbif19 avatar Aug 13 '22 19:08 uhbif19

@michaelpj Another strange CI (bug?): "Could not find a usable config.yml because you deleted the CircleCI OAuth app."

Do you know anything about it?

uhbif19 avatar Aug 16 '22 22:08 uhbif19

You are oddly cursed, nobody else seems to have trouble with CircleCI :sweat_smile:

michaelpj avatar Aug 17 '22 12:08 michaelpj

Okay, looks like a genuine failure on stackage-lts16 now.

michaelpj avatar Aug 17 '22 13:08 michaelpj

This looks like hindent problem, I created an issue: https://github.com/mihaimaruseac/hindent/issues/589

uhbif19 avatar Aug 17 '22 14:08 uhbif19

Now all CI jobs are getting stuck.

uhbif19 avatar Aug 22 '22 03:08 uhbif19

@uhbif19 are you able to resolve the conflicts? Hopefully that will unstuck CI

pepeiborra avatar Aug 28 '22 16:08 pepeiborra

Lol, I forgot about this PR. Does anyone need it?

uhbif19 avatar Jul 25 '23 07:07 uhbif19

Nobody has asked for it since this PR has been open, so I think it's not that popular and probably not worth it.

michaelpj avatar Jul 25 '23 09:07 michaelpj