ajaxorg / ace

Ace (Ajax.org Cloud9 Editor)
https://ace.c9.io
Other
26.77k stars 5.29k forks source link

Language Server Protocol Integration #3124

Closed akosyakov closed 3 months ago

akosyakov commented 8 years ago

Microsoft has announced Language Server Protocol. Is there any plans to provide integration with it?

jgoldshlag commented 8 years ago

I'm also interested in support for this

Aerilius commented 6 years ago

I would be interested as well, as it promises higher quality code-completion than I currently have, with less maintenance effort. Having LSP support helps to keep Ace relevant for my project in the long-term.

hez2010 commented 5 years ago

With LSP, Inteiilsence will be available for ace editor. Hope that ace editor can integrate LSP.

apttap commented 3 years ago

it would be a nice extension at the very least, I would love to develop a custom ide ultimately with the work I'm doing in lsp. ace would be my preferred method for that

andrewnester commented 2 years ago

Just to provide an update on this - we're looking into LSP support for Ace as it's obviously one of the most asked features, so we'll keep this thread updated with any progress we make. In the meantime feel free to provide any feedback or ideas about how would you use Ace with LSP servers

kungfooman commented 2 years ago

In the meantime feel free to provide any feedback or ideas about how would you use Ace with LSP servers

I use TypeScript for "live coding" and LSP could provide type safety and IntelliSense for quicker live coding. I usually bind Ctrl+Enter to "execute" all code in ACE and then copy over the snippets into VSCode.

I am also interested in language design itself, so that would also help building custom languages (e.g. TypeScript with operator overloading support or languages completely from scratch - nice for CS students for example).

andrewnester commented 2 years ago

@kungfooman where do you run LSP server in your use case?

kungfooman commented 2 years ago

@andrewnester I never worked with LSP before, so I just collected some information how its done in the field:

1) LSP over WebSocket to a "native" binary (messaging via JSON RPC) 2) WebWorker messaging like its done in Monaco/TypeScript, using node_modules/monaco-editor/dev/vs/language/typescript/tsWorker.js

Option (2) feels a bit easier to me, but (1) is probably more generic, even though it feels like more overhead and harder to debug.

While with (2) you can just set some breakpoints into the WebWorker (at least in Chrome) and see whats going on rather easily:

image

Of course I realize that this issue is about LSP, but for my sake I just aim for better/easy-to-extend IntelliSense, no matter how its done.

andrewnester commented 2 years ago

thanks, we're currently designing our solution to actually support both use cases for remote LSP server and in-browser one

CypherpunkSamurai commented 2 years ago

Any updates on this?

I'm currently trying to create a completer that sends the completion prompt via websocket, but i cant seem to understand how to send the received websock message as a autocompletion callback. Any help would be apreciated

completer code:

var completer = {
    getCompletions: function(editor, session, pos, prefix, callback) {
        if (prefix.length === 0) { callback(null, []); return }
        // Get file contents
        const contents = editor.getValue();
        const row = pos.row;
        const col = pos.column;
        const triggerChar = prefix;
        didChange(socket, currentFilepath, contents);
        getLSPCompletion(socket, currentFilepath, row, col, triggerChar);
    }
}
socket.onmessage = function(event) {
    // Log
    console.log(event);
}

Is there any way to use the socket onmessage to trigger the autocomplete prompt along with the values returned by the lsp?

renhiyama commented 1 year ago

any updates on this?

Dineshchitta commented 1 year ago

any updates on this?

andrewnester commented 1 year ago

The team is picking up this work and you should expect to see some related code changes any time soon :) It's an important project for us and we will keep this thread updated with any details.

nightwing commented 1 year ago

The initial version is available at https://github.com/mkslanc/ace-linters. Currently it includes support for connecting to lsp server via websocket, and to monaco language services running in a webworker.

Any feedback and feature requests are highly appreciated.

CypherpunkSamurai commented 1 year ago

This is impressive work @nightwing @andrewnester!

I'll run live tests and let you know of any bugs

whazor commented 3 months ago

People can build LSP servers on top of Ace via ace-linters from @mkslanc, or use the API of ACE directly to add markers and add auto-complete.

CypherpunkSamurai commented 3 months ago

Hello @whazor, Can you guys also provide a Quick Start example with ace-linters? Like a complete separate repository possibly. The current implementations are using a lot of utility functions that might be hard to get the head around without diving into the core ace codebase. I tried to use it alongside a react project a long time ago but failed miserably and switched to monaco.

A minimal vite project with maybe type-scipt-language-server and websockets would be cool👍🏼

whazor commented 3 months ago

This ace sample shows how to setup a HTML language server with ace-code and ace-linters.

mkslanc commented 3 months ago

Hi @CypherpunkSamurai ! For websockets example you could look into readme or Verified Language Servers on wiki. Also demo has plenty of useful examples