Closed ghost closed 2 years ago
Feel free to give correct config-info here, i will add the info to the wiki. I will wait for a week-two, and will close the issue.
I begin with C# OmniSharp server. On Win10. Result: I am blocked on MS site ("my" country is blocked , seems) so VS installer (I can get it and can run it, 2Mb) cannot download its files and I cannot install MSBuild from this installer.
Here is my draft text file.
Get OmniSharp from GitHub https://github.com/OmniSharp/omnisharp-roslyn/releases . For Windows it is the package "omnisharp-win-x64.zip".
You need to install MSBuild. As of May 2022, OmniSharp does not include MSBuild. Download link can be found at the bottom of this page: https://visualstudio.microsoft.com/downloads/?q=build+tools . See "Build Tools for Visual Studio 2022". In the installation check the following option: ".NET desktop build tools".
More info: https://github.com/OmniSharp/omnisharp-vscode/issues/5120
maybe @veksha is in different country and he is not blocked?
And my config (cudatext)/settings/lsp_cs.json
{
"lexers": {
"C#": "csharp"
},
"cmd_windows": [
"C:\\OmniSharp\\OmniSharp.exe", "-lsp", "-z"
]
}
With it, OmniSharp gives the error that it cannot locate MSBuild and fails to work. In the LSP panel log of Cud.
OmniSharp.Services.DotNetCliService: Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK |
OmniSharp.Services.DotNetCliService: Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK |
OmniSharp.Services.DotNetCliService: Using the 'dotnet' on the PATH. |
OmniSharp.Services.DotNetCliService: Using the 'dotnet' on the PATH. |
OmniSharp.Services.DotNetCliService: DotNetPath set to dotnet |
OmniSharp.Services.DotNetCliService: DotNetPath set to dotnet |
OmniSharp.MSBuild.Discovery.MSBuildLocator: Located 0 MSBuild instance(s) |
OmniSharp.MSBuild.Discovery.MSBuildLocator: Located 0 MSBuild instance(s) |
OmniSharp.Extensions.JsonRpc.InputHandler: Failed to handle request initialize 0 - OmniSharp.MSBuild.Discovery.MSBuildNotFoundException: Could not locate MSBuild instance to register with OmniSharp.
The C# testing file
using System;
public class DateExample
{
public static void Main()
{
DateTime date;
date.A
}
}
And my config (cudatext)/settings/lsp_cs.json
this config works for me fine
did you run it after you installed MSBuild? did you get MSBuild by my link?
MSBuild was already installed on my system
The C# info is now in the WIki. Thanks.
Now I follow the Java server info here: https://www.zeusedit.com/lsp/java.html Current result: LSP shows in console:
LSP: starting server - Java; root: None
ReadLoopError: LSP: Java - [Errno 10] No child processes
I unzipped .tar.gz from https://download.eclipse.org/jdtls/milestones/1.9.0/ to the C:\Java\jdt-language-server . I made jLSP.cmd as shown in Zeus docs. I can run jLSP.cmd and it shows
Microsoft Windows [Version 10.0.19044.2006]
(c) Microsoft Corporation. All rights reserved.
C:\Java>jlsp c:\work c:\work
Directory: C:/Java/jdt-language-server
JarFile: C:/Java/jdt-language-server/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
Config: C:/Java/jdt-language-server/config_win
java -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar C:/Java/jdt-language-server/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration C:/Java/jdt-language-server/config_win --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -data "c:\work"
An error has occurred. See the log file
C:\Java\jdt-language-server\config_win\1665436817104.log.
C:\Java>
so it almost works.
LSP config for Cud: (cudatext)/settings/lsp_java.json
{
"lexers": {
"Java": "java"
},
"cmd_windows": [
"C:\\Java\\jLSP.cmd", "${fdir}", "${fdir}"
]
}
Java testing file
public class Example {
public static void main(String[] args) {
System.g
}
}
@veksha you cannot fix that, it is Java affairs. we need ANOTHER Java server or another CMD file or docs
Info about DLang server just added to wiki. Was easy to config.
Info about Go, Fortran servers - added. We only miss
Info about Go, Fortran servers - added. We only miss
- Java
- Go 2nd and 3rd servers (bingo - gives errors; sourcegraph - cannot compile)
It seems you miss this too: https://www.zeusedit.com/lsp/python-lsp-ms.html
'Check that the .Net Core is correctly installed run the following command: ' - so I cannot compile it, my Win10 cannot install the VS and MSBuild.
if you or @veksha give me the ready topic for the wiki, I take it.
'Check that the .Net Core is correctly installed run the following command: ' - so I cannot compile it, my Win10 cannot install the VS and MSBuild.
if you or @veksha give me the ready topic for the wiki, I take it.
So does me. I'm on Windows 8.1 and Visual Studio doesn't support my OS. I listed C# and Java only as examples to prove that there are more language servers to add. What I really need is this: https://www.zeusedit.com/lsp/python-lsp-ms.html
Sorry for the misleading.
See the new topic #4432 and try to repeat my steps, from the wiki-file (attached in zip).
'sourcegraph' server for Go is not supported!
Hey we no longer maintain this server (in fact I am about to archive this repository). Please use the official gopls language server from the go team.
Microsoft Python server repo: This repository has been archived by the owner. It is now read-only. https://github.com/Microsoft/python-language-server
It is not updated since February. so I don't want to support it.
the java lsp doesnt seems to work.Did you get it to work?
Running the start batch script itself seems to worked fine
ctrun2 "%cd%\work" "%cd%\work"
Directory: D:\testlsp\jdt
JarFile: D:\testlsp\jdt/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
Config: D:\testlsp\jdt/config_win
java -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar D:\testlsp\jdt/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration D:\testlsp\jdt/config_win --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -data "D:\testlsp\work"
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Content-Length: 120
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2022/10/26 1:38:08 Main thread is waiting"}}
Meanwhile in from cudatext
{
"lexers": {
"Java": "java"
},
"cmd_unix": [
"",
],
"cmd_windows": [
"D:\\testlsp\\ctrun2.bat", "D:\\testlsp\\work", "D:\\testlsp\\work"
]
}
the java lsp doesnt seems to work.Did you get it to work?
Running the start batch script itself seems to worked fine
Got it working, @RESDXChgfore9hing! commented out four "echo" lines in batch file:
::echo Directory: %Directory%
::echo JarFile: %JarFile%
::echo Config: %Config%
...
::echo java -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar %JarFile% -configuration %Config% --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -data %CacheDirctory%
I need to check why Cuda_lsp can't get past them.
@Alexey-T, prepared PR. please test. https://github.com/CudaText-addons/cuda_lsp/pull/93
Thanks. Do I need to install Java server again , or you can write wiki part ? Write it here
better you try and install it on your linux. we need at least Windows and Linux examples.
for Windows we could steal copy-paste from https://www.zeusedit.com/lsp/java.html
This is not ready yet, just a template:
For Windows:
java --version
dt-language-server-1.9.0-202203031534.tar.gz
package from Eclipse JDT Language Server milestone builds and extract it to C:/Java/jdt-language-server
C:\Java\jLSP.cmd
batch file with following contents (edit if necessary):
@echo off
set CacheDirctory=%~1
if NOT "%CacheDirctory%" == "" goto test_cache set CacheDirctory=%~2
if NOT "%CacheDirctory%" == "" goto test_cache echo Error: No cache directory was provided. goto usage
:test_cache
set CacheDirctory="%CacheDirctory%"
if EXIST %CacheDirctory% goto check_server echo Error: The cache directory provided does not exist: %CacheDirctory% goto complete
:check_server
:: language server installation folder (adjust to suit) set Directory=C:/Java/jdt-language-server
:: language server jar file (update based on version file of jar) set JarFile=%Directory%/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
if EXIST %JarFile% goto run_server echo Error: The following Jar file was not found: echo '%JarFile%' echo Check the folder above to see if the version number of the Jar has changed and update the jLSP.cmd file to suit. goto complete
:run_server
:: language server config folder location set Config=%Directory%/config_win
echo Directory: %Directory% echo JarFile: %JarFile% echo Config: %Config%
:: java --Declipse.application=org.eclipse.jdt.ls.core.id1 :: -Dosgi.bundles.defaultStartLevel=4 :: -Declipse.product=org.eclipse.jdt.ls.core.product :: -Dlog.level=ALL :: -noverify :: -Xmx1G :: -jar %JarFile% :: -configuration %Congfig% :: --add-modules=ALL-SYSTEM :: --add-opens java.base/java.util=ALL-UNNAMED :: --add-opens java.base/java.lang=ALL-UNNAMED :: -data %CacheDirctory%
:: echo the command for debugging echo java -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar %JarFile% -configuration %Config% --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -data %CacheDirctory%
:: run the language server using stdio communications java -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar %JarFile% -configuration %Config% --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -data %CacheDirctory% goto complete
:usage echo. echo Usage: jLSP.cmd WorkspaceDirectory FileDirectory echo Example: jLSP.cmd "$wdd" "$fdd" echo.
:complete
create `lsp_java.json` file:
```json
{
"name": "Java",
"lexers": {
"Java": "java",
},
"cmd_windows": ["C:\\Java\\jLSP.cmd", "."]
}
mine have some weird error though after configuring everything and commented out the 4 lines
My custom JDK installess version jlsp.cmd for alexey reference if lazy install JDK into win,but have it in some folder.mine is in drive X
@echo off
set CacheDirctory=%~1
if NOT "%CacheDirctory%" == "" goto test_cache
set CacheDirctory=%~2
if NOT "%CacheDirctory%" == "" goto test_cache
echo Error: No cache directory was provided.
goto usage
:test_cache
set CacheDirctory="%CacheDirctory%"
if EXIST %CacheDirctory% goto check_server
echo Error: The cache directory provided does not exist: %CacheDirctory%
goto complete
:check_server
:: language server installation folder (adjust to suit)
set Directory=D:\testlsp\jdt
:: language server jar file (update based on version file of jar)
set JarFile=%Directory%/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
if EXIST %JarFile% goto run_server
echo Error: The following Jar file was not found:
echo '%JarFile%'
echo Check the folder above to see if the version number of the Jar has changed and update the jLSP.cmd file to suit.
goto complete
:run_server
:: language server config folder location
set Config=%Directory%/config_win
::echo Directory: %Directory%
::echo JarFile: %JarFile%
::echo Config: %Config%
:: java --Declipse.application=org.eclipse.jdt.ls.core.id1
:: -Dosgi.bundles.defaultStartLevel=4
:: -Declipse.product=org.eclipse.jdt.ls.core.product
:: -Dlog.level=ALL
:: -noverify
:: -Xmx1G
:: -jar %JarFile%
:: -configuration %Congfig%
:: --add-modules=ALL-SYSTEM
:: --add-opens java.base/java.util=ALL-UNNAMED
:: --add-opens java.base/java.lang=ALL-UNNAMED
:: -data %CacheDirctory%
:: echo the command for debugging
:: echo java -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar %JarFile% -configuration %Config% --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -data %CacheDirctory%
:: run the language server using stdio communications,HERE get the JDK and then run lap server
X:&&X:\\XJava\\FSetnearbyJDK.bat&&d:&&echo %PATH%&&java -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar %JarFile% -configuration %Config% --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -data %CacheDirctory%
goto complete
:usage
echo.
echo Usage: jLSP.cmd WorkspaceDirectory FileDirectory
echo Example: jLSP.cmd "$wdd" "$fdd"
echo.
:complete
what if you just run batch file with parameters in terminal?
@RESDXChgfore9hing
ensure you provide parameters:
"cmd_windows": ["C:\\Java\\jLSP.cmd", "."],
created issue: https://github.com/CudaText-addons/cuda_lsp/issues/95
i updated the cudatext to ver1.174.0.0 and reinstalled the lsp the queue error is gone now however i still dont see any lsp popup. hmm.... my lsp config is '''{ "lexers": { "Java": "java" }, "cmd_unix": [ "", ], "cmd_windows": [ "D:\testlsp\ctrun2.bat","D:\testlsp\jdt\work", "D:\testlsp\jdt\work"] }
'''
i can run the lsp server from terminal directly.
ctrun2.bat "%cd%\work" "%cd%\work" OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release. Content-Length: 121
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2022/10/27 19:40:29 Main thread is waiting"}}
tried your config
ctrun2.bat ".\work" ".\work"
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Content-Length: 121
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2022/10/27 19:48:33 Main thread is waiting"}}
but its still same though no suggestion maybe there is some options i need to enable show?
@RESDXChgfore9hing Use triple BACKticks please for code blocks. See Markdown docs.
backticks? " or ' i dont think my keyboard have backticks
ps i think i got it working. i think it needs the java lexer installed also the lsp pop up uses the same setting as config as fixed autosuggestion.
it needs the java lexer installed also
Of course.
the lsp pop up uses the same setting as config as fixed autosuggestion.
What does it mean? do you see LSP completions?
config
{
"lexers": {
"Java": "java"
},
"cmd_unix": [
"",
],
"cmd_windows": [
"D:\\testlsp\\ctrun2.bat","D:\\testlsp\\work", "D:\\testlsp\\work"]
}
"${fdir}" dont work on my side,need to give a valid folder if not wrong.
But ${fdir} must give the valid folder, no?
oh so you mean the user need to replace?the ${fdir} with an actual path? like>D:\testlsp\work
No, user must not do this, ${fdir} inside lsp_java.json must be handled by lsp plugin.
huh thats weird,i think the lsp plugin need some fix then. since when i put ${fdir} the server just crashed.
@RESDXChgfore9hing my mistake, "fdir" is not supported here.
@RESDXChgfore9hing we discuss java server in the https://github.com/CudaText-addons/cuda_lsp/issues/98 . this topic -overheated, closing it. Make new topic for other servers in https://github.com/CudaText-addons/cuda_lsp/issues
@RESDXChgfore9hing Info about Java server was added to the wiki. it is working (Win/Linux).
Nice.
Some language servers are missing: https://wiki.freepascal.org/CudaText_plugins
Please have a look: https://www.zeusedit.com/lsp/lsp.html