File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
src/Development/IDE/Types Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ test-suite ghcide-tests
245
245
haddock-library ,
246
246
haskell-lsp,
247
247
haskell-lsp-types,
248
+ network-uri,
248
249
lens,
249
250
lsp-test >= 0.8 ,
250
251
parser-combinators,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module Development.IDE.Types.Location
17
17
, LSP. NormalizedFilePath
18
18
, fromUri
19
19
, emptyFilePath
20
+ , emptyPathUri
20
21
, toNormalizedFilePath'
21
22
, LSP. fromNormalizedFilePath
22
23
, filePathToUri'
@@ -53,7 +54,9 @@ uriToFilePath' uri
53
54
| otherwise = LSP. uriToFilePath uri
54
55
55
56
emptyPathUri :: LSP. NormalizedUri
56
- emptyPathUri = LSP. NormalizedUri (hash (" " :: String )) " "
57
+ emptyPathUri =
58
+ let s = " file://"
59
+ in LSP. NormalizedUri (hash s) s
57
60
58
61
filePathToUri' :: LSP. NormalizedFilePath -> LSP. NormalizedUri
59
62
filePathToUri' = LSP. normalizedFilePathToUri
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import Language.Haskell.LSP.Messages
31
31
import Language.Haskell.LSP.Types
32
32
import Language.Haskell.LSP.Types.Capabilities
33
33
import Language.Haskell.LSP.VFS (applyChange )
34
+ import Network.URI
34
35
import System.Environment.Blank (setEnv )
35
36
import System.FilePath
36
37
import System.IO.Extra
@@ -2110,6 +2111,13 @@ unitTests = do
2110
2111
uriToFilePath' (fromNormalizedUri $ filePathToUri' " " ) @?= Just " ."
2111
2112
, testCase " empty file path works using toNormalizedFilePath'" $
2112
2113
uriToFilePath' (fromNormalizedUri $ filePathToUri' (toNormalizedFilePath' " " )) @?= Just " "
2114
+ , testCase " empty path URI" $ do
2115
+ Just URI {.. } <- pure $ parseURI (T. unpack $ getUri $ fromNormalizedUri emptyPathUri)
2116
+ uriScheme @?= " file:"
2117
+ uriPath @?= " "
2118
+ , testCase " from empty path URI" $ do
2119
+ let uri = Uri " file://"
2120
+ uriToFilePath' uri @?= Just " "
2113
2121
]
2114
2122
2115
2123
-- | Wrapper around 'LSPTest.openDoc'' that sends file creation events
You can’t perform that action at this time.
0 commit comments