Jump to content
Renaud GHIA

We need a Delphi Language Server

Recommended Posts

As far as I understand, this would serve as a "bridge" from Object Pascal code - via "LangServer" - to IDEs that support "LangServer stuff".

 

The page lists example IDEs such as Emacs or VS Code. The latter already has an excellent plug-in OmniPascal.

  • Like 1

Share this post


Link to post
Guest

OmniPascal *is* a language server.

Share this post


Link to post

Sorry I still don't get it.Bear with me please. I'm just a Delphi developer who dabbles in Python. I have never heard of this and still can't see the benefit other than "you can use a different editor". Why is a server needed for that? And what does said server actually do?

Share this post


Link to post
Guest

@Sherlock - the modern code-editors have an *extensive* "API" that asks some process *lot's* of things. Here's the intro from VC:

 

https://code.visualstudio.com/docs/languages/overview#_language-features-in-vs-code

 

So writing a language-server is not a trivial task. It also requires you to do some background comping.

 

I assume that "Language Server" without specifying Visual Code or Atom or any other capable editor won't do. If you want to support multiple editors you'll need to cater for dissimilarities (i suppose). 

 

HTH,

 

/Dany

Share this post


Link to post

So basically and very bluntly, it is a way to enable the use of Visual Studio for any language...

<Rant>I see there are other editors out there, that support the language server protocol, but apart from Eclipse and Sublime Text they are somewhat cumbersome 😉 Now I could refresh my vim knowledge, but both the Delphi IDE and Pythons IDLE (yes, I know that is not really an IDE but for my needs an purposes it is) and sometimes Nano really are enough for me. I have no intention on spending extra money on yet another editor (apart from Eclipse the free editions seem to not offer LSP support) to gain practically nothing apart from being able to use the same editor for both languages. </Rant>

 

This project is fine and well for those languages that come without an IDE, and they might profit from it immensely. But Delphi has everything built in, and the things missing come through add-ons. But, and I can't stress this enough, I am a low level developer and quite the conservative nay-sayer. I may very well miss the big picture, and for those guys that use 5 different languages on a daily basis, being able to use the same IDE definitely makes LSP a very fine thing. So go for it. Should have led with that...I guess.

Share this post


Link to post

If you haven't watched this before it might make it a bit clearer what it means to have modern compiler architecture and what benefits you get from it (like not having to implement everything twice for compiling itself and for tooling):

 

 

  • Like 4
  • Thanks 2

Share this post


Link to post

The hard reality is that delphi ide is old and really buggy. 
If we compare it to Intellij... No comment. 
Currently, I use the plugin i-pascal for intelliJ (not perfect but far better than delphi for code navigation) Omnipascal is also very good.
It is precisely to avoid rewriting a plugin for each IDE that the language server is existing.
A delphi langage server will bring with one implementation, a support with majors editors / IDE or next gen web IDE as Eclipse CHE.

Edited by Renaud GHIA
  • Like 2

Share this post


Link to post
48 minutes ago, Renaud GHIA said:

The hard reality is that delphi ide is old and really buggy. 
If we compare it to Intellij... No comment. 

For me Delphi 10.2 IDE is stable and very resposive. I tried Oxygene in Visual Studio, it was noticeably slower on my computer.

Share this post


Link to post

As far as I understood it, if a language has a language server you can load that language in the IDE (if such a feature is supported by the IDE). Like using Visual Studio and it's IDE features but with the Delphi language. Is my assumption correct?

  • Like 1

Share this post


Link to post

That is my understanding as well. It helps writing code but in the end you still have to compile it with Delphi though. Being a Delphi Developer since Version 5 this would mean quite the change in behavior. I'm used to pressing Ctrl+F9 every now and then, just to check if it still compiles (aka is ready for shipping 😉). This can't be possible with for example Eclipse, or can it?

Share this post


Link to post

Yes.

17 minutes ago, Sherlock said:

That is my understanding as well. It helps writing code but in the end you still have to compile it with Delphi though. Being a Delphi Developer since Version 5 this would mean quite the change in behavior. I'm used to pressing Ctrl+F9 every now and then, just to check if it still compiles (aka is ready for shipping 😉). This can't be possible with for example Eclipse, or can it?

Depends of the IDE, but for instance with i-pascal and IntelliJ you can configure the delphi compiler.

http://www.siberika.com/img/run/compile.gif

compile.gif.74caf78c84e00654b5718ac82e687965.gif

Edited by Sherlock
inserted the image directly
  • Like 1
  • Thanks 2

Share this post


Link to post

Ok. You almost got me. How is the form designer handled? It is my understanding that most other languages handle layout questions through code entirely. Could it be, that this aspect is underrepresented in LSP?

Share this post


Link to post

.dfm and .fmx design is a delphi specificity and for sure will be never managed by LSP.

However, I wish that one day we replace the .fmx with a css like. It would be a lot more standard and powerful.

But that's another debate.

  • Like 2

Share this post


Link to post

Given that I doubt we will ever see a fully repaired IDE, the language server would be a boon, were it not for the issue of a form designer. 

 

The notion of using a CSS-like solution reminds me of the Regex joke: I had a problem, but solved it with Regex. Now I have three problems.

  • Haha 4

Share this post


Link to post

I agree that an open source Language Server would be desirable.  Omnipascal looks great and even offers the ability to compile Delphi projects now.  Someone else wrote a form designer prototype for VSCode.  Put all the pieces together and we almost have a portable IDE with VSCode.

 

A  language server would enable other IDEs to support the ObjectPascal language and enable EMBT to rip out ErrorInsight, and other parsers in the IDE. if they made use of it.  If EMBT used an open source language server, the community could evolve and improve it over time rather than relying on EMBT.  As a separation of concerns, it would also make it easier to get a cross platform IDE working, or multiple IDEs on different platforms.  If you write code on OS/X and target only Apple devices, it would be nice not to require a Windows VM, or a PC as well.  A language server might enable the use of XCode (not sure if it uses language servers) for ObjectPascal development.

 

At some point, a language server could enable Delphi developers to just use the command line compilers, and RTL to target their platform of choice with their editor of choice, and UI framework of choice.

 

https://github.com/alefragnani
 

Seems to have done some work along this line.

Edited by Larry Hengen
updated with links found
  • Like 2
  • Thanks 2

Share this post


Link to post

Is it possible to write a language server in Delphi/Pascal, or should it be written in languages such as Java, JavaScript, TypeScript? BTW ErrorInsight was written in J# (correct me if I'm wrong), and it was a bad decision.

 

Well I see the language server plugins for C/C++ written in C++, D plugin written in D, Dart Language Server written in Dart etc...

Edited by Kryvich
  • Like 1

Share this post


Link to post
Guest

@Renaud GHIA that is a Language Server for DWScript. When it is compiled the "functionality" from DWScript is "linked" in and it is this functionality that governs what happens when you edit .pas files. So it will need to be "forked" in order to link in or connect to language stuff that is more "Delphi". But you can definitely contact Mr Budde if you have ideas or questions. He is very skilled! Another project is OmniPascal that already uses stuff for (i cannot say if it is re-implemented or linked-in) Delphi and FPC.

 

Edited by Guest

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×