jaredly / reason-language-server

A language server for reason, in reason
MIT License
659 stars 84 forks source link

Problems when installing packages with `yarn` #126

Open nlfiedler opened 6 years ago

nlfiedler commented 6 years ago

Using VS Code 1.26.1 and reason-vscode 1.0.3 on macOS. It keeps insisting that I run bsb. It was fine yesterday. Since then I installed yarn via Homebrew, and deleted the package-lock.json file. Out of pure superstition, I ran npm i to get the package-lock.json back, but that didn't help. So how do I clean this thing ("thing" being whatever needs cleaning) so it works again?

The project in question is reductive, which has bsb 3.1.1 installed locally, if that matters. I happen to have bsb 4.0.5 installed globally via npm.

The last chunk of the .lsp/debug.log file:

Read message ^M
{"jsonrpc":"2.0","id":5,"method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///Users/nfiedler/proje\
cts/reductive/examples/react/TodoApp.re"}}}
Got a method textDocument/codeLens
>> Build system: /Users/nfiedler/projects/reductive/node_modules/bs-platform/lib/bsb.exe -make-world
ninja: no work to do.
ninja: no work to do.
ninja: Entering directory `lib/bs'
ninja: no work to do.
>> Error
Duplicated package: bs-platform /Users/nfiedler/projects/reductive/node_modules/bs-platform (chosen) vs /Users/nfiedle\
r/projects/reductive/node_modules/immutable-re/node_modules/bs-platform in /Users/nfiedler/projects/reductive/node_mod\
ules/immutable-re
Affected files
Cleaning bsconfig.json
Sending notification {"jsonrpc": "2.0", "method": "textDocument/publishDiagnostics", "params": {"uri": "file:///Users/\
nfiedler/projects/reductive/bsconfig.json", "diagnostics": []}}
Deps reason-react
Dep loc /Users/nfiedler/projects/reductive/node_modules/reason-react/bsconfig.json
Compiled base: /Users/nfiedler/projects/reductive/node_modules/reason-react/lib/ocaml
Source directories: /Users/nfiedler/projects/reductive/node_modules/reason-react/src
Source files found: /Users/nfiedler/projects/reductive/node_modules/reason-react/src/ReasonReactOptimizedCreateClass.r\
e : /Users/nfiedler/projects/reductive/node_modules/reason-react/src/ReactEventRe.rei : /Users/nfiedler/projects/reduc\
tive/node_modules/reason-react/src/ReactDOMRe.re : /Users/nfiedler/projects/reductive/node_modules/reason-react/src/Re\
actDOMServerRe.re : /Users/nfiedler/projects/reductive/node_modules/reason-react/src/ReactEventRe.re : /Users/nfiedler\
/projects/reductive/node_modules/reason-react/src/ReasonReact.rei : /Users/nfiedler/projects/reductive/node_modules/re\
ason-react/src/ReasonReact.re
With compiled base:
Sending response {"id": 5, "jsonrpc": "2.0", "result": [{"range": {"start": {"line": 0, "character": 0}, "end": {"line\
": 0, "character": 0}}, "command": {"title": "Unable to load compilation data: You need to run bsb first so that reaso\
n-language-server can access the compiled artifacts.\nOnce you've run bsb, restart the language server.", "command": "\
"}}]}

Thanks for this extension, it's been really nice so far.

jaredly commented 6 years ago

Hmmm that's not a very helpful error message :/

I just released version 1.0.4 -- could you try with that? I cloned reductive & it worked just fine.

nlfiedler commented 6 years ago

Thanks for looking int to. I'm attaching the log file, after quitting, deleting the file, and starting VS Code again, so it's as small as I can make it. As I said earlier, it was working and suddenly stopped working. I assume there's something subtle and mysterious that I did to mess it up. My question is, what do I do to clear the cache or whatever so it works again? I really want this to work because the other reason extension gets hung up on my "syntax errors" much too often.

debug.log

P.S. I tried 1.0.4, didn't make any difference. But thanks for updating this great extension.

jaredly commented 6 years ago

Hmm @nlfiedler that error message means "we couldn't find the ./lib directory". Is it there?

nlfiedler commented 6 years ago

@jaredly I have figured it out. It was indeed the change I made earlier, and that was to switch from npm to yarn for use with reductive. When I first cloned reductive I was not yet familiar with yarn, so I used npm i instead. Everything was fine. Eventually I switched to yarn, so I cleared everything away and ran yarn. That's when the trouble started. I think what "fixed" it this time was that I removed everything, including node_modules, and ran npm i to fetch and rebuild everything. Whatever yarn is doing, it's not sufficient for reason-vscode.

nlfiedler commented 6 years ago

Just to be sure, I removed the build artifacts and node_modules, then ran yarn cache clean, and yarn --force install, opened VS Code; still not happy. Closed VS Code, deleted everything, ran npm i, opened VS Code, and it's happy. Nothing installed in yarn globally. For npm, I have bs-platform@4.0.5 and reason-cli@3.3.3-macos-1 installed globally. Not sure if that makes a difference.

jaredly commented 6 years ago

ooh, thanks for figuring out the cause!

MoOx commented 5 years ago

I am using yarn with this plugin & never got any issue. @jaredly it seems the situation is better now.