Recent

Author Topic: Pascal Language Server  (Read 10573 times)

arjan

  • Newbie
  • Posts: 3
Pascal Language Server
« 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.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Pascal Language Server
« Reply #1 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

arjan

  • Newbie
  • Posts: 3
Re: Pascal Language Server
« Reply #2 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.

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: Pascal Language Server
« Reply #3 on: April 23, 2020, 03:27:55 pm »
Great!
I'm subscribed to the church of 440bx. Say no to OOP  :P

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Pascal Language Server
« Reply #4 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.

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: Pascal Language Server
« Reply #5 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).
I'm subscribed to the church of 440bx. Say no to OOP  :P

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Pascal Language Server
« Reply #6 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.
keep it simple

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Pascal Language Server
« Reply #7 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: Pascal Language Server
« Reply #8 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?
I'm subscribed to the church of 440bx. Say no to OOP  :P

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Pascal Language Server
« Reply #9 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Pascal Language Server
« Reply #10 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.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

440bx

  • Hero Member
  • *****
  • Posts: 4064
Re: Pascal Language Server
« Reply #11 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.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11458
  • FPC developer.
Re: Pascal Language Server
« Reply #12 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.
« Last Edit: April 25, 2020, 05:52:38 pm by marcov »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Pascal Language Server
« Reply #13 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.

arjan

  • Newbie
  • Posts: 3
Re: Pascal Language Server
« Reply #14 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.
« Last Edit: April 25, 2020, 04:24:20 pm by arjan »

 

TinyPortal © 2005-2018