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

Cannot run the json-extension example #193

Closed
limdauto opened this issue Jun 11, 2021 · 9 comments
Closed

Cannot run the json-extension example #193

limdauto opened this issue Jun 11, 2021 · 9 comments

Comments

@limdauto
Copy link

Hi,

I'm trying to run the JSON extension example. I tried to follow the README but couldn't get it working. Generally, what I was doing was:

  • Launch a server manually (either through Launch configuration or just plainly through the command line). I could verify that the server is running on port 2087.
  • Launch the client through the Launch configuration.

However, whenever I try to execute a command, it keeps saying the command is not found. Do you have any recommendation how I could debug this?

@limdauto
Copy link
Author

Closing because even though I still haven't been able to run the JSON example, I can run the minimal server example instead.

@danixeee
Copy link
Contributor

@limdauto I just cloned a fresh repo and install everything from scratch and I can't reproduce the issue.

Which version of npm and node do you have? I am testing with npm 6.14.13 and node v14.15.1.

@DeeeeLAN
Copy link

DeeeeLAN commented Sep 1, 2021

I am seeing the same issue, I don't think it makes sense to close the ticket. I am running python 3.6.8, npm 6.14.15 and node v14.17.6. I cloned the repo, set up the venv, installed the npm dependencies, launched the server + client debug profile, opened a json file, and added a breakpoint to completions in the server window. When I hit ctrl+space in the client json file, the menu pops up without triggering the breakpoint. When I open the command menu and select Count down 10 seconds [Blocking], It pops up an error:

image

@DeeeeLAN
Copy link

DeeeeLAN commented Sep 1, 2021

I just realized my issue is probably because I am running it over remote-ssh, although forwarding the debug port doesn't immediately resolve the issue.

@DeeeeLAN
Copy link

Digging into this more, for whatever reason, even though I have my python path set up to point to a 3.6.8 version of python and I can see it being called in the command when I launch the debug tasks, the client output states the python server failed and shows it attempted to use a 2.7 executable. I am not sure where it is getting that path.

@DeeeeLAN
Copy link

I have traced my particular issue to the client not picking up the VSCODE_DEBUG_MODE setting in the launch configuration, maybe because it is connecting over remote-ssh to an already running server instance. I don't know. Anyway, when I hard-code the isStartedInDebugMode() to true, the server connects properly. The client was attempting to launch the server on it's own and was selecting the python2 path since the VS Code python extension doesn't use pythonPath anymore.

@davelopez
Copy link

Hi @DeeeeLAN, you can use the ExtensionContext.extensionMode to check if you are running in debug mode (Development).

It would be something like this:

export async function activate(context: ExtensionContext) {
    if (context.extensionMode === ExtensionMode.Development) {
        // Development mode
    } else {
        // Production or Test mode
    }
}

@danixeee
Copy link
Contributor

@DeeeeLAN Included example shows how to use pygls SDK and it is working well if you follow steps from Readme.

You can try what @davelopez suggested above and if it is working for you, please create a PR to replace isStartedInDebugMode().

@DeeeeLAN
Copy link

Thanks, that appeared to work great.

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

No branches or pull requests

4 participants