nwolverson / vscode-ide-purescript

PureScript IDE support for VS Code
https://marketplace.visualstudio.com/items/nwolverson.ide-purescript
MIT License
188 stars 35 forks source link

0.10 problems #67

Closed homam closed 7 years ago

homam commented 7 years ago

I was getting this error (Error: Cannot find module 'purescript-language-server') in Output pane.

macOS 10.12.5

$ purs --version
0.11.4

Manually installing purescript-language-server seems fixed the problem.

$ cd ~/.vscode/extensions/nwolverson.ide-purescript-0.10.0
$ npm install purescript-language-server
ploeh commented 7 years ago

I'm seeing this on Windows 10 as well. This happened after I updated the PureScript IDE extension about an hour ago.

ploeh commented 7 years ago

FTR, I managed to find and install PureScript IDE version 0.9.3, and now the extension works again without errors.

nwolverson commented 7 years ago

How embarrassing, failed almost before the first hurdle.

New version published (0.10.2), which should resolve this issue.

ploeh commented 7 years ago

Thank you for your prompt response 👍

Version 0.10.2 brings back tool-tip type information, but now the compile-on-save feature seems to be broken. Same for version 0.10.3.

What I mean is that no compiler errors or warnings pop up in the Problems tab when I save a .purs file, but when I attempt to build with pulp, I can see errors or warnings. Going back to version 0.9.3 of PureScript IDE fixes that problem as well...

nwolverson commented 7 years ago

@ploeh that's unfortunate, that does work for me as before (with the published version). Can you check the Output window for "IDE Purescript"?

I'll see if I can reproduce if it's a windows problem

Update: I can reproduce, seeing errors about removing a temp file. Hover and completion seem fine though.

ploeh commented 7 years ago

I see that PureScript IDE 0.10.4 is published, but FWIW, it still doesn't work for me. Here's what my Output window displays:

PureScript Language Server started
[Info  - 22.09.10] {"processId":7736,"rootPath":"c:\\Users\\mark\\Desktop\\FractalTree","rootUri":"file:///c%3A/Users/mark/Desktop/FractalTree","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true},"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":false},"symbol":{"dynamicRegistration":true},"executeCommand":{"dynamicRegistration":true}},"textDocument":{"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"completionItem":{"snippetSupport":true}},"hover":{"dynamicRegistration":true},"signatureHelp":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"definition":{"dynamicRegistration":true},"codeAction":{"dynamicRegistration":true},"codeLens":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true}}},"trace":"off"}
[Info  - 22.09.10] Resolved psc-ide-server paths (1st is used):
[Info  - 22.09.10] C:\Users\mark\AppData\Roaming\npm\purs.CMD: 0.11.4

Found existing port from file: 15733, cwd: c:\Users\mark\Desktop\FractalTree
Found psc-ide-server on port 15733 with correct path: c:\Users\mark\Desktop\FractalTree
[Info  - 22.09.10] Found existing psc-ide-server with correct path on port 15733
Started IDE server
[Error - 22.09.13] Error: read ECONNRESET
    at exports._errnoException (util.js:1022:11)
    at TCP.onread (net.js:572:26)
(node:8440) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[Error - 22.09.18] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed with message: connect ECONNREFUSED 127.0.0.1:15733
  Code: -32603 
[Error - 22.09.20] Error: connect ECONNREFUSED 127.0.0.1:15733
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)

If there's anything I can do to assist in troubleshooting, then please let me know. I am, however, completely new to Purescript - I started playing with it two days ago...

nwolverson commented 7 years ago

@ploeh updated & now works for me on windows again, but looks like you maybe have another problem. I'd try killing anything that might be watching/building in that dir (eg pscid) and removing .psc-ide-port before running Code

ploeh commented 7 years ago

@nwolverson, that's quite possible. I tried updating to version 0.10.4, removed .psc-ide.port from my project's root directory, rebooted the computer. Same problem.

Going back to version 0.9.3 resolves the problem. No reboot required...

Is there anything else I can try to do to troubleshoot?

I have some 20-odd years of programming experience, but I only started Purescript two days ago, and I'm also almost blank on the rest of the JavaScript ecosystem, so you can assume that I come with an odd mix of ignorance and sophistication 😄 My problem is probably something utterly banal...

