Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

How to set up debugging on Linux/Mac #2092

Closed

Description

@leungbk

I generally use NixOS, a Linux distro, and am able to build the server, but I'm not sure how to get debugging working, especially since Visual Studio isn't supported there. I can browse the code within Emacs with omnisharp-roslyn, but do not know of any means of debugging C# within Emacs. And VS Code doesn't seem to work very well with C# on Nix.

I've also tried using a Mac and following the instructions to set up debugging.

Visual Studio:

  1. Open the PLS.sln solution in src.
  2. Build Microsoft.Python.LanguageServer project.
  3. Binaries arrive in output/bin.
  4. Clone Python Extension to VS Code source: https://github.com/Microsoft/vscode-python
  5. Open Python extension sources folder in VS Code
  6. Create languageServer folder in the extension sources folder.

I don't see a sources folder. I have created the languageServer folder inside of vscode-python/src.

  1. Copy everything from output/bin/Debug to languageServer.

I've recursively copied output/bin/Debug/foo to vscode-python/src/languageServer/foo, and not vscode-python/src/languageServer/Debug/foo.

  1. In VS Code set setting python.downloadLanguageServer to false.
  2. In VS Code set setting python.jediEnabled to false.

These settings don't appear to exist. I've tried setting python.languageServer to "Microsoft" in the VS Code settings, as well as "None".

Debugging C# code in Microsoft Python Language Server

  1. Launch another instance of VS Code
  2. Open src folder
  3. In primary VS Code instance launch Python extension (F5)
  4. In the instance with Microsoft Python Language Server C# code select Dotnet Attach launch task.
  5. Attach to dotnet process running Microsoft.Python.languageServer.dll

On Windows you can also attach from Visual Studio (Debug | Attach To Process).

On Mac, I cannot see a dotnet process when trying to attach to a process.

I'm guessing I've done something wrong in one or more of the above steps. I'd appreciate any help in getting set up.

Activity

  1. jakebailey commented on Jun 26, 2020

    @jakebailey
    Member

    Step 6 means in the vscode-python repo; so just in the root next to src.

    You are copying the correct files; the contents of Debug should appear in languageServer.

    jediEnabled was removed very recently, so we haven't changed the docs yet. Microsoft is correct.

  2. leungbk commented on Jun 26, 2020

    @leungbk
    Author

    Thanks for the quick response. Unfortunately, after making vscode-python/languageServer and copying the files there, I still can't see anything when trying to attach from within Visual Studio.

    And I'm not sure how to attach with a second instance of VS Code instead of with Visual Studio; running open -n /usr/local/bin/code in an attempt to open a second instance of VS Code simply brings up the first again.

    1. In primary VS Code instance launch Python extension (F5)

    After hitting F5, there are several build targets: I tried Extension and Extension inside container for vscode-python. Both options open an additional VS Code instance, but in either case I can't detect a dotnet process from within Visual Studio.

    I'm not sure what else needs to be in place. I'm running Node 12, and all the vscode-python npm stuff seemed to install OK. I might have to try installing Windows on VirtualBox.

  3. jakebailey commented on Jun 26, 2020

    @jakebailey
    Member

    You want "Extension". Then when it's loaded, the output panel should have an output channel for "Python Language Server" which should provide some more info about if it's working or not.

    You can also technically use the stable build of the Python extension, and copy the languageServer folder to its directory (with the same downloadLanguageServer set to false), if you want to eliminate an extra debug step. There's an "open extensions folder" item in the command pallete to quickly find where it lives.

  4. leungbk commented on Jun 26, 2020

    @leungbk
    Author

    You can also technically use the stable build of the Python extension, and copy the languageServer folder to its directory (with the same downloadLanguageServer set to false), if you want to eliminate an extra debug step. There's an "open extensions folder" item in the command pallete to quickly find where it lives.

    This seems to work for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionA question about the LS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions