@@ -75,15 +75,23 @@ descriptor recorder plId = (defaultPluginDescriptor plId) { pluginNotificationHa
75
75
\ ide vfs _ (DidChangeTextDocumentParams identifier@ VersionedTextDocumentIdentifier {_uri} changes) -> liftIO $ do
76
76
atomically $ updatePositionMapping ide identifier changes
77
77
whenUriFile _uri $ \ file -> do
78
- addFileOfInterest ide file Modified {firstOpen= False }
79
- setFileModified (cmapWithPrio LogFileStore recorder) (VFSModified vfs) ide False file
78
+ let foiStatus = case getSourceFileOrigin file of
79
+ FromProject -> Modified {firstOpen= True }
80
+ FromDependency -> ReadOnly
81
+ addFileOfInterest ide file foiStatus
82
+ unless (foiStatus == ReadOnly )
83
+ $ setFileModified (cmapWithPrio LogFileStore recorder) (VFSModified vfs) ide False file
80
84
logDebug (ideLogger ide) $ " Modified text document: " <> getUri _uri
81
85
82
86
, mkPluginNotificationHandler LSP. SMethod_TextDocumentDidSave $
83
87
\ ide vfs _ (DidSaveTextDocumentParams TextDocumentIdentifier {_uri} _) -> liftIO $ do
84
88
whenUriFile _uri $ \ file -> do
85
- addFileOfInterest ide file OnDisk
86
- setFileModified (cmapWithPrio LogFileStore recorder) (VFSModified vfs) ide True file
89
+ let foiStatus = case getSourceFileOrigin file of
90
+ FromProject -> OnDisk
91
+ FromDependency -> ReadOnly
92
+ addFileOfInterest ide file foiStatus
93
+ unless (foiStatus == ReadOnly )
94
+ $ setFileModified (cmapWithPrio LogFileStore recorder) (VFSModified vfs) ide True file
87
95
logDebug (ideLogger ide) $ " Saved text document: " <> getUri _uri
88
96
89
97
, mkPluginNotificationHandler LSP. SMethod_TextDocumentDidClose $
0 commit comments