thebaselab / codeapp

Building a full-fledged code editor for iPad
https://code.thebaselab.com
MIT License
2.89k stars 195 forks source link

Proposal: Language Service Implementation (LSP) #1104

Open bummoblizard opened 2 months ago

bummoblizard commented 2 months ago

Background

Language Service Protocol is a protocol between code editor and a language server that provides code analysis features like autocompletion. Now with the mature local languages and app extension support in Code App, it is time to design and build the architecture necessary to implement LSP features.

Architecture

Server

We would run the language server implementation in an iOS app extension because:

This implies the language server must keep its memory usage low (~120MB). Careful configuration and crash recovery are necessary.

Websocket endpoints:

Requests are then accepted / rejected subject to resources availability. If accepted, stream stdio over web socket.

Client

Use monaco-languageclient to connect monaco editor to LSP using WebSocket.

async function connectMonacoToLanguageServer(languageIdentifier, serverURL) {}

async function disconnectLanguageServer(languageIdentifier?) {}

function languageServerConnectionDidDrop(languageIdentifier) {}

(To be added..)

TODOs:

Some candidates of language server to integrate:

bummoblizard commented 1 month ago

Python / Java Intellisense is now available in our latest TestFlight build.

valdo404 commented 2 weeks ago

Hi, I would like to share my thoughts on this task.

currently the ipad does not have a real good capability to support many languages and their tools.

I guess combining codeapp with cloud launched lsp servers for indexing, crawling, compiling, and debugging large software projects would be quite interesting.

as such I think the lsp server shouldn't be local but launched on the cloud.

I'm about to clone this project to test the idea of launching actions on a cloud based project (with a local mirror that is using file synchronisation)

best