Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More language servers #4423

Closed
ghost opened this issue Oct 10, 2022 · 46 comments
Closed

More language servers #4423

ghost opened this issue Oct 10, 2022 · 46 comments
Labels

Comments

@ghost
Copy link

ghost commented Oct 10, 2022

Some language servers are missing: https://wiki.freepascal.org/CudaText_plugins

Please have a look: https://www.zeusedit.com/lsp/lsp.html

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 10, 2022

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.

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 10, 2022

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.


  1. Get OmniSharp from GitHub https://github.com/OmniSharp/omnisharp-roslyn/releases .
    For Windows it is the package "omnisharp-win-x64.zip".

  2. 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: dotnet/vscode-csharp#5120

maybe @veksha is in different country and he is not blocked?

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 10, 2022

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
	}
}

@veksha
Copy link
Contributor

veksha commented Oct 10, 2022

image

@veksha
Copy link
Contributor

veksha commented Oct 10, 2022

And my config (cudatext)/settings/lsp_cs.json

this config works for me fine

@Alexey-T
Copy link
Owner

did you run it after you installed MSBuild? did you get MSBuild by my link?

@veksha
Copy link
Contributor

veksha commented Oct 10, 2022

MSBuild was already installed on my system

@Alexey-T
Copy link
Owner

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
	}
}

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 10, 2022

@veksha you cannot fix that, it is Java affairs. we need ANOTHER Java server or another CMD file or docs

@Alexey-T
Copy link
Owner

Info about DLang server just added to wiki. Was easy to config.

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 11, 2022

Info about Go, Fortran servers - added.
We only miss

  • Java
  • Go 2nd and 3rd servers (bingo - gives errors; sourcegraph - cannot compile)

@ghost
Copy link
Author

ghost commented Oct 11, 2022

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

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 11, 2022

'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.

@ghost
Copy link
Author

ghost commented Oct 12, 2022

'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.

@Alexey-T Alexey-T reopened this Oct 12, 2022
@Alexey-T
Copy link
Owner

See the new topic #4432 and try to repeat my steps, from the wiki-file (attached in zip).

@Alexey-T
Copy link
Owner

'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.

@Alexey-T
Copy link
Owner

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.

@RESDXChgfore9hing
Copy link

RESDXChgfore9hing commented Oct 25, 2022

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

  • with lsp_java.json
{
  "lexers": {
    "Java": "java"
  },
  "cmd_unix": [
      "",
  ],
  "cmd_windows": [
      "D:\\testlsp\\ctrun2.bat", "D:\\testlsp\\work", "D:\\testlsp\\work"
  ]
}
  • result
    zerosuggestion

@Alexey-T Alexey-T reopened this Oct 25, 2022
@Alexey-T
Copy link
Owner

  • I tested Java LSP server with batch file from Zeus. on Win10. then the server process crashed with java error in logs. I cannot fix that.
  • Pls, use triple backticks to mark CODE blocks. see Markdown docs

@veksha
Copy link
Contributor

veksha commented Oct 25, 2022

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.

@veksha
Copy link
Contributor

veksha commented Oct 25, 2022

@Alexey-T, prepared PR. please test. CudaText-addons/cuda_lsp#93

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 26, 2022

Thanks. Do I need to install Java server again , or you can write wiki part ? Write it here

@veksha
Copy link
Contributor

veksha commented Oct 26, 2022

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:

  • Check for the Java runtime: java --version
  • Download 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
  • create 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:

{
  "name": "Java",
  "lexers": {
    "Java": "java",
  },
  "cmd_windows": ["C:\\Java\\jLSP.cmd", "."]
}

@RESDXChgfore9hing
Copy link

mine have some weird error though after configuring everything and commented out the 4 lines
workedbuthave_err

@RESDXChgfore9hing
Copy link

RESDXChgfore9hing commented Oct 27, 2022

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

@veksha
Copy link
Contributor

veksha commented Oct 27, 2022

what if you just run batch file with parameters in terminal?

@veksha
Copy link
Contributor

veksha commented Oct 27, 2022

@RESDXChgfore9hing
ensure you provide parameters:
"cmd_windows": ["C:\\Java\\jLSP.cmd", "."],

created issue: CudaText-addons/cuda_lsp#95

@RESDXChgfore9hing
Copy link

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"]
}

'''

workedbutnopopupsuggest

@RESDXChgfore9hing
Copy link

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"}}

@RESDXChgfore9hing
Copy link

RESDXChgfore9hing commented Oct 27, 2022

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?

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 27, 2022

@RESDXChgfore9hing Use triple BACKticks please for code blocks. See Markdown docs.

@RESDXChgfore9hing
Copy link

backticks? " or ' i dont think my keyboard have backticks

@RESDXChgfore9hing
Copy link

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.

@Alexey-T
Copy link
Owner

it needs the java lexer installed also

Of course.

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 27, 2022

the lsp pop up uses the same setting as config as fixed autosuggestion.

What does it mean? do you see LSP completions?

@RESDXChgfore9hing
Copy link

RESDXChgfore9hing commented Oct 27, 2022

config

  • lsp_java.json
{
  "lexers": {
    "Java": "java"
  },
  "cmd_unix": [
      "",
  ],
  "cmd_windows": [
      "D:\\testlsp\\ctrun2.bat","D:\\testlsp\\work", "D:\\testlsp\\work"]
}

ohhhyeahhhh

@RESDXChgfore9hing

This comment was marked as outdated.

@Alexey-T

This comment was marked as outdated.

@RESDXChgfore9hing

This comment was marked as outdated.

@Alexey-T

This comment was marked as outdated.

@RESDXChgfore9hing

This comment was marked as outdated.

@Alexey-T
Copy link
Owner

@RESDXChgfore9hing my mistake, "fdir" is not supported here.

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 27, 2022

@RESDXChgfore9hing we discuss java server in the CudaText-addons/cuda_lsp#98 . this topic -overheated, closing it. Make new topic for other servers in https://github.com/CudaText-addons/cuda_lsp/issues

@Alexey-T
Copy link
Owner

Alexey-T commented Oct 28, 2022

@RESDXChgfore9hing Info about Java server was added to the wiki. it is working (Win/Linux).

@RESDXChgfore9hing
Copy link

Nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@veksha @Alexey-T @RESDXChgfore9hing and others