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

Not launching with NPM bin for purs executable #56

Closed
sriharshachilakapati opened this issue Mar 16, 2019 · 5 comments
Closed

Not launching with NPM bin for purs executable #56

sriharshachilakapati opened this issue Mar 16, 2019 · 5 comments

Comments

@sriharshachilakapati
Copy link
Contributor

We had some projects that are using different purescript compiler versions, and hence I decided to add the purescript version that we use as an NPM dev-dependency so that everyone will have the same compiler version.

However, I'm having some trouble trying to launch multiple projects at the same time (in different NVIM instances of course). I looked into the configuration, and added the purescript.addNpmPath key to true in the config JSON, but still using npm-bin was coming out as false.

let config =
    \ { 'purescript.autoStartPscIde': v:true
    \ , 'purescript.pscIdePort': v:null
    \ , 'purescript.autocompleteAddImport': v:true
    \ , 'purescript.pursExe': 'purs'
    \ , 'purescript.trace.server': 'verbose'
    \ , 'purescript.addNpmPath': v:true
    \ }

This is the output I'm getting from the language server client. Can you explain what am I doing wrong here?

[LC] [Log] Starting with args: [ "/Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/node", "/Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/purescript-language-server", "--stdio", "--config", "{\"purescript.pscIdePort\": null, \"purescript.addNpmPath\": true, \"purescript.autocompleteAddImport\": true, \"purescript.trace.server\": \"verbose\", \"purescript.autoStartPscIde\": true, \"purescript.pursExe\": \"purs\"}" ]
[LC] [Log] Starting with cwd: /Users/sriharshachilakapati/Projects/*****-*******-**** and using root path: /Users/sriharshachilakapati/Projects/*****-*******-****
[LC] [Info] Resolved IDE server paths (npm-bin: false) from PATH of /Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin:/Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin:/Users/sriharshachilakapati/.jenv/shims:/Users/sriharshachilakapati/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin:/Users/sriharshachilakapati/.jenv/shims:/Users/sriharshachilakapati/bin:/Users/sriharshachilakapati/Library/Android/sdk/build-tools/:/Users/sriharshachilakapati/Library/Android/sdk/platform-tools/:/Users/sriharshachilakapati/Library/Android/sdk/tools/:/Users/sriharshachilakapati/Library/Android/sdk/build-tools/:/Users/sriharshachilakapati/Library/Android/sdk/platform-tools/:/Users/sriharshachilakapati/Library/Android/sdk/tools/ (1st is used):
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/purs: 0.12.3
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin/purs: 0.11.7
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin/purs: 0.11.7
[LC] [Warning] Found multiple IDE server executables; using /Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/purs
[LC] [Info] Found existing port from file: 15275
[LC] [Info] Starting IDE server on port 15965 with cwd
[LC] [Log] Started IDE server (port 15965)
[LC] [Info] [Error] Version mismatch for the externs at: /Users/sriharshachilakapati/Projects/*****-*******-****/output/Control.Monad.Except.Trans/externs.js Expected: 0.12.3 Found: 0.12.2
@sriharshachilakapati
Copy link
Contributor Author

This is because of incorrect understanding of VS-Code plugin architecture. I didn't know that VSCode will strip the section name and give only the rest.

From NVIM, I have to pass this configuration instead:

let config =
    \ { 'autoStartPscIde': v:true
    \ , 'pscIdePort': v:null
    \ , 'autocompleteAddImport': v:true
    \ , 'pursExe': 'purs'
    \ , 'addNpmPath': v:true
    \ }

I also cannot find the use of the string trace.server in the language server, so I guess it is VS Code's plugin parameter and not for the language server. The best I can do instead is to set LanguageClient's options:

let g:LanguageClient_trace="verbose"
let g:LanguageClient_loggingLevel="INFO"

Got confused by this because I have to send the prefix purescript. to commands. Can this be added to the readme file to avoid confusion?

@sriharshachilakapati
Copy link
Contributor Author

But even after changing the configuration to that, this is not being picked up. New traces.

[LC] Project root: /Users/sriharshachilakapati/Projects/*****-*******-****
[LC] [Info] Starting IDE server
[LC] [Log] PureScript Language Server started
[LC] [Info] {"capabilities":{"textDocument":{"colorProvider":null,"completion":{"completionItem":{"snippetSupport":false}},"signatureHelp":{"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true}}}},"workspace":{"applyEdit":true,"didChangeWatchedFiles":{"dynamicRegistration":true}}},"processId":47249,"rootPath":"/Users/sriharshachilakapati/Projects/*****-*******-****","rootUri":"file:///Users/sriharshachilakapati/Projects/*****-*******-****","trace":"off"}
[LC] [Log] Starting with args: ["/Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/node","/usr/local/bin/purescript-language-server","--stdio","--config","{\"purescript.pscIdePort\": null, \"purescript.addNpmPath\": true, \"purescript.autocompleteAddImport\": true, \"purescript.trace.server\": \"verbose\", \"addNpmPath\": true, \"purescript.autoStartPscIde\": true, \"purescript.pursExe\": \"purs\"}"]
[LC] [Log] Starting with cwd: /Users/sriharshachilakapati/Projects/*****-*******-**** and using root path: /Users/sriharshachilakapati/Projects/*****-*******-****
[LC] [Info] Resolved IDE server paths (npm-bin: false) from PATH of /Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin:/Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin:/Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin:/Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin:/Users/sriharshachilakapati/.jenv/shims:/Users/sriharshachilakapati/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin:/Users/sriharshachilakapati/.jenv/shims:/Users/sriharshachilakapati/bin:/Users/sriharshachilakapati/Library/Android/sdk/build-tools/:/Users/sriharshachilakapati/Library/Android/sdk/platform-tools/:/Users/sriharshachilakapati/Library/Android/sdk/tools/:/Users/sriharshachilakapati/Library/Android/sdk/build-tools/:/Users/sriharshachilakapati/Library/Android/sdk/platform-tools/:/Users/sriharshachilakapati/Library/Android/sdk/tools/ (1stis used):
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/purs: 0.12.3
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin/purs: 0.11.7
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/purs: 0.12.3
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin/purs: 0.11.7
[LC] [Info] /Users/sriharshachilakapati/.nvm/versions/node/v9.5.0/bin/purs: 0.11.7
[LC] [Warning] Found multiple IDE server executables; using /Users/sriharshachilakapati/.nvm/versions/node/v11.9.0/bin/purs
[LC] [Info] Found existing port from file: 15345

Any ideas where I'm doing wrong?

@sriharshachilakapati
Copy link
Contributor Author

@nwolverson Can you please help me out regarding this issue?

I think it's only a configuration issue, but need help in figuring out the correct JSON to pass to language server.

@sriharshachilakapati
Copy link
Contributor Author

Bump

@sriharshachilakapati
Copy link
Contributor Author

Finally was able to figure out after going through the atom-ide plugin's code. This is the correct config to be passed.

let config =
    \ { 'autoStartPscIde': v:true
    \ , 'pscIdePort': v:null
    \ , 'autocompleteAddImport': v:true
    \ , 'pursExe': 'purs'
    \ , 'addNpmPath': v:true
    \ }

let configWrapper =
    \ { 'purescript': config
    \ }

Sending configWrapper now to language server solved this issue. However, this information is hard to find. Can you add this to the README?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant