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

Unclear tutorial example for running json_server.py in debug mode #424

Open
amas0 opened this issue Dec 20, 2023 · 6 comments
Open

Unclear tutorial example for running json_server.py in debug mode #424

amas0 opened this issue Dec 20, 2023 · 6 comments
Labels
docs Documentation related

Comments

@amas0
Copy link

amas0 commented Dec 20, 2023

Howdy - I am currently attempting to follow along with the tutorial using the VSCode extension setup provided by vscode-playground, but am running into a snag with getting debugging working properly.

Following the instructions specified here works fine for opening up a second VSCode window where the langauge server as defined in json_server.py can be played with. However, when attempting to add breakpoints and interact with this code using the debugger as we are told to do in the tutorial doesn't seem to work.

With very limited experience working with VSCode extension development, my best guess as to what is going on is the Launch Client configuration in the launch.json included in the vscode-playground example only launches the extension, the extension launches the language server, and the initial VSCode debugger instance is not attached the language server launched by the extension? It seems like what would need to happen in that case is some additional configuration in the launch.json to specify how the debugger attaches to the language server, but I haven't been able to figure that out.

In any case, I would appreciate any clarification on how this is intended to work.

Environment details

  • main branch of pygls at commit 936e653
  • Python 3.11.6
  • VSCode 1.85.1
@alcarney
Copy link
Collaborator

Apologies... the playground was recently rewritten and the docs haven't quite caught up with the new setup yet. 😅

I've just opened #425 which should automatically handle setting up a debug session for you, if you fancy giving that a try?
Assuming you already have the Python extension installed, setting the pygls.server.debug option to true should be all you need to get going.

The docs in general need a bit of attention so hopefully I can get the tutorial realigned in the not-too-distant-future.

Let me know if you run into any issues.

@amas0
Copy link
Author

amas0 commented Dec 21, 2023

Just pulled down the changes and was able to follow along and get it working! Appreciate the quick response.

@amas0
Copy link
Author

amas0 commented Dec 21, 2023

Not sure if I should throw this on here or not, but in the immediately following section of the tutorial where it states

Press F1, find and run Count down 10 seconds [Blocking] command.

I can't seem to find any command like this in the command window -- not sure if this is related to the above or anything, but figured I'd flag it -- happy to make a new issue if you want.

@alcarney
Copy link
Collaborator

Just pulled down the changes and was able to follow along and get it working!

Glad to hear it!

I can't seem to find any command like this in the command window...

Another symptom of the docs falling behind I'm afraid.

Now that the playground tries to support any server you could write with pygls, it can't expose the commands in VSCode directly. Instead it offers a generic pygls: Execute Command command, which will present you with a list of commands defined by your current server which you can choose to run.

So the tutorial should now say something like

F1 -> pygls: Execute command -> countDownBlocking

Please do keep flagging issues like this, it's very helpful!

@amas0
Copy link
Author

amas0 commented Dec 22, 2023

Appreciate the clarification! I'll follow up on this issue if I encounter any other points of confusion in the tutorial/user guide.

@alcarney alcarney mentioned this issue Dec 22, 2023
8 tasks
@noklam
Copy link
Contributor

noklam commented Feb 27, 2024

Thanks! I am playing around with the tutorial and run into similar issues. This post help me to solve some of the problem. On the other hand I had some weird issue when running pygls==1.3.0 with the tutorial, downgrading to 1.2.1 seem to avoid the problem.

@alcarney alcarney added the docs Documentation related label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related
Projects
None yet
Development

No branches or pull requests

3 participants