Renaud GHIA 22 Posted October 30, 2018 Hi, I think it would be fantastic to have a delphi language server. https://langserver.org This would open delphi to many editor and IDE (present and future). What do you think about ? Renaud 2 Share this post Link to post
Sherlock 663 Posted October 30, 2018 Who profits from this how? Or rephrased: What does it do? Share this post Link to post
Der schöne Günther 316 Posted October 30, 2018 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. 1 Share this post Link to post
Dmitry Arefiev 101 Posted October 30, 2018 This makes language infrastructure more open. Share this post Link to post
Sherlock 663 Posted October 31, 2018 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 Posted October 31, 2018 @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
Sherlock 663 Posted October 31, 2018 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
Stefan Glienke 2002 Posted October 31, 2018 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): 4 2 Share this post Link to post
Markus Kinzler 174 Posted October 31, 2018 Sometimes "reuse" of present stuff seems to be less effort. In the end it's absolutly the contrary ... Share this post Link to post
Renaud GHIA 22 Posted October 31, 2018 (edited) 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 October 31, 2018 by Renaud GHIA 2 Share this post Link to post
Kryvich 165 Posted October 31, 2018 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
Michael Puff 18 Posted October 31, 2018 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? 1 Share this post Link to post
Sherlock 663 Posted October 31, 2018 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
Renaud GHIA 22 Posted October 31, 2018 (edited) 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 Edited October 31, 2018 by Sherlock inserted the image directly 1 2 Share this post Link to post
Sherlock 663 Posted October 31, 2018 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
Renaud GHIA 22 Posted October 31, 2018 .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. 2 Share this post Link to post
Bill Meyer 337 Posted October 31, 2018 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. 4 Share this post Link to post
Larry Hengen 39 Posted October 31, 2018 (edited) 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 October 31, 2018 by Larry Hengen updated with links found 2 2 Share this post Link to post
Kryvich 165 Posted November 1, 2018 (edited) 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 November 1, 2018 by Kryvich 1 Share this post Link to post
Guest Posted November 1, 2018 @Kryvich it's definitely possible using Delphi! Share this post Link to post
Kryvich 165 Posted November 1, 2018 @Dany Marmur Yes, I see LSP is based on JSON-RPC messaging. I was confused by plugins written in TypeScript. Share this post Link to post
Renaud GHIA 22 Posted November 8, 2018 I just discovered this project: https://github.com/CWBudde/DWScript-Language-Server 4 Share this post Link to post
Guest Posted November 8, 2018 (edited) @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 November 8, 2018 by Guest Share this post Link to post