nwolverson / purescript-language-server Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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
I'm using the server with coc.nvim and configured it properly but it seems it's not respecting rootPath/rootUri to derive the correct cwd when opening a file from command line with nvim src/Main.purs
, the cwd gets set to <cwd>/src
. I can avoid the issue if I open nvim
first, and then :e src/Main.purs
.
I tried integrating this project with Vim plugins that communicate over generic Language Servers, but I haven't gotten it to work yet. Any insight you have is appreciated:
LanguageClient-neovim Issue: autozimu/LanguageClient-neovim#527
Ale PR: dense-analysis/ale#1737
(btw - is there a way to generate some log on the server side? I see the client can trigger it but maybe there's some independent flag?)
Thanks!
According to specification,
The edit should either provide changes or documentChanges
My understanding is these two fields should be exclusive, i.e., when one of the fields is filled in, the other should be empty.
Right now, this server produces output contains both fields filled, which caused autozimu/LanguageClient-neovim#724
Hey there, thanks for making this awesome lsp wrapper for purescript.
I'm currently working at creating the purescript adapter for lsp-mode in emacs. It seems that it's working for the most part, but I'm not receiving any autocompletion prompts for fully qualified modules.
E.g:
import Data.Foo as Foo
-- Typing Foo. doesn't bring up any autocompletion prompts for types/functions within Foo
I notice this warning popping up in the logs anytime I try to "dot" into a module
[Warn] Listing the loaded modules command is DEPRECATED, use the completion command and filter it to modules instead
Does this perhaps have anything to do with the issue. I gave this a try with vscode as well. It sort of works in vscode if you know what you're looking for, but doesn't give a valid set of members right off the bat. I also noticed this error in the logs when running vscode.
Thanks again!
nwolverson/vscode-ide-purescript#86
Same in Atom.
First thanks for this project.
I noticed this server behaves differently than all others I use, it only provide errors on file save. Any plans to provide instantaneous diagnostics like others? Some servers provide a flag for this, bingo for example provide the --diagnostics-style
option.
Rank by unimported qualified identifier
import Data.Map (Map)
with Map.fromFol
should rank Data.Map
suggestions first.Array.toUnfol
should suggest Data.Array
items firstIt says 'node based' and 'use as a node module' but in sections that aren't strictly about how to get this going.
Having npm i -g purescript-language-server
somewhere could be nice also because language servers are installed in all sorts of different ways and users might not be familiar with the JS ecosystem.
The install note could also go into the Usage section.
Would you be interested in a PR for either suggestion?
Right now the language server cannot show type info for local definitions.
Just wondering - I opened a ticket at ycm-core/ycmd#1065 but I thought you might know if some work has already been done on this somewhere...?
(From slack)
unknown data constructor Xβ and you already have an import for the type (e.g. X) it wonβt change it to X(..) when you tell it to import it?
Use case discussed here: nwolverson/atom-ide-purescript#170
Possibly may want to rethink the source globs configuration more generally
The build command splits arguments by space:
But this is problematic with spago
s --purs-args
flag:
spago build --purs-args="--stash --censor-lib --json-errors"
Since it will chunk these arguments as
[ "build", "--purs-args=\"--stash", "--censor-lib", "--json-errors\"" ]
It would be nice to have spago support. Something like Add Spago Sources
option in settings. And maybe even spago build -- --json-errors
as a default Build Command
.
(Not sure if this can be done without a purs-ide change)
Be nice to have a reformat imports command, currently I can apply import suggestions easily, but to apply the auto ordering, the easiest thing is to tab-complete a new import then remove it.
I don't think this is the same as code formatting necessarily, as this is something already done in purs ide server
, though there is certainly overlap if a formatter works on regions rather than whole files
coc.nvim - see #53
This is the way this was before, because LSP doesn't give a place to show extra info like module name other than full documentation.
Clobbered when adding docs.
Whenever I try to issue a find references command, I get this output instead.
[LC] [Info] [Error] Parsing the command failed. Command: {"params":{"identifier":"liftEff","namespace":"value","module":"Control.Monad.Eff.Class"},"command":"usages"} @(main:Command.Ide app/Command/Ide.hs
:187:17)
Using PureScript 0.12.5, latest purescript-language-server.
Client is LanguageClient_NeoVim, and invoked using the built-in function LanguageClient_textDocument_references()
which gives references of the identifier under cursor.
I often am left with import warnings, and it would be nice if we could fix these all in one go.
If an auto complete suggestion is fulfilled by a configurable Prelude module it could import it unqualified.
This is linked to #43. The problem is that spago build
needs the HOME
environment variable to be defined, otherwise it dies, but purescript-language-server only passes the PATH
variable:
I suppose this might be on purpose, in which case spago
will need to change to live without HOME
.
Seems like the suggestion to remove data constructor imports when only the type is used
"Full build should fix everything" - are we reloading dependencies on build completion?
Should affect
Right now it uses preferred modules when the same thing is exported from multiple places, but I think we should also rank preferred modules higher even when the exports aren't the same.
Nothing works without building, detect this and do something better
I don't know if the issue stems from purescript-language-server
or from coc.nvim. If the issue is indeed from coc.nvim, please tell me and then I'll create an issue there.
Here's a video demonstrating the issue.
(Sorry for bad quality, for some reason imgur trims down the video's quality)
Full build is returning paths like file:///c%3a/...
while path returned for single file rebuild is file:///C:/...
(just returned back to the caller), in a sense it seems these may both work after normalisation but
A user of my Vim wrapper reported today that he is not able to use an existing IDE server with the language server. From the logs, this is the configuration that I'm passing to the language server.
{ "purescript":
{ "autoStartPscIde": true
, "pscIdePort": 8898
, "autocompleteAddImport": true
, "pursExe": "purs"
, "addNpmPath": true
}
}
And he's greeted with an error as follows:
[LC] [Error] Found existing IDE server on port '8898' with wrong path: '/home/paluh/programming/purescript/projects/audiocarrier'. Correct, kill or configure a different port, and restart.
I've tried this myself, to check if it is the path that is wrong indeed, and found it is not the case:
Any idea on what are we doing wrong?
Original issue on my Vim plugin: shivamashtikar/vimmer-ps#4
haskell-ide-engine proposes to format the code via brittany. It would be possible to do the same for eg. with purty?
First of all thanks for the language server.
I'm having an issue going through the tutorials of https://github.com/adkelley/javascript-to-purescript.
The dependencies gets installed in the .psc-package folder instead of the bower_components
I believe the problem is that the server assumes (and It was correct in the past) that the deps are in the bower_components folder, see
If that is the issue maybe I can provide some help with your guidance, I'm trying to learn PS.
Currently we offer rebuild suggestion on module mismatch error message, but if we can get some compiler info that there is an externs mismatch we can be more proactive
Hey, I'm trying to use this language server with vim. According to README, the flag --config is required, but there is no explanation on what should the value contain. There is a link to vscode-ide-purescript's package.json but it doesn't help much. Would be great if you provided some example config.
I have a scenario where I'd like to setup my own server so that I can edit code in some bower link
'd projects and have the server take care of compiling code regardless of the project I'm in. It works fine in vim, so I know the server setup is good, but when I use VSCode or Atom they both start up their own server regardless of the "autostart on load" setting, which means they don't talk to the server I've setup for my own purposes.
I'll look through this code and see if I can figure out how to resolve this, but might be better if someone who understood this codebase better took a look
Not sure if this is a duplicate, or if this is even the right repo to report this issue.
I noticed that automatic import with completion in my IDE (vscode) doesn't work on Prim
classes. For example, I can type getBody
, press tab, and then this line is inserted:
import Node.Express.Request (getBody)
But typing RowToList
doesn't bring up any autocomplete options, and I need to manually add this import:
import Prim.RowList (class RowToList)
Fixing startup retry was a bit over eager and now if output/
doesn't exist we go into an ide server restart loop.
If you guys are interested into getting on the list. Might be good exposure
https://langserver.org/
Langserver.org is maintained by Sourcegraph.
To suggest additions or to update the status of a project, please file issues or submit PRs on this project at github.com/langserver/langserver.github.io
Found IDE server on port 15770 with wrong path: /path/to/project instead of /path/to/project/
I am very unfamiliar with all of the inter-workings of plugins / language-servers, do you imaging your language server would be able to work with either of these?
If so, could you give a word of advice on how to do so?
Regardless of where this behaviour originates fixing imports and ending up with blank lines is annoying. Let's squash them.
Hello there!
I tried installing the language server (in ubuntu 18.10: npm i -g purescript-language-server
) and using it in onivim with no success. Onivim comes with language server support and it does seem that there's some purescript-language-server
activity (in the developer console), but it doesn't do anything more than that, as it can be seen in the screenshot. I have no idea if this is oni's fault or not, I was hoping you could give me some pointers on how I could debug this, perhaps you could think of something :)
The language server is configured in oni with:
"language.purescript.languageServer.command": "purescript-language-server",
"language.purescript.languageServer.arguments": ["--stdio"],
oni support only --stdio
. Can't think of anything else right now. Thanks!
Seem to end up with some blank lines as if \n
s are doubled
I just see apply all / apply all import suggestions and no entry for the actual suggestion itself! (vscode)
It would be nice to parse the typed holes from the error, and provide a command which let's us interactively replace them.
Using the pattern of
import Appropriately.Qualified.LongModuleName as LongModuleName
...LongModuleName.blah
It would be nice to complete on LongModuleName
itself, as well as the qualified completions after the .
Right now go-to-definition does not work for Spago projects (even when setting the source paths to include the .spago
folder), and I think this is why:
sourceGlobs
fieldsourceGlobs
completely, and looks in the packagePath
field to get the source globs. The default value for packagePath
is "bower_components"
, so bower projects work okay.packagePath
, so I guess VSCode works with custom source paths (I have not tried) - https://github.com/nwolverson/vscode-ide-purescript/blob/d820e73d5b4564feb2111aafe1daa0341f331b7e/package.json#L113I changed purescript-language-server locally so it looked at sourceGlobs
, and go-to-definition starting working with my .spago
folder... but making the change would likely break vscode, which is not good. I need to do some more digging before I can suggest a proper fix.
LanguageClient-neovim is the most popular language client for neovim and vim. I currently have five language servers that happily integrate. This one, unfortunately, isn't working yet. Although there's psc-ide-vim
which does have some juicy actions language clients lack, I love the focused trend language servers are creating.
So let's see if we can get this server (wrapper) integrated π . Thanks for all the work so far!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.