How to add a new language?
How to add a new language?
Used Syntax Editor, I created a partial working syntax highlighting for the new language and I enabled the syntax highlighter for it. Unfortunately, on language server templates when I trying to add the language server of the new language, I can't find the new language I just added syntax highlighting for. I ended up choosing an existing language but with the source file extension of the new language. When I opened a source file of the newly added language, syntax highlighting worked fine. But there is no sights that the language server is working. This is confirmed using Task Manager as there is no process of the language server running.
- Rickard Johansson
- Site Admin
- Posts: 6628
- Joined: 19 Jul 2006 14:29
Re: How to add a new language?
First you need a language server installed on your system. Find the home page of a language server and follow the instructions on how to install.
Then create a project and add the language server in project settings.
You can check out the instructions given for other language servers, in this forum, and see if that helps.
If you manage to install and use a language server - please post, or send me, instructions on how to do it.
Then create a project and add the language server in project settings.
You can check out the instructions given for other language servers, in this forum, and see if that helps.
If you manage to install and use a language server - please post, or send me, instructions on how to do it.
Re: How to add a new language?
This is objeck-lsp: https://github.com/objeck/objeck-lsp
I extracted it to C drive. You could extract it to anywhere you want, but you have to modify the paths accordingly.
You must have Objeck VM installed and added to PATH:
https://github.com/objeck/objeck-lang/releases
For example, I extracted to zip release into C drive so I have to put C:/objeck-lang/bin to PATH.
If you are on Windows like me, you have to put C:/objeck-lang/lib/sdl to PATH too.
You must have these environment variables set:
OBJECK_LIB_PATH set to C:/objeck-lang/lib and OBJECK_STDIO set to binary.
If you extracted Objeck VM to another location, you have to modify the paths according to your setup.
I extracted it to C drive. You could extract it to anywhere you want, but you have to modify the paths accordingly.
You must have Objeck VM installed and added to PATH:
https://github.com/objeck/objeck-lang/releases
For example, I extracted to zip release into C drive so I have to put C:/objeck-lang/bin to PATH.
If you are on Windows like me, you have to put C:/objeck-lang/lib/sdl to PATH too.
You must have these environment variables set:
OBJECK_LIB_PATH set to C:/objeck-lang/lib and OBJECK_STDIO set to binary.
If you extracted Objeck VM to another location, you have to modify the paths according to your setup.
Re: How to add a new language?
Objeck Language Server
Command: obr
Command line arguments: C:/objeck-lsp/objeck_lsp.obe C:/objeck-lsp/objk_apis.json stdio
File extension and language id:
.obs as file extension
The problem is there is no Objeck entry on Language identifiers to choose!
Command: obr
Command line arguments: C:/objeck-lsp/objeck_lsp.obe C:/objeck-lsp/objk_apis.json stdio
File extension and language id:
.obs as file extension
The problem is there is no Objeck entry on Language identifiers to choose!
- Rickard Johansson
- Site Admin
- Posts: 6628
- Joined: 19 Jul 2006 14:29
Re: How to add a new language?
Most language servers know which file extensions to use. So it's possible you can leave this blank and not add an extension/language id. Or you could try .obs=c
Anyway, is the language server up and running? Is it working?
Anyway, is the language server up and running? Is it working?
Re: How to add a new language?
I don't see anything indicating the language server is running when I edit .obs file. Checked with Task Manager, there is indeed no process of the language server running. Perhaps you need to test it yourself and write a guide like for other language servers you posted. I'm a completely new user. I don't know much about the text editor so it could be me doing something wrong.Rickard Johansson wrote: ↑03 Apr 2023 07:43 Most language servers know which file extensions to use. So it's possible you can leave this blank and not add an extension/language id. Or you could try .obs=c
Anyway, is the language server up and running? Is it working?
- Rickard Johansson
- Site Admin
- Posts: 6628
- Joined: 19 Jul 2006 14:29
Re: How to add a new language?
Apparently, you need to build the server first. I tried but after a few times - I gave up.
I installed the runtime files to the %Program%\Objeck folder (used the windows installer). Set the environment variables, unpacked the code to the E:\ drive:
e:\objeck-lang
e:\objeck-lsp
and tried to build the server. Nothing worked though
Maybe you need to build a few files in the objeck-lang\core\release folder with Microsoft Visual Studio first?
I installed the runtime files to the %Program%\Objeck folder (used the windows installer). Set the environment variables, unpacked the code to the E:\ drive:
e:\objeck-lang
e:\objeck-lsp
and tried to build the server. Nothing worked though
![Sad :(](./images/smilies/icon_sad.gif)
Re: How to add a new language?
My guide is for the portable version of the Objeck VM. If you used the installer then it's much easier. You could forgot the guide above. After you installed the Objeck VM, download and extract objeck-lsp, for example, into C drive. On the directory objeck-lsp you create this objeck_lsp.bat file:Rickard Johansson wrote: ↑03 Apr 2023 12:54 Apparently, you need to build the server first. I tried but after a few times - I gave up.
I installed the runtime files to the %Program%\Objeck folder (used the windows installer). Set the environment variables, unpacked the code to the E:\ drive:
e:\objeck-lang
e:\objeck-lsp
and tried to build the server. Nothing worked thoughMaybe you need to build a few files in the objeck-lang\core\release folder with Microsoft Visual Studio first?
Code: Select all
@ECHO OFF
SET OBJECK_STDIO=binary
obr %~dp0\objeck_lsp.obe %~dp0\objk_apis.json stdio
p/s: the server was distributed in binary form, why do you need to build it?
https://github.com/objeck/objeck-lsp/re ... 23.4.0.zip
The Objeck VM is also distributed in binary form. The portable version is:
https://github.com/objeck/objeck-lang/r ... 23.4.0.zip
You mentioned objeck-lang\core\release, did you mistakenly download the zipped source code on the release page? It's not the same thing as the portable version!
Re: How to add a new language?
With the objeck_lsp.bat file, I could confirm the language server is running when I edit .obs source file. The problem is there is absolutely no code completion at all. I think the problem is with your LSP client. I think I should find another text editor with a better LSP client. Wasted so many days without any results. Goodbye.
- Rickard Johansson
- Site Admin
- Posts: 6628
- Joined: 19 Jul 2006 14:29
Re: How to add a new language?
I don't think you can use a .bat file. The lsp client should communicate with the server. Not cmd.exe.
This seems to work.
Server name
Objeck Language Server
Command
obr.exe
Command line arguments
objeck_lsp.obe objk_apis.json stdio
Initial dir
E:\lsp\objeck-lsp
File extension and language id
.obs=c
Communication channel
-stdio
Source folders
<Path to project folder>
At least I'm getting some diagnostics (errors, warnings etc.) and hover information. Ctrl+Space send a completion request to the server but doesn't always return anything:
This seems to work.
Server name
Objeck Language Server
Command
obr.exe
Command line arguments
objeck_lsp.obe objk_apis.json stdio
Initial dir
E:\lsp\objeck-lsp
File extension and language id
.obs=c
Communication channel
-stdio
Source folders
<Path to project folder>
At least I'm getting some diagnostics (errors, warnings etc.) and hover information. Ctrl+Space send a completion request to the server but doesn't always return anything:
Code: Select all
Read from server:
{"id":34,"jsonrpc":"2.0","result":null}
Re: How to add a new language?
I will report back to the Objeck developer. Thank you.