From 4f55cb3bda07ee839794d51b313bd90900d69855 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Mon, 8 Jul 2019 21:47:38 +0200 Subject: [PATCH] Fix VSCode extension and remove silly warnings (#2042) --- azure-cron.yml | 2 ++ .../src/DA/Service/Daml/LanguageServer.hs | 2 +- .../src/Development/IDE/LSP/Notifications.hs | 15 +++++++-------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/azure-cron.yml b/azure-cron.yml index e354218ac2..871def7142 100644 --- a/azure-cron.yml +++ b/azure-cron.yml @@ -178,6 +178,8 @@ jobs: git checkout $GITHUB cd compiler/daml-extension yarn + # This produces out/src/extension.js + yarn run compile vsce publish ${GITHUB#v} -p $MARKETPLACE_TOKEN else if [[ "${GITHUB#v}" == "$MARKET" ]]; then diff --git a/compiler/damlc/daml-ide/src/DA/Service/Daml/LanguageServer.hs b/compiler/damlc/daml-ide/src/DA/Service/Daml/LanguageServer.hs index 6f9fe48c48..c37bf042fb 100644 --- a/compiler/damlc/daml-ide/src/DA/Service/Daml/LanguageServer.hs +++ b/compiler/damlc/daml-ide/src/DA/Service/Daml/LanguageServer.hs @@ -55,7 +55,7 @@ setHandlersVirtualResource = PartialHandlers $ \WithMessage{..} x -> return x {LSP.didOpenTextDocumentNotificationHandler = withNotification (LSP.didOpenTextDocumentNotificationHandler x) $ \_ ide (DidOpenTextDocumentParams TextDocumentItem{_uri}) -> withUriDaml _uri $ \vr -> do - logInfo (ideLogger ide) $ "Opened virtual resource NEIL: " <> textShow vr + logInfo (ideLogger ide) $ "Opened virtual resource: " <> textShow vr modifyOpenVirtualResources ide (S.insert vr) ,LSP.didCloseTextDocumentNotificationHandler = withNotification (LSP.didCloseTextDocumentNotificationHandler x) $ diff --git a/compiler/hie-core/src/Development/IDE/LSP/Notifications.hs b/compiler/hie-core/src/Development/IDE/LSP/Notifications.hs index 66c07862ea..2513cfef2d 100644 --- a/compiler/hie-core/src/Development/IDE/LSP/Notifications.hs +++ b/compiler/hie-core/src/Development/IDE/LSP/Notifications.hs @@ -18,25 +18,24 @@ import Development.IDE.Types.Logger import Development.IDE.Core.Service import Development.IDE.Types.Location +import Control.Monad.Extra import qualified Data.Set as S import Development.IDE.Core.FileStore import Development.IDE.Core.OfInterest -whenUriFile :: IdeState -> Uri -> (NormalizedFilePath -> IO ()) -> IO () -whenUriFile ide uri act = case LSP.uriToFilePath uri of - Just file -> act $ toNormalizedFilePath file - Nothing -> logWarning (ideLogger ide) $ "Unknown scheme in URI: " <> getUri uri +whenUriFile :: Uri -> (NormalizedFilePath -> IO ()) -> IO () +whenUriFile uri act = whenJust (LSP.uriToFilePath uri) $ act . toNormalizedFilePath setHandlersNotifications :: PartialHandlers setHandlersNotifications = PartialHandlers $ \WithMessage{..} x -> return x {LSP.didOpenTextDocumentNotificationHandler = withNotification (LSP.didOpenTextDocumentNotificationHandler x) $ \_ ide (DidOpenTextDocumentParams TextDocumentItem{_uri}) -> do setSomethingModified ide - whenUriFile ide _uri $ \file -> + whenUriFile _uri $ \file -> do modifyFilesOfInterest ide (S.insert file) - logInfo (ideLogger ide) $ "Opened text document: " <> getUri _uri + logInfo (ideLogger ide) $ "Opened text document: " <> getUri _uri ,LSP.didChangeTextDocumentNotificationHandler = withNotification (LSP.didChangeTextDocumentNotificationHandler x) $ \_ ide (DidChangeTextDocumentParams VersionedTextDocumentIdentifier{_uri} _) -> do @@ -51,7 +50,7 @@ setHandlersNotifications = PartialHandlers $ \WithMessage{..} x -> return x ,LSP.didCloseTextDocumentNotificationHandler = withNotification (LSP.didCloseTextDocumentNotificationHandler x) $ \_ ide (DidCloseTextDocumentParams TextDocumentIdentifier{_uri}) -> do setSomethingModified ide - whenUriFile ide _uri $ \file -> + whenUriFile _uri $ \file -> do modifyFilesOfInterest ide (S.delete file) - logInfo (ideLogger ide) $ "Closed text document: " <> getUri _uri + logInfo (ideLogger ide) $ "Closed text document: " <> getUri _uri }