Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-ide structure change handling #19194

Merged
merged 2 commits into from
May 23, 2024

Conversation

samuel-williams-da
Copy link
Contributor

@samuel-williams-da samuel-williams-da commented May 14, 2024

Fixes #19191 and #19192

getSourceFileHome miState path = do
-- If the path is a file, we only care about the directory, as all files in the same directory share the same home
dirPath <- unsafeIOToSTM $ getDirectoryIfFile path
sourceFileHomes <- takeTMVar (sourceFileHomesVar miState)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this cache to hold the directory name, rather than file name, to avoid many IO lookups when moving an IDE

(LSP.IsClientEither, LSP.ReqMess (LSP.RequestMessage {_id})) -> replyError method _id
_ -> pure ()
_ -> pure ()
home <- atomically $ getSourceFileHome miState path
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSourceFileHome can no longer fail, so empty reply logic isn't needed

Copy link
Contributor

@dylant-da dylant-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only nitpicks, thank you for all the great work!

sdk/compiler/damlc/lib/DA/Cli/Damlc/Command/MultiIde.hs Outdated Show resolved Hide resolved
getSourceFileHome miState path = do
-- If the path is a file, we only care about the directory, as all files in the same directory share the same home
dirPath <- unsafeIOToSTM $ getDirectoryIfFile path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a newtype to be sure that every path that we lookup goes through getDirectoryIfFile first? Or is that overkill?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the key is only used in 2 places, I'd say its overkill. to do it properly you'd need to not export the constructor, and thus move the getDirectoryIfFile function to types, which doesn't feel like the right place for it

newHomeIdeData' = newHomeIdeData {ideDataOpenFiles = Set.insert openFile $ ideDataOpenFiles newHomeIdeData}
-- If we're moving the file to a disabled IDE, it should get the new warning
when (ideDataDisabled newHomeIdeData') $ traverse_ (sendClientSTM miState) $ disableIdeDiagnosticMessages newHomeIdeData'
forM_ (ideDataMain newHomeIdeData) $ \ide -> do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to send these messages even if the ide is disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, disabled essentially means disallowing the IDE to start. Usually, the IDE is killed before being disabled, so ideDataMain will be Nothing when ideDataDisabled is true, but we handle them separately here to be correct

@dylant-da
Copy link
Contributor

LGTM :)

@samuel-williams-da samuel-williams-da merged commit 894ac38 into main May 23, 2024
15 checks passed
@samuel-williams-da samuel-williams-da deleted the sw/multi-ide-structure-handling-improvements branch May 23, 2024 15:55
samuel-williams-da added a commit that referenced this pull request May 31, 2024
* Better support for package structure changes

* Rename some handlers
samuel-williams-da added a commit that referenced this pull request Jun 3, 2024
* Daml ide multi ide (#17345)

* Multi-ide refactors (#18885)

* Reimplement ProgressToken prefixing to be stateless

* Refactor parsing logic to not use interleaveIO

* Move most verbose logging behind a flag

* Address reviews

* Multi-IDE Features for 2.9 (#19040)

* Implement dar unpacking

* Implement packageless IDE

* Hot-reloading logic for daml.yaml, multi-package.yaml, *.dar

* Implement initial error recovery logic

* Switch logging to log levels
Replace window reload with LanguageServer restart

* Forward args from multi-ide to sub-ides

* Change unpacked dar paths to be the unit-id.
Update unpacking logic to shutdown previous IDEs

* Remove broken experimental flag

* Refactor ide restart logic to not lose event handlers

* Log subIDE errors to debug logger live

* Windows fixes

* First review fixes batch

* Use newtypes for many FilePaths

* Address Dylan's comments

* Refactor how SubIDEs are passed around, reduce times it is dropped

* Update diagnostic

* Multi-ide structure change handling (#19194)

* Better support for package structure changes

* Rename some handlers

* Split up MultiIde.hs into many files (#19198)

* Split up MultiIde.hs into many files

* Further split SubIde

* Multi-IDE Sdk install managament (#19256)

* Tweaks from previous version

* Implement Sdk Version management

* Address review

* Fix compilation issues

* Fix issues with 2.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants