haskell / haskell/haskell-language-server

Implement some of VSC's Java CodeActions

Open
#3,359 0 comments 1 reaction 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

Full list here: https://code.visualstudio.com/docs/java/java-refactoring

A couple ideas listed below...

----------------------

https://code.visualstudio.com/docs/java/java-refactoring#_invert-conditions

```java
// Before
public void method(int value) {
if (value > 5 && value < 15) {
// do something
}
}
// After
public void method(int value) {
if (value <= 5 || value >= 15) {
// do something
}
}
```

Or also a "flip if branches" action:
```Haskell
-- Before
if bool then tBranch else fBranch
-- After
if not bool then fBranch else tBranch
```

-----------------

https://code.visualstudio.com/docs/java/java-refactoring#_generate-constructors

We could have a code action for "create smart constructor template", which is a pretty common boilerplate in Haskell...

```
-- Before
data Foo = Foo {f1 :: Int, f2 :: Bool}
-- After
data Foo = Foo {f1 :: Int, f2 :: Bool}

mkFoo :: Int -> Bool -> Foo
mkFoo f1 f2 = _
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.