-
-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* new parser for stuff before first declaration * remove unused pragmas, modify haddock comment on parser * working but need to clean lots of little things and add more tests * uncomment completions functions and tests (was trying to see why the test timeout), merge textedits to get around lsp-test applying text edits in reverse order, inserting pragma between lines fixes, some tests * add line splitting tests, fix line splitting errors and among other things, add docs * change comments, add cpp for setting use_pos_prags bit in PState * add safeImportsOn to compat, fix ghc versions * fix compat * fix compat * fix compat 3 * fix compat 4 * fix compat 5 * fix test * fix compat 6 * add back some tests and investigate #2375 later Co-authored-by: Javier Neira <[email protected]>
- Loading branch information
1 parent
ca07742
commit 083f542
Showing
39 changed files
with
754 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenLineComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{- block comment -} -- line comment | ||
{-# LANGUAGE TupleSections #-} | ||
|
||
module BlockCommentThenLineComment where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenLineComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{- block comment -} -- line comment | ||
|
||
module BlockCommentThenLineComment where | ||
|
||
a = (1,) |
7 changes: 7 additions & 0 deletions
7
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenLineHaddock.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{- block comment -} | ||
{-# LANGUAGE TupleSections #-} | ||
-- | line haddock | ||
|
||
module BlockCommentThenLineHaddock where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenLineHaddock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{- block comment -} -- | line haddock | ||
|
||
module BlockCommentThenLineHaddock where | ||
|
||
a = (1,) |
10 changes: 10 additions & 0 deletions
10
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenMultiLineBlockComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{- block comment -} {- multi | ||
line | ||
block | ||
comment | ||
-} | ||
{-# LANGUAGE TupleSections #-} | ||
|
||
module BlockCommentThenMultiLineBlockComment where | ||
|
||
a = (1,) |
9 changes: 9 additions & 0 deletions
9
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenMultiLineBlockComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{- block comment -} {- multi | ||
line | ||
block | ||
comment | ||
-} | ||
|
||
module BlockCommentThenMultiLineBlockComment where | ||
|
||
a = (1,) |
13 changes: 13 additions & 0 deletions
13
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenMultiLineBlockHaddock.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{- block comment -} | ||
{-# LANGUAGE TupleSections #-} | ||
{-| multi | ||
line | ||
block | ||
haddock | ||
-} | ||
|
||
module BlockCommentThenMultiLineBlockHaddock where | ||
import GHC.SourceGen (multiIf) | ||
import Diagrams (block) | ||
|
||
a = (1,) |
11 changes: 11 additions & 0 deletions
11
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenMultiLineBlockHaddock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{- block comment -} {-| multi | ||
line | ||
block | ||
haddock | ||
-} | ||
|
||
module BlockCommentThenMultiLineBlockHaddock where | ||
import GHC.SourceGen (multiIf) | ||
import Diagrams (block) | ||
|
||
a = (1,) |
6 changes: 6 additions & 0 deletions
6
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenSingleLineBlockComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{- block comment -} {- single line block comment -} | ||
{-# LANGUAGE TupleSections #-} | ||
|
||
module BlockCommentThenSingleLineBlockComment where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenSingleLineBlockComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{- block comment -} {- single line block comment -} | ||
|
||
module BlockCommentThenSingleLineBlockComment where | ||
|
||
a = (1,) |
7 changes: 7 additions & 0 deletions
7
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenSingleLineBlockHaddock.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{- block comment -} | ||
{-# LANGUAGE TupleSections #-} | ||
{-| single line block haddock -} | ||
|
||
module BlockCommentThenSingleLineBlockHaddock where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/BlockCommentThenSingleLineBlockHaddock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{- block comment -} {-| single line block haddock -} | ||
|
||
module BlockCommentThenSingleLineBlockHaddock where | ||
|
||
a = (1,) |
7 changes: 7 additions & 0 deletions
7
...in/test/testdata/BlockCommentThenSingleLineBlockHaddockSingleLineBlockComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{- block comment -} | ||
{-# LANGUAGE TupleSections #-} | ||
{-| single line block haddock -} {- single line block comment -} | ||
|
||
module BlockCommentThenSingleLineBlockHaddockSingleLineBlockComment where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
...gmas-plugin/test/testdata/BlockCommentThenSingleLineBlockHaddockSingleLineBlockComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{- block comment -} {-| single line block haddock -} {- single line block comment -} | ||
|
||
module BlockCommentThenSingleLineBlockHaddockSingleLineBlockComment where | ||
|
||
a = (1,) |
11 changes: 11 additions & 0 deletions
11
plugins/hls-pragmas-plugin/test/testdata/OptionsGhcAfterDecl.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{-# LANGUAGE TupleSections #-} | ||
data Something = Something { | ||
foo :: !String, | ||
bar :: !Int | ||
} | ||
|
||
tupleSection = (1, ) <$> Just 2 | ||
|
||
{-# OPTIONS_GHC addOne #-} | ||
addOne :: Int -> Int | ||
addOne x = x + 1 |
10 changes: 10 additions & 0 deletions
10
plugins/hls-pragmas-plugin/test/testdata/OptionsGhcAfterDecl.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
data Something = Something { | ||
foo :: !String, | ||
bar :: !Int | ||
} | ||
|
||
tupleSection = (1, ) <$> Just 2 | ||
|
||
{-# OPTIONS_GHC addOne #-} | ||
addOne :: Int -> Int | ||
addOne x = x + 1 |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/PragmaFollowedBySingleLineBlockHaddock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE TypeApplications #-} {-| haddock -} | ||
|
||
module PragmaFollowedByBlockHaddock where | ||
|
||
a = (1,) |
6 changes: 6 additions & 0 deletions
6
plugins/hls-pragmas-plugin/test/testdata/PragmaThenLineComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{-# LANGUAGE TypeApplications #-} -- line comment | ||
{-# LANGUAGE TupleSections #-} | ||
|
||
module PragmaThenLineComment where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/PragmaThenLineComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE TypeApplications #-} -- line comment | ||
|
||
module PragmaThenLineComment where | ||
|
||
a = (1,) |
7 changes: 7 additions & 0 deletions
7
plugins/hls-pragmas-plugin/test/testdata/PragmaThenLineHaddock.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TupleSections #-} | ||
-- | line haddock | ||
|
||
module PragmaThenLineHaddock where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/PragmaThenLineHaddock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE TypeApplications #-} -- | line haddock | ||
|
||
module PragmaThenLineHaddock where | ||
|
||
a = (1,) |
8 changes: 8 additions & 0 deletions
8
plugins/hls-pragmas-plugin/test/testdata/PragmaThenLineHaddockNewlineLineComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TupleSections #-} | ||
-- | line haddock | ||
-- line comment | ||
|
||
module PragmaThenLineHaddockNewlineLineComment where | ||
|
||
a = (1,) |
6 changes: 6 additions & 0 deletions
6
plugins/hls-pragmas-plugin/test/testdata/PragmaThenLineHaddockNewlineLineComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{-# LANGUAGE TypeApplications #-} -- | line haddock | ||
-- line comment | ||
|
||
module PragmaThenLineHaddockNewlineLineComment where | ||
|
||
a = (1,) |
11 changes: 11 additions & 0 deletions
11
plugins/hls-pragmas-plugin/test/testdata/PragmaThenMultiLineBlockComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TupleSections #-} | ||
{- multi | ||
line | ||
block | ||
comment | ||
-} | ||
|
||
module PragmaThenSingleLineBlockComment where | ||
|
||
a = (1,) |
9 changes: 9 additions & 0 deletions
9
plugins/hls-pragmas-plugin/test/testdata/PragmaThenMultiLineBlockComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{-# LANGUAGE TypeApplications #-} {- multi | ||
line | ||
block | ||
comment | ||
-} | ||
|
||
module PragmaThenSingleLineBlockComment where | ||
|
||
a = (1,) |
11 changes: 11 additions & 0 deletions
11
plugins/hls-pragmas-plugin/test/testdata/PragmaThenMultiLineBlockHaddock.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TupleSections #-} | ||
{-| multi | ||
line | ||
block | ||
haddock | ||
-} | ||
|
||
module PragmaThenMultiLineBlockHaddock where | ||
|
||
a = (1,) |
9 changes: 9 additions & 0 deletions
9
plugins/hls-pragmas-plugin/test/testdata/PragmaThenMultiLineBlockHaddock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{-# LANGUAGE TypeApplications #-} {-| multi | ||
line | ||
block | ||
haddock | ||
-} | ||
|
||
module PragmaThenMultiLineBlockHaddock where | ||
|
||
a = (1,) |
6 changes: 6 additions & 0 deletions
6
plugins/hls-pragmas-plugin/test/testdata/PragmaThenSingleLineBlockComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{-# LANGUAGE TypeApplications #-} {- single line block comment -} | ||
{-# LANGUAGE TupleSections #-} | ||
|
||
module PragmaThenSingleLineBlockComment where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/PragmaThenSingleLineBlockComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE TypeApplications #-} {- single line block comment -} | ||
|
||
module PragmaThenSingleLineBlockComment where | ||
|
||
a = (1,) |
7 changes: 7 additions & 0 deletions
7
plugins/hls-pragmas-plugin/test/testdata/PragmaThenSingleLineBlockHaddock.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TupleSections #-} | ||
{-| single line block haddock -} | ||
|
||
module PragmaThenSingleLineBlockHaddock where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-pragmas-plugin/test/testdata/PragmaThenSingleLineBlockHaddock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE TypeApplications #-} {-| single line block haddock -} | ||
|
||
module PragmaThenSingleLineBlockHaddock where | ||
|
||
a = (1,) |
7 changes: 7 additions & 0 deletions
7
...s-plugin/test/testdata/PragmaThenSingleLineBlockHaddockSingleLineBlockComment.expected.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TupleSections #-} | ||
{-| single line block haddock -} {- single line block comment -} | ||
|
||
module PragmaThenSingleLineBlockHaddockSingleLineBlockComment where | ||
|
||
a = (1,) |
5 changes: 5 additions & 0 deletions
5
...ls-pragmas-plugin/test/testdata/PragmaThenSingleLineBlockHaddockSingleLineBlockComment.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE TypeApplications #-} {-| single line block haddock -} {- single line block comment -} | ||
|
||
module PragmaThenSingleLineBlockHaddockSingleLineBlockComment where | ||
|
||
a = (1,) |