Vs Code as a LSP server client - server

I made an LSP server for a language named Typer. I can build the server executable and use a pipe connection. I've used Emacs as a client with lsp-mode to test my server so far. I would like to use VsCode as a client also for testing purposes. Can someone guide me on how to do it?

Related

How to debug rust web server in vs code

I am building a web server using tide framework and I want to debug api function when server receive the request. However,when I click debug button on vs code, and using the curl command from terminal to send request to server, the terminal said "Failed to connect to port 3000,Connection refused". Does anyone know how to debug the rust web server on vscode?
I also had the same issue when I tried the code on this documentation page https://docs.rs/tide/latest/tide/. I'm going to assume that's what you're trying to debug?
I went to the github repository and there is a readme with a similar, but different example https://github.com/http-rs/tide. It works for me, and I could debug without any further issue using the rust-analyzer and CodeLLDB extensions.
Note: I had to restart my computer. After the first example failed I thought I'd try the curl command with a Node Express server to make sure there wasn't something blocking the request. After restarting this went away.

Is it possible to access a VSCode language server from another application?

According to the overview at https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/, VSCode language servers are essentially JSON-RPC servers. Once VSCode is open and running at least 1 language server, how can you tell what port that language server is running on in order to access it from outside of VSCode?
I want to make an experimental application where a VSCode language server is the back-end for a custom code editor that runs in a separate process.
A language server is usually a console application launched by VSCode based on configuration, and its stdin/stdout streams are redirected. There is no port opened usually. Aka, JSON-RPC is a protocol over stdin/stdout, not JSON over HTTP.
If you want to integrate a language server with your own editor, you might fully implement the language server protocol client on the editor side, so that it can perform the same language server process management and stdin/stdout stream redirection. There are many open source projects out there for famous editors, such as
https://github.com/autozimu/LanguageClient-neovim
https://github.com/atom-community/atom-languageclient
Depending on the programming language your editor is built upon, you can find more specific examples to follow.

VS Code Remote Development Errors

I am connected to my company's VPN on my Windows 10 desktop and uses VS Code for my development. I wanted to use VS Code Remote Development so that I can connect to my remote company development server and autosave my files directly on the server. I have installed VS Code Remote Development package and this is my SSH config.
Host my.company.server
HostName 10.XXX.XXX.XX6
User root
IdentityFile C:\Users\My_User\Documents\Company\company_key.pem
However, when connect VS Code to the remote server, VS Code shows that I am connected but I am getting the errors below and cannot view the remote directory.
Unable to write to Folder Settings because no resource is provided.
Could not fetch remote environment.
Failed to connect to the remote extension host server
(Error: Websocket close with status code 1006)
I tried connecting to the remote server using WinSCP and that works fine. I also used PowerShell to login using the below command and that works fine too.
ssh -i C:\Users\My_User\Documents\Company\company_key.pem root#10.XXX.XXX.XX6
What am I doing wrong here? Any VS Code gurus can assist me with this issue? Thanks.
VSCode was attempting to download and install several components on that remote machine, which probably was blocked by the machine administrators in your company (as downloading from an external resource is commonly seen as a security risk on an internal machine).
You should carefully review the information security policies of the company before making any violation. And then discuss with your manager to see if VSCode Remote should be used or not.

Start Point for writing own debugger extension for Visual Studio Code

I want to migrate from Eclipse based IDE to VSC for working with remote Ruby apps and I stuck with writing VSC debugger extension.
Currently, the debugger in the Ruby App and debugger part in Eclipse IDE communicates via HTTP.
I have read the known widely article "Debugger Extension" and don't have yet clear understanding how exact to do it.
In my mind I must use Server type of VSC debugger, which starts to listen HTTP on specific port and translate commands to from DAP. But I cannot get workable sample of this.
Do somebody smthng like this?

How to run windows command in client side(accessing client machine using browser)?

I found many questions about same issue in Stackoverflow. But could not find any satisfactory answers.
My problem is:
I have to run "iperf client" in client machine(assuming windows) using command line in client windows machine and get the statistics.
Currently my server is written in PHP(I am ready to shift to any platform) given that I shall be able to run iperf command on client machine.
I searched and found that, Java applet, ActiveX control or Plugins(like Google Talk plugin). Can someone suggest me the best and easiest approach here(with some reference links if possible).
You cannot run an arbitrary command on the client side using Native Client. What you can do is invoke Pepper API functions from your extension. Another thing you can do is access the Chrome extension API from Javascript. If none of these have the information you need, feel free to suggest new features on the native-client-discuss mailing list. Note that invoking "any Windows command" cannot be reasonably made part of a client-side application, due to security issues.