Hopefully fix VFS loading (by falling back to loadByURI)
This commit is contained in:
parent
da6ca97a9d
commit
f2a3f0b579
@ -232,22 +232,27 @@ loadFromVFS
|
|||||||
-> J.Uri
|
-> J.Uri
|
||||||
-> IO (LIGO Info')
|
-> IO (LIGO Info')
|
||||||
loadFromVFS funs uri = do
|
loadFromVFS funs uri = do
|
||||||
Just vf <- Core.getVirtualFileFunc funs $ J.toNormalizedUri uri
|
Core.getVirtualFileFunc funs
|
||||||
|
(J.toNormalizedUri uri)
|
||||||
|
>>= \case
|
||||||
|
Just vf -> do
|
||||||
let txt = virtualFileText vf
|
let txt = virtualFileText vf
|
||||||
let Just fin = J.uriToFilePath uri
|
let Just fin = J.uriToFilePath uri
|
||||||
(tree, _) <- parse (Text fin txt)
|
(tree, _) <- parse (Text fin txt)
|
||||||
return $ addLocalScopes tree
|
return $ addLocalScopes tree
|
||||||
|
Nothing -> do
|
||||||
|
loadByURI uri
|
||||||
|
|
||||||
-- loadByURI
|
loadByURI
|
||||||
-- :: J.Uri
|
:: J.Uri
|
||||||
-- -> IO (LIGO Info')
|
-> IO (LIGO Info')
|
||||||
-- loadByURI uri = do
|
loadByURI uri = do
|
||||||
-- case J.uriToFilePath uri of
|
case J.uriToFilePath uri of
|
||||||
-- Just fin -> do
|
Just fin -> do
|
||||||
-- (tree, _) <- runParserM . recognise =<< toParseTree (Path fin)
|
(tree, _) <- parse (Path fin)
|
||||||
-- return $ addLocalScopes tree
|
return $ addLocalScopes tree
|
||||||
-- Nothing -> do
|
Nothing -> do
|
||||||
-- error $ "uriToFilePath " ++ show uri ++ " has failed. We all are doomed."
|
error $ "uriToFilePath " ++ show uri ++ " has failed. We all are doomed."
|
||||||
|
|
||||||
collectErrors
|
collectErrors
|
||||||
:: Core.LspFuncs ()
|
:: Core.LspFuncs ()
|
||||||
|
@ -15,7 +15,7 @@ import ParseTree
|
|||||||
|
|
||||||
-- import Debug.Trace
|
-- import Debug.Trace
|
||||||
|
|
||||||
example :: FilePath
|
-- example :: FilePath
|
||||||
-- example = "../../../src/test/contracts/address.mligo"
|
-- example = "../../../src/test/contracts/address.mligo"
|
||||||
-- example = "../../../src/test/contracts/amount_lambda.mligo"
|
-- example = "../../../src/test/contracts/amount_lambda.mligo"
|
||||||
-- example = "../../../src/test/contracts/attributes.mligo"
|
-- example = "../../../src/test/contracts/attributes.mligo"
|
||||||
|
Loading…
Reference in New Issue
Block a user