Lazarus

Announcements => Third party => Topic started by: arjan on April 23, 2020, 01:36:09 am

Title: Pascal Language Server
Post by: arjan on April 23, 2020, 01:36:09 am
I am new to Pascal programming and since I like using Emacs, I wanted to try to improve its support for editing Pascal code. I decided to implement an LSP server which text editors can use as back-end for providing IDE features. The server is implemented in Free Pascal and uses the CodeTools package for doing the actual work.

The implementation is still incomplete and unstable but so far I managed to get code completion working. Apart from improving stability and adding features, I am sure there are more possible improvements, since this is my first Pascal project. The project can be found at https://github.com/arjanadriaanse/pascal-language-server, any help and feedback is welcome.

A module is provided for using the server from Emacs, but it should be straightforward to add support for other LSP clients such as Visual Studio Code.
Title: Re: Pascal Language Server
Post by: PascalDragon on April 23, 2020, 09:54:26 am
Oh, cool! :D

Maybe someone will write an LSP client package for Lazarus, so that we could use language servers for other languages in Lazarus as well. :D
Title: Re: Pascal Language Server
Post by: arjan on April 23, 2020, 01:43:17 pm
I do not know much about the internals of Lazarus, but I guess that would not be too hard, since CodeTools is a separate package that could be replaced with one which implements LSP.
Title: Re: Pascal Language Server
Post by: JiaXing on April 23, 2020, 03:27:55 pm
Great!
Title: Re: Pascal Language Server
Post by: Leledumbo on April 25, 2020, 12:09:14 am
As someone claiming new to Pascal programming, your code looks too advanced. I believe many Pascal old timers don't even know how to make a simple JSON-RPC server using FPC libraries, while you make one rather smoothly, even using advanced generics.
Title: Re: Pascal Language Server
Post by: JiaXing on April 25, 2020, 04:24:59 am
As someone claiming new to Pascal programming, your code looks too advanced. I believe many Pascal old timers don't even know how to make a simple JSON-RPC server using FPC libraries, while you make one rather smoothly, even using advanced generics.

Perhaps he is a professional Delphi programmer and he really new to Free Pascal (the Object Free Pascal dialect).
Title: Re: Pascal Language Server
Post by: munair on April 25, 2020, 08:26:58 am
Perhaps he is a professional Delphi programmer and he really new to Free Pascal (the Object Free Pascal dialect).

A Delphi programmer is not new to Pascal.
Title: Re: Pascal Language Server
Post by: MarkMLl on April 25, 2020, 09:34:50 am
@Arjan: nicely done :-)

Perhaps he is a professional Delphi programmer and he really new to Free Pascal (the Object Free Pascal dialect).
A Delphi programmer is not new to Pascal.

Remember that Borland- and successors- tried to convince everybody that it was "the Delphi language" and that Pascal was no longer relevant.

MarkMLl
Title: Re: Pascal Language Server
Post by: JiaXing on April 25, 2020, 09:52:39 am
Perhaps he is a professional Delphi programmer and he really new to Free Pascal (the Object Free Pascal dialect).

A Delphi programmer is not new to Pascal.

It's about different dialect. Like the Chinese in Taiwan and the Chinese in Mainland, both are Mandarin but there are minor different enough for someone unfamiliar to the dialect to consider it as `new`.

Mode Delphi and Mode ObjFPC are definitely different, aren't they?
Title: Re: Pascal Language Server
Post by: MarkMLl on April 25, 2020, 10:00:08 am
It's about different dialect. Like the Chinese in Taiwan and the Chinese in Mainland, both are Mandarin but there are minor different enough for someone unfamiliar to the dialect to consider it as `new`.

Mode Delphi and Mode ObjFPC are definitely different, aren't they?

Yes, but Pascal/Delphi is a written language, not a spoken one. Although I'd rather speak Pascal than C++ or APL :-)

MarkMLl
Title: Re: Pascal Language Server
Post by: jwdietrich on April 25, 2020, 11:09:01 am
It's about different dialect. Like the Chinese in Taiwan and the Chinese in Mainland, both are Mandarin but there are minor different enough for someone unfamiliar to the dialect to consider it as `new`.

Mode Delphi and Mode ObjFPC are definitely different, aren't they?

Yes, but Pascal/Delphi is a written language, not a spoken one. Although I'd rather speak Pascal than C++ or APL :-)

MarkMLl

This is about marketing, and perhaps they want to have the option to sue the Free Pascal community for infringing copyright issues. If the language is called Pascal or Object Pascal they have to admit that it wasn't their invention.
Title: Re: Pascal Language Server
Post by: 440bx on April 25, 2020, 11:20:14 am
Remember that Borland- and successors- tried to convince everybody that it was "the Delphi language" and that Pascal was no longer relevant.
That's true but, it didn't start out that way.  At one time Borland made a clear distinction between Delphi being a RAD and the language it used, Object Pascal, to implement the RAD functionality.  Though, even then they blurred the line by claiming that Delphi was "written in" Delphi instead of developed with Delphi.

This is about marketing, and perhaps they want to have the option to sue the Free Pascal community for infringing copyright issues. If the language is called Pascal or Object Pascal they have to admit that it wasn't their invention.
You may very well be right.  Somewhere along the line, Borland (or one of its descendants) decided that Delphi was a language not just a RAD system.

It's no wonder Pascal has declined in popularity, even the company that depends the most on it, chose to distance itself from it.  That worked really well for them.
Title: Re: Pascal Language Server
Post by: marcov on April 25, 2020, 01:53:17 pm
No. Delphi is not the IDE itself but the whole product. But they slap that brand on anything indiscriminately, even the PHP product.

The (D2005+) IDE is called "BDS", and

the language is "object pascal" before D6 and "Delphi language" starting with D6. The reason given for the renaming was that "Pascal" had too much of an "old" association in a poll they did. (afaik no details known about that poll).

But Delphi is a trademark in several countries, so compatibles (back then still several) generally didn't follow, and FPC didn't either.
Title: Re: Pascal Language Server
Post by: PascalDragon on April 25, 2020, 03:05:53 pm
This is about marketing, and perhaps they want to have the option to sue the Free Pascal community for infringing copyright issues. If the language is called Pascal or Object Pascal they have to admit that it wasn't their invention.

I doubt it. Back when Embarcadero did not yet have their own iOS compiler they shipped FPC. Thus they have acknowledged FPC as a valid player on the "Pascal market" and any action they'd take against it would make them look like hypocrites.
Title: Re: Pascal Language Server
Post by: arjan on April 25, 2020, 04:12:21 pm
As someone claiming new to Pascal programming, your code looks too advanced. I believe many Pascal old timers don't even know how to make a simple JSON-RPC server using FPC libraries, while you make one rather smoothly, even using advanced generics.
Thank you, I am considering this a compliment. I do have experience with other object-oriented languages, from which I applied generics knowledge. As for the JSON-RPC server, I managed to tie together some stuff found on the wiki and by diving into the library sources.
Title: Re: Pascal Language Server
Post by: PascalDragon on April 25, 2020, 05:38:38 pm
As someone claiming new to Pascal programming, your code looks too advanced. I believe many Pascal old timers don't even know how to make a simple JSON-RPC server using FPC libraries, while you make one rather smoothly, even using advanced generics.
Thank you, I am considering this a compliment. I do have experience with other object-oriented languages, from which I applied generics knowledge. As for the JSON-RPC server, I managed to tie together some stuff found on the wiki and by diving into the library sources.

Might be a point on the "Pascal is intuitive" list then :P
TinyPortal © 2005-2018