-- | An internal version of 'runSession' that allows for a custom handler to listen to the server.
-- It also does not automatically send initialize and exit messages.
-- | An internal version of 'runSession' that allows for a custom handler to listen to the server.
-- It also does not automatically send initialize and exit messages.
mainThreadId <- myThreadId
let context = SessionContext serverIn absRootDir messageChan reqMap initRsp config caps
mainThreadId <- myThreadId
let context = SessionContext serverIn absRootDir messageChan reqMap initRsp config caps
- initState = SessionState (IdInt 0) mempty mempty 0 False Nothing
- runSession' = runSession context initState
+ initState vfs = SessionState (IdInt 0) vfs
+ mempty 0 False Nothing
+ runSession' ses = initVFS $ \vfs -> runSession context (initState vfs) ses
- update (VirtualFile oldV t mf) = VirtualFile (fromMaybe oldV v) t mf
- newVFS = Map.adjust update (toNormalizedUri uri) oldVFS
+ update (VirtualFile oldV t) = VirtualFile (fromMaybe oldV v) t
+ newVFS = updateVFS (Map.adjust update (toNormalizedUri uri)) oldVFS
let fp = fromJust $ uriToFilePath uri
contents <- liftIO $ T.readFile fp
let item = TextDocumentItem (filePathToUri fp) "" 0 contents
let fp = fromJust $ uriToFilePath uri
contents <- liftIO $ T.readFile fp
let item = TextDocumentItem (filePathToUri fp) "" 0 contents