{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack-ide/issues/81","labels_url":"https://api.github.com/repos/commercialhaskell/stack-ide/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack-ide/issues/81/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack-ide/issues/81/events","html_url":"https://github.com/commercialhaskell/stack-ide/issues/81","id":107868536,"number":81,"title":"Update editor integration to new loading approach","user":{"login":"chrisdone","id":11019,"avatar_url":"https://avatars.githubusercontent.com/u/11019?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdone","html_url":"https://github.com/chrisdone","followers_url":"https://api.github.com/users/chrisdone/followers","following_url":"https://api.github.com/users/chrisdone/following{/other_user}","gists_url":"https://api.github.com/users/chrisdone/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdone/subscriptions","organizations_url":"https://api.github.com/users/chrisdone/orgs","repos_url":"https://api.github.com/users/chrisdone/repos","events_url":"https://api.github.com/users/chrisdone/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdone/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/commercialhaskell/stack-ide/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"chrisdone","id":11019,"avatar_url":"https://avatars.githubusercontent.com/u/11019?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdone","html_url":"https://github.com/chrisdone","followers_url":"https://api.github.com/users/chrisdone/followers","following_url":"https://api.github.com/users/chrisdone/following{/other_user}","gists_url":"https://api.github.com/users/chrisdone/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdone/subscriptions","organizations_url":"https://api.github.com/users/chrisdone/orgs","repos_url":"https://api.github.com/users/chrisdone/repos","events_url":"https://api.github.com/users/chrisdone/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdone/received_events","type":"User","site_admin":false},"milestone":null,"comments":17,"created_at":"2015-09-23T07:58:40Z","updated_at":"2015-09-24T12:38:38Z","closed_at":null,"body":"Opening this issue to notify interested users and authors of editor bindings to stack-ide. This update requires you to update both `stack` and `stack-mode`. `stack-ide` the binary itself has no changes, but you can update anyway if you like.\r\n\r\nThe way loading is done with stack-ide has changed now. Initially, it would work like this:\r\n\r\n1. stack-ide is launched by stack, and stack sends the list of load targets (modules) to load.\r\n2. stack-ide would then load these modules and report errors.\r\n3. Your editor would send `RequestUpdateSession` with empty contents.\r\n\r\nNow, it's like this:\r\n\r\n1. `stack ide` is launched by the editor via `stack ide start <package-target>` (that can be acquired by `stack ide packages`).\r\n2. Your editor should call `stack ide load-targets <package-target>` to get a list of modules that are in the project.\r\n3. Your editor then sends `RequestUpdateSession` when it wants to load module(s):\r\n\r\n``` json\r\n{\r\n    \"tag\": \"RequestUpdateSession\",\r\n    \"contents\": [\r\n        {\r\n            \"tag\": \"RequestUpdateTargets\",\r\n            \"contents\": {\r\n                \"tag\": \"TargetsExclude\",\r\n                \"contents\": [\r\n                    \"src/Control/Concurrent/Execute.hs\",\r\n                    \"src/Stack/Package.hs\"\r\n                ]\r\n            }\r\n        },\r\n        {\r\n            \"tag\": \"RequestUpdateTargets\",\r\n            \"contents\": {\r\n                \"tag\": \"TargetsInclude\",\r\n                \"contents\": [\r\n                    \"src/Stack/Package.hs\"\r\n                ]\r\n            }\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nThis request will load everything necessary for `Stack.Package` and no more. The two target updates are monoidal, so the latter overrides the former (this is why you can specify Package.hs in both, a small convenience). This is much faster than the previous approach of loading everything every time. When you *do* want to load everything, you can put the complete list of modules in `TargetsInclude` and omit `TargetsExclude` entirely.\r\n\r\nReference implementation in Emacs here: https://github.com/commercialhaskell/stack-ide/blob/master/stack-mode/stack-mode.el#L892-L911\r\n\r\nIn `stack-mode` this keybinding is now:\r\n\r\n* C-c C-l  - load the current module.\r\n* C-c C-c - compile all modules.\r\n\r\nThis can be seen as analogous to `:l` in GHCi vs `cabal build`. The flycheck behaviour uses the `C-c C-l` case -- it only compiles the current module. When you want to check all modules, `C-c C-c` will trigger flycheck for all modules.\r\n\r\nPinging @lukexi ([stack-ide-sublime](https://github.com/lukexi/stack-ide-sublime) author).\r\n\r\nPinging @snoyberg @mgsloan @LukeHoersten @dysinger @CRogers."},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack-ide/issues/comments/142916305","html_url":"https://github.com/commercialhaskell/stack-ide/issues/81#issuecomment-142916305","issue_url":"https://api.github.com/repos/commercialhaskell/stack-ide/issues/81","id":142916305,"user":{"login":"rvion","id":2150990,"avatar_url":"https://avatars.githubusercontent.com/u/2150990?v=3","gravatar_id":"","url":"https://api.github.com/users/rvion","html_url":"https://github.com/rvion","followers_url":"https://api.github.com/users/rvion/followers","following_url":"https://api.github.com/users/rvion/following{/other_user}","gists_url":"https://api.github.com/users/rvion/gists{/gist_id}","starred_url":"https://api.github.com/users/rvion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvion/subscriptions","organizations_url":"https://api.github.com/users/rvion/orgs","repos_url":"https://api.github.com/users/rvion/repos","events_url":"https://api.github.com/users/rvion/events{/privacy}","received_events_url":"https://api.github.com/users/rvion/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T12:38:38Z","updated_at":"2015-09-24T12:38:38Z","body":"@chrisdone I'm on Mac\r\nI confirm that stack ide works weird even on the command line\r\n\r\nwhen I start `stack ide` from terminal\r\n```\r\n$ stack ide start ride\r\n{\"tag\":\"ResponseWelcome\",\"contents\":[0,1,1]}\r\n{\"tag\":\"ResponseLog\",\"contents\":\"[Info] Initializing ide-backend session @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:195:3)\\n\"}\r\n{\"tag\":\"ResponseLog\",\"contents\":\"[Debug] Session dir = /Users/RemiVion/dev/ride/session.98045 @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:208:3)\\n\"}\r\n{\"tag\":\"ResponseLog\",\"contents\":\"[Debug] Dist dir = /Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/ @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:210:3)\\n\"}\r\n{\"tag\":\"ResponseLog\",\"contents\":\"[Debug] Local working dir = /Users/RemiVion/dev/ride/ @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:217:17)\\n\"}\r\n{\"tag\":\"ResponseLog\",\"contents\":\"[Info] Searching for ide-backend-server on this path: /Users/RemiVion/dev/ride/.stack-work/install/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/.stack/snapshots/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/dev/neo4j-community-2.2.5/bin:/Users/RemiVion/.local/bin:/Users/RemiVion/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:341:5)\\n\"}\r\n{\"tag\":\"ResponseLog\",\"contents\":\"[Info] Found ide-backend-server - using this one: /Users/RemiVion/.local/bin/ide-backend-server @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:343:5)\\n\"}\r\n{\"tag\":\"ResponseLog\",\"contents\":\"[Debug] Recompile required, starting... @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update.ExecuteSessionUpdate ./IdeSession/Update/ExecuteSessionUpdate.hs:223:5)\\n\"}\r\n```\r\n\r\nat the very moment I finish typing `{\"tag\": \"RequestUpdateSession\", \"contents\": []}`, right after I typed the last `}`, without pressing enter, I get the rensponse from stack:\r\n\r\n```\r\n{\"tag\": \"RequestUpdateSession\", \"contents\": []}{\"tag\":\"ResponseLog\",\"contents\":\"[Debug] Recompile required, starting... @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update.ExecuteSessionUpdate ./IdeSession/Update/ExecuteSessionUpdate.hs:223:5)\\n\"}\r\n{\"tag\":\"ResponseUpdateSession\",\"contents\":{\"tag\":\"UpdateStatusDone\",\"contents\":[]}}\r\n```\r\n\r\n\r\n-------------\r\n\r\nwhen you type some specific chars (even when not pressing enter) stack-ide crash eg:\r\n\r\n```\r\n[[A{\"tag\":\"ResponseFatalError\",\"contents\":\"user error (Failed reading: satisfy)\"}\r\nProcess exited with ExitFailure 1: /Users/RemiVion/.local/bin/stack-ide --verbose --include=/Users/RemiVion/dev/ride/:/Users/RemiVion/dev/ride/src/:/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/autogen/:/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ --local-work-dir=/Users/RemiVion/dev/ride/ --ide-backend-tools-path=/Users/RemiVion/dev/ride/.stack-work/install/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/.stack/snapshots/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/dev/neo4j-community-2.2.5/bin:/Users/RemiVion/.local/bin:/Users/RemiVion/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin --dist-dir=/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/ --ghc-option=-hide-all-packages --ghc-option=-i/Users/RemiVion/dev/ride/ --ghc-option=-i/Users/RemiVion/dev/ride/src/ --ghc-option=-i/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/autogen/ --ghc-option=-i/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ --ghc-option=-stubdir=/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ --ghc-option=-optP-include --ghc-option=-optP/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/autogen/cabal_macros.h --ghc-option=-package=base --ghc-option=-package=transformers-0.4.2.0 --ghc-option=-package=lens-4.12.3 --ghc-option=-package=containers-0.5.6.2 --ghc-option=-package=text-1.2.1.3 --ghc-option=-package=Spock-0.8.1.0 --ghc-option=-package=wai-middleware-static-0.7.0.1 --ghc-option=-package=wai-extra-3.0.10 --ghc-option=-package=aeson-0.8.0.2 --ghc-option=-package=process-1.2.3.0 --ghc-option=-package=filemanip-0.3.6.3 --package-db=/Users/RemiVion/.stack/snapshots/x86_64-osx/lts-3.4/7.10.2/pkgdb/:/Users/RemiVion/dev/ride/.stack-work/install/x86_64-osx/lts-3.4/7.10.2/pkgdb/\r\n```\r\n\r\nit also seems to happen when stdin is not a tty under some other circumstances"}}