mirror of
https://github.com/haskell/ghcide.git
synced 2024-12-15 04:43:41 +03:00
Fix VSCode extension and remove silly warnings (#2042)
This commit is contained in:
parent
0743b0e47c
commit
906e5f85b1
@ -18,23 +18,22 @@ 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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user