deepforge icon indicating copy to clipboard operation
deepforge copied to clipboard

Integrate Python Language Server to Monaco Editor (Closes #1908, #571)

Open umesh-timalsina opened this issue 4 years ago • 9 comments

To run this PR locally. Checkout the branch:

  1. Do a docker build for the language server json file:
$ docker build -t langServers:latest -f docker/Dockerfile.langservers . 
  1. Update components.json to add the following key:
"LanguageServers" : {
  "hostName": "http://localhost:5000",
  "servers": {
    "python": {
      "command": "Microsoft.Python.LanguageServer",
      "init": {
        "interpreter": {
          "properties": {
            "InterpreterPath": "/opt/conda/bin/python3"
          },
          "code": "import func",
          "item": "functools"
        }
      },
      "workspace": "/tmp/python-models/"
    }
  }
}
  1. Spin up the container for language servers:
$ docker run -p 5000:5000 -it langServers:latest 
  1. Run npm start:
$ npm start

umesh-timalsina avatar Sep 17 '20 21:09 umesh-timalsina

I have changed this PR to use microsoft's python language server. This still needs some changes to the TextEditorWidget code.

umesh-timalsina avatar Sep 25 '20 17:09 umesh-timalsina

Hmm... I am seeing some errors when trying to build the docker image: DeepinScreenshot_xterm_20201002164821

brollb avatar Oct 02 '20 21:10 brollb

This Branch is working and tested locally. There can be deployment specific quirks which need to be verified.

umesh-timalsina avatar Oct 12 '20 19:10 umesh-timalsina

Have you seen this error before while building the docker container? DeepinScreenshot_select-area_20210108094424

brollb avatar Jan 08 '21 15:01 brollb

No, I have not, but I will have a look.

umesh-timalsina avatar Jan 08 '21 15:01 umesh-timalsina

I think the issue had to do with js-yaml safeDump function being removed from the latest release. I have fixed it. I have also deployed the branch at dev.deepforge.org. Should be good to go for testing in few minutes.

umesh-timalsina avatar Jan 20 '21 19:01 umesh-timalsina

Nice. That fixed it for me - thanks! Now I can check out the rest of it :)

brollb avatar Jan 20 '21 20:01 brollb

Overall, this looks good. A couple issues (I already mentioned them in slack but putting them here, too):

  • performance is pretty bad currently and probably won't scale. It would be good to investigate this further and make sure this is disabled for editor.deepforge.org.
  • Make sure the GitHub action is reverted so it isn't building on this branch

After ensuring it is disabled for editor.deepforge.org and the GitHub action is reverted, feel free to go ahead and merge it!

brollb avatar Jan 21 '21 18:01 brollb

In verbose mode, using the ConsoleWindow, we are getting the following error message:

DeepForge Language Client: Error: The task was cancelled.
    at https://dev.deepforge.org/extlib/src/visualizers/widgets/TextEditor/lib/vscode-ws-jsonrpc.min.js:1:8642
    at https://dev.deepforge.org/extlib/src/visualizers/widgets/TextEditor/lib/vscode-ws-jsonrpc.min.js:1:8936
    at https://dev.deepforge.org/extlib/src/visualizers/widgets/TextEditor/lib/vscode-ws-jsonrpc.min.js:1:9295
    at https://dev.deepforge.org/extlib/src/visualizers/widgets/TextEditor/lib/vscode-ws-jsonrpc.min.js:8:24724
    at p (https://dev.deepforge.org/extlib/src/visualizers/widgets/TextEditor/lib/vscode-ws-jsonrpc.min.js:8:24839)
    at a (https://dev.deepforge.org/extlib/src/visualizers/widgets/TextEditor/lib/vscode-ws-jsonrpc.min.js:8:24197)

This might be at the root of performance issue as new client gets instantiated as soon as this error is encountered. The minified files have no source maps, It might be good to investigate this further.

umesh-timalsina avatar Jan 21 '21 19:01 umesh-timalsina