(FWIW, I have a background in .NET development (C# and F#), but I've also been toying with Haskell for a few years now...)

nwolverson commented 7 years ago

Hmm, seems to be an issue with TCP connection to IDE server from the language server process. That's moved from inside Code to a spawned node process, so could be an issue with node version, or opening a local port from that process (blocked with some firewall etc?)

May be worth noting the port logged, run purs ide server -p <PORT> --log-level debug and see what happens (In fact also check if there's such a purs ide server process running or if it died).

Interested to see if anyone else finds this worked on 0.9.3 and breaks on 0.10.5+

ploeh commented 7 years ago

I'm not sure I'm doing this correctly, but I've tried running that command on both 0.9.3 and 0.10.5.

0.9.3

When I start Code with version 0.9.3 installed, a pop-up informs me of the port number. I noted the port and then ran the command. Nothing much seemed to happen:

$ purs ide server -p 15436 --log-level debug
Parsed Options:
ServerOptions {_serverDirectory = Nothing, _serverGlobs = [], _serverOutputPath = "output/", _serverPort = 15436, _serverNoWatch = False, _serverPolling = True, _serverLoglevel = LogDebug}
[Debug] Reloaded File at: C:\Users\mark\Desktop\FractalTree\output\Main\externs.json
[Debug] Reloaded File at: C:\Users\mark\Desktop\FractalTree\output\Main\externs.json

This was after I tried to make various small changes in a single code file.

0.10.5

Version 0.10.5 seems to be non-deterministic. Sometimes, it actually works, but then sometimes, it doesn't. When I start up Code with this version installed, there's no pop-up message, but I looked in the Output window and found the port number there:

Found existing port from file: 15758, cwd: c:\Users\mark\Desktop\FractalTree
Found psc-ide-server on port 15758 with correct path: c:\Users\mark\Desktop\FractalTree
[Info  - 10.46.54] Found existing psc-ide-server with correct path on port 15758
Started IDE server

Again, I ran the command you suggested:

$ purs ide server -p 15758 --log-level debug
Parsed Options:
ServerOptions {_serverDirectory = Nothing, _serverGlobs = [], _serverOutputPath = "output/", _serverPort = 15758, _serverNoWatch = False, _serverPolling = True, _serverLoglevel = LogDebug}
[Debug] Accepted a connection @(main:Command.Ide app\Command\Ide.hs:194:5)
[Debug] Received command: {"params":{"file":"C:\\Users\\mark\\AppData\\Local\\Temp\\ide-purescript-c--Users-mark-Desktop-FractalTree-src-Main.purs","type":"import"},"command":"list"} @(main:Command.Ide app\Command\Ide.hs:204:9)
[Debug] Accepted a connection @(main:Command.Ide app\Command\Ide.hs:194:5)
[Debug] Received command: {"params":{"type":"loadedModules"},"command":"list"} @(main:Command.Ide app\Command\Ide.hs:204:9)
[Debug] Accepted a connection @(main:Command.Ide app\Command\Ide.hs:194:5)
[Debug] Received command: {"params":{"currentModule":null,"matcher":null,"filters":[{"params":{"search":"trunk"},"filter":"prefix"},{"params":{"modules":[]},"filter":"modules"}]},"command":"complete"} @(main:Command.Ide app\Command\Ide.hs:204:9)
[Debug] Accepted a connection @(main:Command.Ide app\Command\Ide.hs:194:5)
[Debug] Received command: {"params":{"file":"c:\\Users\\mark\\Desktop\\FractalTree\\src\\Main.purs"},"command":"rebuild"} @(main:Command.Ide app\Command\Ide.hs:204:9)
[Debug] Accepted a connection @(main:Command.Ide app\Command\Ide.hs:194:5)
[Debug] Received command: {"params":{"file":"C:\\Users\\mark\\AppData\\Local\\Temp\\ide-purescript-c--Users-mark-Desktop-FractalTree-src-Main.purs","type":"import"},"command":"list"} @(main:Command.Ide app\Command\Ide.hs:204:9)

This doesn't look particularly useful to me, though, but then I'm also completely new to this ecosystem...

Not urgent

To be clear, this isn't at all urgent to me. I had a little weekend project, taking PureScript for a spin (and I wrote a blog post about it), and I liked it. I don't, however, expect to write PureScript again in the near future, but I thought I'd report the problem, in case it was a more wide-spread problem.

Thank you for a(n otherwise) great VS Code extension 👍

dcastro commented 7 years ago

I was having the same issues as @homam and @ploeh (and had to revert to 0.9.3 as per ploeh's tip), but they seem to have been resolved in 0.10.7. Is it working for you guys as well?

ploeh commented 7 years ago

While I haven't had the opportunity to test version 0.10.7 extensively, it seems to be working 👍

I tentatively suggest that we may consider closing the issue 😉

nwolverson commented 7 years ago

Closing this as per the last couple comments seems to be resolved with 0.10.7. Please do follow up or raise additional specific issues as appropriate.