Closed bigosmallm closed 6 years ago
You'll need to launch the language server using Java. I believe that this command should do the trick:
java -cp bin/*:bundled-compiler/* com.nextgenactionscript.vscode.Main
The paths on the classpath are relative to distribution/target/vscode-nextgenas/vscode-nextgenas when you run mvn clean package
.
Use ;
instead of :
as the classpath delimiter on Windows.
If you want to use libraries from a particular SDK, you can replace bundled-compiler
on the classpath with the following directories from a FlexJS SDK:
flexjs/lib/*:flexjs/lib/external/*:flexjs/js/lib/*
If you want to use Royale instead of FlexJS, you'll need to switch to the royale branch of vscode-nextgenas, but it should be the same directories.
This will start the language server in a mode that communicates over stdin/stdout. You can also start it in a way that you communicate over a socket instead. You will need to add the following parameter to tell the language server which port you want it to use:
-Dnextgeas.vscode.port=55282
Replace 55282 with any open port that you prefer.
For reference, you can see where the VSCode extension starts the language server here in v0.8.0:
It is using the stdin/stdout form of communication.
Thanks for the detailed response!
I tried this: java -cp .\distribution\target\vscode-nextgenas\vscode-nextgenas\bin*;.\distribution\target\vscode-nextgenas\vscode-nextgenas\bundled-compiler* com.nextgenactionscript.vscode.Main -Dnextgeas.vscode.port=55282
It seemed to work, in that there was no error message, but I am not able to connect to it from the Monaco language client.
Is there a way to verify if the language server started successfully?
If it didn't quit during startup, it should have started successfully. It will be listening on port 55282 for socket connections. I'm not experienced with WebSockets, but I guess you'd want to connect to ws://localhost:55282.
Okay, this worked: java -Dnextgeas.vscode.port=55282 -cp C:\p\os\flexroot\vscode-nextgenas\distribution\target\vscode-nextgenas\vscode-nextgenas\bin*;C:\p\os\flexroot\vscode-nextgenas\distribution\target\vscode-nextgenas\vscode-nextgenas\bundled-compiler* com.nextgenactionscript.vscode.Main
i.e. putting the -D param first and using a full path.
I am getting other errors now, but at least I am on track. Thank you!
@bigosmallm , @joshtynjala , can you get this working? I tried
C:\dev\vscode-as3mxml>java -cp C:\dev\vscode-as3mxml\distribution\target\vscode-as3mxml\vscode-as3mxml\bin;c:\dev\vscode-as3mxml\distribution\target\vscode-as3mxml\vscode-as3mxml\bundled-compiler com.as3mxml.vscode.Main
and got
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 Error: Could not find or load main class com.as3mxml.vscode.Main
I'm trying to get this to work with VIM. Slightly off topic, will I need to read asconfig.json separately? Thanks.
A few months back, I wrote this document that describes how to use the language server in Sublime Text:
It includes the command to start the server.
I think maybe you need a slash before the *
character in your classpaths, and you should specify -Droyalelib
too.
Thanks. For what it's worth, I'm able to run it in powershell using
java "-Dnextgenas.vscode.port=55283" -cp "C:\dev\vscode-as3mxml\distribution\target\vscode-as3mxml\vscode-as3mxml\bin*;C:\dev\vscode-as3mxml\distribution\target\vscode-as3mxml\vscode-as3mxml\bundled-compiler*" "-Droyalelib=C:\dev\flexjs\royale-asjs\frameworks\" "com.as3mxml.vscode.Main"
However, I don't see port 55283 in netstat -ano
Looks like I have a typo in the property name. It's actually looking for "nextgeas.vscode.port" (notice that the letter n is missing).
Setting this property is only necessary if you want to communicate over a TCP socket instead of stdio. For what it's worth, both VSCode and Moonshine are using stdio, as I've found that is easier (no need to find an open port, and it seems to be faster in some situations).
Regardless, I'm probably going to change the property name, as "nextgenas" and "NextGen ActionScript" are no longer the brand. I seem to have missed giving this proeprty a new name in my find/replace because of the typo.
Connection refused. I'm getting
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.
I would like to start and use the language server alone. Is there a command to do just start the server?
Background - I am working on a Monacco based editor to support online Royale editing functionalities. It would be nice to have code completion etc. work with the online editor.
The approach suggested here seems to hint that this would be possible: https://typefox.io/teaching-the-language-server-protocol-to-microsofts-monaco-editor
Any other thoughts would be useful as well.
Thanks, Om