You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wiki includes a link to a demo, however, which is useful for seeing how to implement your own autocompletion. We'd presumably want to do something similar, calling back to some PureScript code to provide the completions: https://plnkr.co/edit/6MVntVmXYUbjR0DI82Cr?p=preview&preview
There is existing PureScript code written around autocompletions in this context, namely in the purescript-language-server package. From a glance through that package, this looks relevant (but I'd like to hear if @nwolverson has any suggestions for doing this in an Ace context):
Of course, then there's the second concern: once we have the autocomplete suggestion and the user selects it, then we have to actually update the imports properly in the editor; I'm not exactly sure where this is done in the language server.
I started looking into this here but backend stuff isn't really my strong suit, and I have no idea if I'm going down the right path. Right now I'm starting up purs ide server along with server, and then running purs ide client on every request to a /complete endpoint. Does that sound about like the right approach as far as the backend implementation?
@ptrfrncsmrph it's a little round-about, ultimately you might want to just make the socket connection directly, but it should do to get started. You might want to look at the purescript client bindings https://github.com/kritzcreek/purescript-psc-ide
Activity
thomashoneyman commentedon Nov 20, 2021
Ace does provide support for autocompletion via the
ace/ext/language_tools
package. There's a wiki page with some admittedly sparse details:https://github.com/ajaxorg/ace/wiki/How-to-enable-Autocomplete-in-the-Ace-editor
The wiki includes a link to a demo, however, which is useful for seeing how to implement your own autocompletion. We'd presumably want to do something similar, calling back to some PureScript code to provide the completions:
https://plnkr.co/edit/6MVntVmXYUbjR0DI82Cr?p=preview&preview
There is existing PureScript code written around autocompletions in this context, namely in the
purescript-language-server
package. From a glance through that package, this looks relevant (but I'd like to hear if @nwolverson has any suggestions for doing this in an Ace context):https://github.com/nwolverson/purescript-language-server/blob/78086f60f2741d5fe52bbad8572c107863091eb8/src/IdePurescript/Completion.purs#L73-L84
Of course, then there's the second concern: once we have the autocomplete suggestion and the user selects it, then we have to actually update the imports properly in the editor; I'm not exactly sure where this is done in the language server.
nwolverson commentedon Nov 20, 2021
I know nothing about ace, but if (server side) you want to do completion, the language server is all driven by
purs ide server
(via purescript-psc-ide), including imports (see https://github.com/nwolverson/purescript-language-server/blob/78086f60f2741d5fe52bbad8572c107863091eb8/src/LanguageServer/IdePurescript/Completion.purs#L119 eventually ending at https://github.com/nwolverson/purescript-language-server/blob/78086f60f2741d5fe52bbad8572c107863091eb8/src/IdePurescript/Modules.purs#L191 ).For reference look at the psc-ide protocol https://github.com/purescript/purescript/blob/master/psc-ide/PROTOCOL.md - complete and import sections.
pete-murphy commentedon Feb 6, 2022
I started looking into this here but backend stuff isn't really my strong suit, and I have no idea if I'm going down the right path. Right now I'm starting up
purs ide server
along with server, and then runningpurs ide client
on every request to a/complete
endpoint. Does that sound about like the right approach as far as the backend implementation?nwolverson commentedon Feb 8, 2022
@ptrfrncsmrph it's a little round-about, ultimately you might want to just make the socket connection directly, but it should do to get started. You might want to look at the purescript client bindings https://github.com/kritzcreek/purescript-psc-ide