Open rvion opened 8 years ago
same the other way around: when I fix the error in Input.purs
, I need to go to back to Main.purs
and save Main for the fix to be detected.
📝 In the same time, the pscid
works instantly. I don't need to switch back to Main module for pscid to see the Input module now contains an error
@nwolverson this problem appears to be related to https://github.com/nwolverson/atom-ide-purescript/issues/95
indeed, the file that triggers typechecking upon save has tooltips, but the other hasn't.
How can I help you on this one ?
Hmm...... after https://github.com/nwolverson/atom-ide-purescript/issues/102#issuecomment-232434994, I enabled fast rebuild, quitted Atom (Cmd-Q), restarted it, and now, it seems to be working fine, and both modules correctly typecheck upon save ! ❤️
⚠️ (It may just be a coincidence, since I also rebooted my laptop)
Seems like you hit some odd case with something in the particular file. If you can reproduce again reliably it might be interesting to see if you were able to share the project.
You're on psc 0.9.2 I think? What you wrote above seems to indicate an issue writing externs with the full compilation but not psc-ide.
if I can reproduce it reproductibly, I'll make a proper report and share a test project, sure !
I'm on psc 0.9.2, yes, on mac el capitan, using atom 1.9.0-beta0
In both my Main and Input module, I was doing some FFI.
It could also be a race condition since I have in the same time running
pulp --watch build --to test.js
(launched manyally)pscid
(launched manyally)psc-ide-server
(launched by atom)If you can reproduce the effect - even if it just happens rather than understanding the precise steps - the thing to look at would be output/Module.Name/externs.json
- is it valid JSON (or corrupted on writing somehow) and if you take a copy does it match what you get normally (when things work).
I just tried one last time without fast-rebuild
not to miss a good occasion to see if I had a reproductible test case, but the bug seems to be gone for now even without fast-rebuild. I guess "restarting my laptop" fixed it for now. I'll report any more findings if I encounter the bug.
got it, I'll pay attention to those things from now on
( 📝 edit: see the next message, I also reproduced with fast-rebuild, and wrote down steps leading to the problem)
Got the bug again without falst-rebuild:
the non reloading module is Debug.purs:
module Debug where
import Prelude
import Control.Monad.Eff (Eff)
import DOM (DOM)
foreign import p :: forall a eff. a -> Eff (dom :: DOM | eff) Unit
ss
plop
sss
s
"use strict";
exports.p = function(a){return function(){console.log(a)}};
when I save Debug.purs, the pulp --watch build --to test.js
process says:
* Source tree changed; restarting:
* Building project in /Users/rvion/dev/psc-b
Error found:
at /Users/rvion/dev/psc-b/src/Debug.purs line 12, column 1 - line 12, column 1
Unable to parse module:
unexpected end of input
expecting binder or indentation
See https://github.com/purescript/purescript/wiki/Error-Code-ErrorParsingModule for more information,
or to contribute content related to this error.
* ERROR: Subcommand terminated with exit code 1
and output/Debug/externs.json contains:
{"efVersion":"0.9.2","efModuleName":["Debug"],"efExports":[{"ValueRef":{"Ident":"p"}}],"efImports":[{"eiModule":["Prim"],"eiImportType":{"Implicit":[]},"eiImportedAs":null},{"eiModule":["Prelude"],"eiImportType":{"Implicit":[]},"eiImportedAs":null},{"eiModule":["Control","Monad","Eff"],"eiImportType":{"Explicit":[{"PositionedDeclarationRef":[{"start":[4,27],"name":"/Users/rvion/dev/psc-b/src/Debug.purs","end":[4,30]},[],{"TypeRef":["Eff",[]]}]}]},"eiImportedAs":null},{"eiModule":["DOM"],"eiImportType":{"Explicit":[{"PositionedDeclarationRef":[{"start":[5,13],"name":"/Users/rvion/dev/psc-b/src/Debug.purs","end":[5,16]},[],{"TypeRef":["DOM",[]]}]}]},"eiImportedAs":null}],"efFixities":[],"efTypeFixities":[],"efDeclarations":[{"EDValue":{"edValueName":{"Ident":"p"},"edValueType":{"tag":"ForAll","contents":["eff",{"tag":"ForAll","contents":["a",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Monad","Eff"],"Eff"]},{"tag":"RCons","contents":["dom",{"tag":"TypeConstructor","contents":[["DOM"],"DOM"]},{"tag":"TypeVar","contents":"eff"}]}]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},null]},null]}}}]}
formated, it gives :
{
"efVersion": "0.9.2",
"efModuleName": [
"Debug"
],
"efExports": [
{
"ValueRef": {
"Ident": "p"
}
}
],
"efImports": [
{
"eiModule": [
"Prim"
],
"eiImportType": {
"Implicit": []
},
"eiImportedAs": null
},
{
"eiModule": [
"Prelude"
],
"eiImportType": {
"Implicit": []
},
"eiImportedAs": null
},
{
"eiModule": [
"Control",
"Monad",
"Eff"
],
"eiImportType": {
"Explicit": [
{
"PositionedDeclarationRef": [
{
"start": [
4,
27
],
"name": "/Users/rvion/dev/psc-b/src/Debug.purs",
"end": [
4,
30
]
},
[],
{
"TypeRef": [
"Eff",
[]
]
}
]
}
]
},
"eiImportedAs": null
},
{
"eiModule": [
"DOM"
],
"eiImportType": {
"Explicit": [
{
"PositionedDeclarationRef": [
{
"start": [
5,
13
],
"name": "/Users/rvion/dev/psc-b/src/Debug.purs",
"end": [
5,
16
]
},
[],
{
"TypeRef": [
"DOM",
[]
]
}
]
}
]
},
"eiImportedAs": null
}
],
"efFixities": [],
"efTypeFixities": [],
"efDeclarations": [
{
"EDValue": {
"edValueName": {
"Ident": "p"
},
"edValueType": {
"tag": "ForAll",
"contents": [
"eff",
{
"tag": "ForAll",
"contents": [
"a",
{
"tag": "TypeApp",
"contents": [
{
"tag": "TypeApp",
"contents": [
{
"tag": "TypeConstructor",
"contents": [
[
"Prim"
],
"Function"
]
},
{
"tag": "TypeVar",
"contents": "a"
}
]
},
{
"tag": "TypeApp",
"contents": [
{
"tag": "TypeApp",
"contents": [
{
"tag": "TypeConstructor",
"contents": [
[
"Control",
"Monad",
"Eff"
],
"Eff"
]
},
{
"tag": "RCons",
"contents": [
"dom",
{
"tag": "TypeConstructor",
"contents": [
[
"DOM"
],
"DOM"
]
},
{
"tag": "TypeVar",
"contents": "eff"
}
]
}
]
},
{
"tag": "TypeConstructor",
"contents": [
[
"Data",
"Unit"
],
"Unit"
]
}
]
}
]
},
null
]
},
null
]
}
}
}
]
}
I'll now enable fast rebuild, and see if the problem pops up in the next hours
🔴 @nwolverson Ok, so I have been able to "reproduce" the problem with fast-rebuild too, and the buggy module doesn't even use FFI
Here is the steps I just did to go from "working sate" to "buggy state":
src/B.purs
and if I quit completely Atom (cmd-Q) and restart it, the problem is temporarily fixed
A
cannot know about B
until it compiled successfully at least once. We need the externs files loaded inside the server.
I have a feeling that multiple servers writing and watching the same output/
folder might create trouble.
Can you recreate the issue without pscid
running?
@kRITZCREEK @nwolverson ok, so I can now replicate the bug all the time.
pscid
pulp --watch build --to test.js
atom
Eee.purs
containing something like module Eee where
ok :: Int
ok = 3
🔴 -> it doesn't work. the newly created module is never loaded
restarting the ide-server doesn't work. The only way for ide-atom to be aware of the newly created Eee.purs is to restart Atom
completely
pscid
pulp --watch build --to test.js
atom
1.idem: create a new file Eee.purs
containing
module Eee where
ok :: Int
ok = 3
🔶 it fails for the first few seconds, until pulp --watch build --to test.js
write stuff in output folder, creating a mixed state. Then, atom still does nothing when Eee.purs is saved, but when on an other module working fine and importing Eee, it correclty sees Eee, and will report errors coming from it (it there is).
Again, restarting the ide-server doesn't do anything, and the only way to get Atom fully aware of the newly created Eee.purs is to restart Atom
completely
🔴 when I delete a file (let's say C.purs), It still appears in the autocompletion list from other modules
system infos:
$ uname -a
Darwin rvions-MBP 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
$ psc-ide-client --version
0.9.2
$ psc-ide-server --version
0.9.2
$ psc --version
0.9.2
$ pscid --version
1.10.0
atom: 1.9.0-beta0
after one more day of purescript hacking, I can confirm the reproductibility, both with and without fast-loading. (atom + atom-ide-purescript) have a problem with newly created modules, but restarting atom completely solves it until next module addition
Case 3 is #105. For the others will try to reproduce, sounds like new files aren't being watched properly.
Case 1 seems to work fine for me, maybe I'm missing something.
Eee.purs
module
content aboveMain.purs
At this point I can trigger completion from Eee
(typing ok
in Main.purs
), or add and use an import, and build successfully (by saving Main.purs
).
@nwolverson forgot to add the last step showing the bug in case 1 x)
now, go in Eee, and write something silly, like
module Eee where
ok :: Int
ok = 3
d
then hit save: no error message 🔴 (at least on my side)
if I go back to Main with the module Eee still containing the silly code, and hit save, then I'll see the errors from Eee. But while I'm editing Eee, I can write whatever, hit save, and it doesn't reload
I have the same problem. Ide doesn't see changes in other modules after fast rebuild. For example if I have modules A
and B
and module A
imports module B
, then if I add a function in module B
or write something that causes an error, module A
doesn't see it. And it happens not from time to time, but all the time. The only workaround is to reopen atom.
There is another bug that I found - Ide starts only when you open a file. If you start atom with previous session, then nothing happens.
@rvion Just tried this again and still can't reproduce (your new file/Eee
issue). Is this still an issue for you? Possibly some recent changes make something work slightly differently.
@starper Not sure if I follow. For sure if I save file B
(and it successfully builds) then the changes are reflected in A
. If B
fails to build, then the previous successful build will be the "last status" until you go fix it (as rebuild operates on a single-file basis). Can you provide some detailed steps to reproduce?
Sorry about that "write something that causes an error" thing, I haven't use purescript for month and a half and for some reason I thought that module A
could see if imported module B
has an error before. My bad. But anyway, there are still two issues left.
Here are my steps (I'll perform a step, then write it down, then perform the next one and so on):
A.purs
(file is opened in a new tab, ide is started, empty output
folder is created, .psc-ide-port
file is created)A.purs
filemodule A where
import Prelude
ctrl-o b
(using pulp
)B.purs
file with this linesmodule B where
import Prelude
import Control.Monad.Eff (Eff)
bar :: forall e. Eff e Unit
bar = pure unit
module A
and edit itmodule A where
import Prelude
import B (bar)
import Control.Monad.Eff (Eff)
foo :: forall e. Eff e Unit
foo = bar
module B
and remove this linesbar :: forall e. Eff e Unit
bar = pure unit
module A
and save it (Error: nothing happens it builds with no issues)module B
again and add new linesbaz :: forall e. Eff e Unit
baz = pure unit
module A
and edit it like thismodule A where
import Prelude
import B (baz)
import Control.Monad.Eff (Eff)
foo :: forall e. Eff e Unit
foo = baz
Cannot import value baz from module B
error)ctrl-o b
(error is gone, no issues now)Cannot import value baz from module B
error is back).psc-ide-port
file is removed)A.purs
and B.purs
are open, ide is not working).purs
file (now I can see the message that ide is working)module A
and save it (no issues now).psc-ide-port
is not removed).purs
file (Error: now message says that server is started on two different ports and there are two instances of it running)So I end up with those two issues that I described before - module A
does not see changes in module B
and ide does not work until you open some .purs
file. Plus an issue with two instances of server running at the same time. I hope it'll help.
BTW I use windows 10
, atom 1.9.4
, purescript 0.9.3
and atom-ide-purescript 0.14.6
Thanks for the detailed steps!
I'm trying to follow this, at the step
I do not see that this is the case. I get the correct complaint about bar
in
import B (bar)
If this built it would be wrong (can you maybe edit the above post to highlight parts that you believe to be in error?) So everything up until closing atom for the 1st time, works as expected for me. (I'll continue to investigate as I have different versions)
I can reproduce nothing starting when you restart the session, opened #120 (but think this is an Atom regression).
When you say "open some other .purs
file" - is that a file within the same project or elsewhere? A separate psc-ide-server
will be started if it is in another project
.purs
file is in the same project, like Main
for example. Post is updated.
@nwolverson It is still happening but I need to check if I correctly updated the plugin. my issue is the same as @starper. I found workarounds, so I cal live with it for now :)
@starper still can't see anything like the 1st issue, where A.purs
builds when it should not. I started with a fresh project created from pulp init
, same versions you listed, and followed your steps, this is what I see:
I did notice there is a race condition #121 on starting the package after re-opening the window. I'll ask you to re-test when that is fixed
I'll retest too, since what you show above doesn't work for me
@nwolverson can you tell me what tool you're using use to record screen as gif ?
That's LICEcap
(I bet there's one difference that nobody thought to notice that's causing the discrepancy but hard to track down the variables...)
Ok, so I was wrong saying that it happens all the time, it's not. Sometimes it works. I tried to find some kind of pattern, because it feels like it happens quite random, but all I can see for now is that it works at first, but then at some point it stops. So you have to mess around with it a little, adding, changing and removing functions until this bug appears. This time I was "lucky" and it failed at the very beginning...
Thanks for the link :)
I noticed that I don't create files the same way you do. I create new files with ctrl-n, followed by ctrl-s, matbe it doesn't trigger events the exact same way? (Cant't test atm, not at home)
What I've noticed is that ide sees changes in js
files. For example if you have
foreign import fooImpl :: Eff e Unit
but have no fooImpl
in js
file, there will be an error, but when you add fooImpl
, then error is gone. Maybe it'll be helpful :)
Maybe something like restart on save
option can make it work? (as a temporary workaround)
@starper to what end? You should be able to achieve this effect in your init script if that's something you find useful
@nwolverson So that people who have this issue do not have to restart editor every time this bug appears. What init script?
I think if you have to restart your editor repeatedly like that, something is badly wrong, and it would be better to track it down. I never was able to reproduce this, so it won't be fixed otherwise.
So this still happens. Does the "restart psc-ide-server" command work for you?
Init script is your atom init script, you could for example listen to file saves and run a command.
It seems that it is psc-ide-server
issue, so restarting it should work, but I can't find any command to do it, so I just restart editor. I guess restart on save
option is overkill for this issue, but some keybinding for restarting server would be great.
I just use Atom
as editor, I never looked inside of it, so I have very little understanding about what's going on in there.
There is a command "Ide Purescript: Restart Psc Ide" you can find in the command palette, the PureScript package submenu. The actual command is ide-purescript:restart-psc-ide
which can also be bound to a key (check your key bindings - ~/.atom/keymap.cson
)
It works, thanks.
With the latest purescript-v0.10.3
release everything is back to normal for me. I tried my best to reproduce this error, but everything works just fine now. If @rvion has no errors too, then I guess you can close this issue.
@starper are you on windows by chance? in 0.10.3 the server now uses a polling mechanism as the default on windows.
If someone else is seeing the same failures on other OS's I'd suggest we add a setting to this plugin to enable the polling behavior. See the --polling
option https://github.com/purescript/purescript/tree/4c792a12e3e624794be5a775f39434b88a51557c/psc-ide-server.
@kRITZCREEK yes, I'm on windows 10
.
I've been using the ide a lot today, and there is one bug 🐛 I can't figure out.
my
Main
module import anInput
module.When I write something wrong on my
Input
module and save the file, no error is shown.🔴 no error shown
When I go back to my
Main
module and hitsave
, suddenly, the bottom toolbar tells me an error is detected:and indeed, when I go back to my
Input
module, I see the error:(I'm not 100% sure, but it may have been working a few hours ago. As of now, the bug is present, and restarting the ide server doesn't solve it)