[fpc-pascal] Pascal Language Server

Ryan Joseph genericptr at gmail.com
Thu Apr 23 09:19:26 CEST 2020

> On Apr 23, 2020, at 2:08 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
> VSCode has omnipascal ?
> (The TMS Web core VS Code studio plugin uses this, and it seems pretty complete)

yes it does but they don't support ObjFPC mode syntax very well which means things like the "generic" keyword and "is nested" to name a couple, break the parser and render the entire document invalid.

It's also closed source and likely to be for profit eventually which is a deal break imo. A language server for FPC is too important to be allowed to be within a single companies control.

>> In fact I already started a language server some months ago (and since been busy with out stuff) but I think you've made more progress than me so I'll help to develop yours if you would like. I was even asking on the list about Lazarus code tools and was showed how to FPC's official parser works.
>> Please let me know what else needs to be done and I'll see if I can contribute.
> Very nice !
> I suppose this can be used as a back-end for Atom and VS Code as well then ? That would be really cool !

yes exactly. See the docs https://microsoft.github.io/language-server-protocol/specifications/specification-3-14. I think currently he supports just code completion but there's a whole lot more.

LSP is a good idea and thankfully backed by a large company but it's painfully slow because the client needs to send the entire document in plain text to the server which then needs to be parse the entire thing, and this happens every time the document changes at all. That means with every keystroke the document is parsed and analyzed. The FPC parser doesn't support this anyways but the protocol doesn't even support sending partial changed text offsets. I talked in length with the LSP people at Sublime Text and this is just how it's going to be for now. 

LSP is very new however so expect it to improve in the future.

> A good excuse to dive into Atom package development using pas2js :-)

	Ryan Joseph

More information about the fpc-pascal mailing list