File tree 2 files changed +13
-1
lines changed
src/Development/IDE/Types
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,12 @@ fromNormalizedFilePath (NormalizedFilePath fp) = fp
66
66
-- So we have our own wrapper here that supports empty filepaths.
67
67
uriToFilePath' :: Uri -> Maybe FilePath
68
68
uriToFilePath' uri
69
- | uri == filePathToUri " " = Just " "
69
+ | uri == fromNormalizedUri emptyPathUri = Just " "
70
70
| otherwise = LSP. uriToFilePath uri
71
71
72
+ emptyPathUri :: NormalizedUri
73
+ emptyPathUri = filePathToUri' " "
74
+
72
75
filePathToUri' :: NormalizedFilePath -> NormalizedUri
73
76
filePathToUri' (NormalizedFilePath fp) = toNormalizedUri $ Uri $ T. pack $ LSP. fileScheme <> " //" <> platformAdjustToUriPath fp
74
77
where
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import Development.IDE.GHC.Util
18
18
import qualified Data.Text as T
19
19
import Development.IDE.Test
20
20
import Development.IDE.Test.Runfiles
21
+ import Development.IDE.Types.Location
21
22
import Language.Haskell.LSP.Test
22
23
import Language.Haskell.LSP.Types
23
24
import Language.Haskell.LSP.Types.Capabilities
@@ -48,6 +49,7 @@ main = defaultMain $ testGroup "HIE"
48
49
, pluginTests
49
50
, preprocessorTests
50
51
, thTests
52
+ , unitTests
51
53
]
52
54
53
55
initializeResponseTests :: TestTree
@@ -1306,3 +1308,10 @@ openTestDataDoc :: FilePath -> Session TextDocumentIdentifier
1306
1308
openTestDataDoc path = do
1307
1309
source <- liftIO $ readFileUtf8 $ " test/data" </> path
1308
1310
openDoc' path " haskell" source
1311
+
1312
+ unitTests :: TestTree
1313
+ unitTests = do
1314
+ testGroup " Unit"
1315
+ [ testCase " empty file path" $
1316
+ uriToFilePath' (fromNormalizedUri $ filePathToUri' " " ) @?= Just " "
1317
+ ]
You can’t perform that action at this time.
0 commit comments