Skip to content

Lsp-mode does not loading extra paths #1037

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

Closed
ztlevi opened this issue Sep 21, 2019 · 19 comments
Closed

Lsp-mode does not loading extra paths #1037

ztlevi opened this issue Sep 21, 2019 · 19 comments

Comments

@ztlevi
Copy link

ztlevi commented Sep 21, 2019

Describe the bug
I just updated lsp-mode and it seems no longer load user's libraries like lsp-python-ms-extra-paths. It happens right after the upgradation and I double checked I didn't update lsp-python-ms. Before, it works perfectly.

I also tried pyls with lsp-clients-python-library-directories but still no extra libraries loaded.

To Reproduce
Add some extra paths to lsp-python-ms-extra-paths. Put something there and try to load it from somewhere else. See if lsp-python-ms can resolve it.

Expected behavior
Able to jump to definition.

Which Language Server did you use
lsp-python-ms

OS
Linux

Error callstack

Microsoft Python Language Server version 0.3.76.0
Analysis cache path: /home/ztlevi/.cache/Microsoft/Python Language Server
GetCurrentSearchPaths /usr/bin/python3 
Interpreter search paths:
    /usr/lib/python3.5
    /usr/lib/python3.5/plat-x86_64-linux-gnu
    /usr/lib/python3.5/lib-dynload
    /home/ztlevi/.local/lib/python3.5/site-packages
    /usr/local/lib/python3.5/dist-packages
    /usr/lib/python3/dist-packages
User search paths:

You can tell from the lsp-log. There is no user search paths exist.

lsp-log:mypyls:91904
[Trace - 09:04:43 AM] Sending request 'initialize - (1)'.
Params: {
  "processId": 91726,
  "rootPath": "/Users/ztlevi/Developer/Github/python-test/",
  "rootUri": "file:///Users/ztlevi/Developer/Github/python-test/",
  "capabilities": {
    "workspace": {
      "workspaceEdit": {
        "documentChanges": true,
        "resourceOperations": [
          "create",
          "rename",
          "delete"
        ]
      },
      "applyEdit": true,
      "symbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        }
      },
      "executeCommand": {
        "dynamicRegistration": false
      },
      "didChangeWatchedFiles": {
        "dynamicRegistration": true
      },
      "workspaceFolders": true,
      "configuration": true
    },
    "textDocument": {
      "declaration": {
        "linkSupport": true
      },
      "definition": {
        "linkSupport": true
      },
      "implementation": {
        "linkSupport": true
      },
      "typeDefinition": {
        "linkSupport": true
      },
      "synchronization": {
        "willSave": true,
        "didSave": true,
        "willSaveWaitUntil": true
      },
      "documentSymbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        },
        "hierarchicalDocumentSymbolSupport": true
      },
      "formatting": {
        "dynamicRegistration": true
      },
      "rename": {
        "dynamicRegistration": true
      },
      "semanticHighlightingCapabilities": {
        "semanticHighlighting": null
      },
      "codeAction": {
        "dynamicRegistration": true,
        "codeActionLiteralSupport": {
          "codeActionKind": {
            "valueSet": [
              "",
              "quickfix",
              "refactor",
              "refactor.extract",
              "refactor.inline",
              "refactor.rewrite",
              "source",
              "source.organizeImports"
            ]
          }
        }
      },
      "completion": {
        "completionItem": {
          "snippetSupport": true,
          "documentationFormat": [
            "markdown"
          ]
        },
        "contextSupport": true
      },
      "signatureHelp": {
        "signatureInformation": {
          "parameterInformation": {
            "labelOffsetSupport": true
          }
        }
      },
      "documentLink": {
        "dynamicRegistration": true
      },
      "hover": {
        "contentFormat": [
          "markdown",
          "plaintext"
        ]
      },
      "foldingRange": {
        "dynamicRegistration": true,
        "rangeLimit": null,
        "lineFoldingOnly": false
      }
    }
  },
  "initializationOptions": {
    "interpreter": {
      "properties": {
        "InterpreterPath": "/usr/local/anaconda3/bin/python3",
        "Version": "3.7"
      }
    },
    "displayOptions": {
      "preferredFormat": "markdown",
      "trimDocumentationLines": false,
      "maxDocumentationLineLength": 0,
      "trimDocumentationText": false,
      "maxDocumentationTextLength": 0
    },
    "searchPaths": [
      "/Users/ztlevi/av/python_root"
    ],
    "analysisUpdates": true,
    "asyncStartup": true,
    "typeStubSearchPaths": [
      "/Users/ztlevi/.emacs.d/.local/etc/mspyls/Typeshed"
    ]
  }
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Microsoft Python Language Server version 0.3.76.0",
  "type": 3
}


[Trace - 09:04:44 AM] Received response 'initialize - (1)' in 553ms.
Result: {
  "capabilities": {
    "declarationProvider": true,
    "renameProvider": true,
    "documentOnTypeFormattingProvider": {
      "moreTriggerCharacter": [
        ";",
        ":"
      ],
      "firstTriggerCharacter": "\n"
    },
    "documentRangeFormattingProvider": null,
    "documentFormattingProvider": null,
    "codeActionProvider": null,
    "workspaceSymbolProvider": true,
    "documentSymbolProvider": true,
    "documentHighlightProvider": null,
    "referencesProvider": true,
    "definitionProvider": true,
    "signatureHelpProvider": {
      "triggerCharacters": [
        "(",
        ",",
        ")"
      ]
    },
    "completionProvider": {
      "triggerCharacters": [
        "."
      ],
      "resolveProvider": null
    },
    "hoverProvider": true,
    "textDocumentSync": {
      "willSaveWaitUntil": null,
      "willSave": null,
      "change": 2,
      "openClose": true
    }
  }
}


[Trace - 09:04:44 AM] Sending notification 'initialized'.
Params: {
}


[Trace - 09:04:44 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
  "settings": {
    "python": {
      "analysis": {
        "warnings": [
          "unresolved-import",
          "parameter-already-specified",
          "too-many-positional-arguments-before-star"
        ],
        "errors": [
          "unknown-parameter-name",
          "undefined-variable",
          "parameter-missing",
          "positional-argument-after-keyword",
          "too-many-function-arguments"
        ]
      }
    }
  }
}


[Trace - 09:04:44 AM] Sending notification 'textDocument/didOpen'.
Params: {
  "textDocument": {
    "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py",
    "languageId": "python",
    "version": 0,
    "text": "from l2.test import test_func\n\nif __name__ == \"__main__\":\n    for i in range(10):\n        test_func()\n"
  }
}


[Trace - 09:04:44 AM] Received request 'workspace/configuration - (2).
Params: {
  "items": [
    {
      "section": "python"
    }
  ]
}


[Trace - 09:04:44 AM] Sending response 'workspace/configuration - (2)'. Processing request took 0ms
Params: {
  "jsonrpc": "2.0",
  "id": 2,
  "result": [
    {
      "analysis": {
        "warnings": [
          "unresolved-import",
          "parameter-already-specified",
          "too-many-positional-arguments-before-star"
        ],
        "errors": [
          "unknown-parameter-name",
          "undefined-variable",
          "parameter-missing",
          "positional-argument-after-keyword",
          "too-many-function-arguments"
        ]
      }
    }
  ]
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analysis cache path: /Users/ztlevi/Library/Caches/Microsoft/Python Language Server",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "GetCurrentSearchPaths /usr/local/anaconda3/bin/python3 ",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Interpreter search paths:",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /private/var/folders/vp/zdsnbd390ngbk_s3pcz4kc4r0000gp/T/3jmgfh5c.ooa",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7/lib-dynload",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /Users/ztlevi/.local/lib/python3.7/site-packages",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7/site-packages",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7/site-packages/aeosa",
  "type": 3
}


[Trace - 09:04:44 AM] Received notification 'window/logMessage'.
Params: {
  "message": "User search paths:",
  "type": 3
}


[Trace - 09:04:45 AM] Sending request 'textDocument/signatureHelp - (2)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py"
  },
  "position": {
    "line": 4,
    "character": 0
  }
}


[Trace - 09:04:46 AM] Sending request 'textDocument/signatureHelp - (3)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py"
  },
  "position": {
    "line": 4,
    "character": 8
  }
}


[Trace - 09:04:46 AM] Sending request 'textDocument/definition - (4)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py"
  },
  "position": {
    "line": 4,
    "character": 8
  }
}


[Trace - 09:04:46 AM] Received notification 'python/beginProgress'.
Params: []


[Trace - 09:04:46 AM] Received notification 'python/reportProgress'.
Params: [
  "Analyzing in background, 1 items left..."
]


[Trace - 09:04:46 AM] Received notification 'python/endProgress'.
Params: []


[Trace - 09:04:46 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Initializing for /usr/local/anaconda3/bin/python3",
  "type": 3
}


[Trace - 09:04:46 AM] Received notification 'python/languageServerStarted'.
Params: []


[Trace - 09:04:47 AM] Received notification 'telemetry/event'.
Params: {
  "Measurements": {
    "elapsedMs": 1856.2864000000002
  },
  "Properties": {
    "plsVersion": "0.3.76.0",
    "method": "textDocument/signatureHelp"
  },
  "EventName": "python_language_server/rpc.request"
}


[Trace - 09:04:47 AM] Received notification 'telemetry/event'.
Params: {
  "Measurements": {
    "elapsedMs": 1343.0914
  },
  "Properties": {
    "plsVersion": "0.3.76.0",
    "method": "textDocument/signatureHelp"
  },
  "EventName": "python_language_server/rpc.request"
}


[Trace - 09:04:47 AM] Received notification 'telemetry/event'.
Params: {
  "Measurements": {
    "elapsedMs": 1196.8637
  },
  "Properties": {
    "plsVersion": "0.3.76.0",
    "method": "textDocument/definition"
  },
  "EventName": "python_language_server/rpc.request"
}


[Trace - 09:04:47 AM] Received response 'textDocument/signatureHelp - (3)' in 372ms.
Result: null


[Trace - 09:04:47 AM] Received response 'textDocument/definition - (4)' in 229ms.
Result: []


[Trace - 09:04:47 AM] Received response 'textDocument/signatureHelp - (2)' in 890ms.
Result: null


[Trace - 09:04:48 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "diagnostics": [
    {
      "message": "unresolved import 'l2.test'",
      "source": "Python",
      "code": "unresolved-import",
      "severity": 2,
      "range": {
        "end": {
          "character": 12,
          "line": 0
        },
        "start": {
          "character": 5,
          "line": 0
        }
      }
    },
    {
      "message": "Undefined variable: 'test_func'",
      "source": "Python",
      "code": "undefined-variable",
      "severity": 1,
      "range": {
        "end": {
          "character": 17,
          "line": 4
        },
        "start": {
          "character": 8,
          "line": 4
        }
      }
    }
  ],
  "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py"
}
@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

Please include client/server logs as per issue template.

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

I just added.

@ztlevi ztlevi changed the title Latest lsp-mode seems not loading extra paths Lsp-mode does not loading extra paths Sep 21, 2019
@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

AFACS searchPaths are specified in the initialize request:

 "searchPaths": [
      "/Users/ztlevi/av/python_root"
    ],

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

It's so weird. I see it's in searchPath but I still cannot resolve the modules in searchPath.

Can you try the sample repo here?

And modify either lsp-python-ms-extra-paths for mspyls or lsp-clients-python-library-directories for pyls.

(setq lsp-python-ms-extra-paths `(,(expand-file-name "~/Developer/Github/python-test/python_root"))
Lsp-log
[Trace - 09:52:13 AM] Sending request 'initialize - (1)'.
Params: {
  "processId": 41858,
  "rootPath": "/Users/ztlevi/Developer/Github/python-test/",
  "rootUri": "file:///Users/ztlevi/Developer/Github/python-test/",
  "capabilities": {
    "workspace": {
      "workspaceEdit": {
        "documentChanges": true,
        "resourceOperations": [
          "create",
          "rename",
          "delete"
        ]
      },
      "applyEdit": true,
      "symbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        }
      },
      "executeCommand": {
        "dynamicRegistration": false
      },
      "didChangeWatchedFiles": {
        "dynamicRegistration": true
      },
      "workspaceFolders": true,
      "configuration": true
    },
    "textDocument": {
      "declaration": {
        "linkSupport": true
      },
      "definition": {
        "linkSupport": true
      },
      "implementation": {
        "linkSupport": true
      },
      "typeDefinition": {
        "linkSupport": true
      },
      "synchronization": {
        "willSave": true,
        "didSave": true,
        "willSaveWaitUntil": true
      },
      "documentSymbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        },
        "hierarchicalDocumentSymbolSupport": true
      },
      "formatting": {
        "dynamicRegistration": true
      },
      "rename": {
        "dynamicRegistration": true
      },
      "semanticHighlightingCapabilities": {
        "semanticHighlighting": null
      },
      "codeAction": {
        "dynamicRegistration": true,
        "codeActionLiteralSupport": {
          "codeActionKind": {
            "valueSet": [
              "",
              "quickfix",
              "refactor",
              "refactor.extract",
              "refactor.inline",
              "refactor.rewrite",
              "source",
              "source.organizeImports"
            ]
          }
        }
      },
      "completion": {
        "completionItem": {
          "snippetSupport": true,
          "documentationFormat": [
            "markdown"
          ]
        },
        "contextSupport": true
      },
      "signatureHelp": {
        "signatureInformation": {
          "parameterInformation": {
            "labelOffsetSupport": true
          }
        }
      },
      "documentLink": {
        "dynamicRegistration": true
      },
      "hover": {
        "contentFormat": [
          "markdown",
          "plaintext"
        ]
      },
      "foldingRange": {
        "dynamicRegistration": true,
        "rangeLimit": null,
        "lineFoldingOnly": false
      }
    }
  },
  "initializationOptions": {
    "interpreter": {
      "properties": {
        "InterpreterPath": "/usr/local/anaconda3/bin/python3",
        "Version": "3.7"
      }
    },
    "displayOptions": {
      "preferredFormat": "markdown",
      "trimDocumentationLines": false,
      "maxDocumentationLineLength": 0,
      "trimDocumentationText": false,
      "maxDocumentationTextLength": 0
    },
    "searchPaths": [
      "/Users/ztlevi/av/python_root",
      "/Users/ztlevi/Developer/Github/python-test/python_root"
    ],
    "analysisUpdates": true,
    "asyncStartup": true,
    "typeStubSearchPaths": [
      "/Users/ztlevi/.emacs.d/.local/etc/mspyls/Typeshed"
    ]
  }
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Microsoft Python Language Server version 0.3.76.0",
  "type": 3
}


[Trace - 09:52:14 AM] Received response 'initialize - (1)' in 576ms.
Result: {
  "capabilities": {
    "declarationProvider": true,
    "renameProvider": true,
    "documentOnTypeFormattingProvider": {
      "moreTriggerCharacter": [
        ";",
        ":"
      ],
      "firstTriggerCharacter": "\n"
    },
    "documentRangeFormattingProvider": null,
    "documentFormattingProvider": null,
    "codeActionProvider": null,
    "workspaceSymbolProvider": true,
    "documentSymbolProvider": true,
    "documentHighlightProvider": null,
    "referencesProvider": true,
    "definitionProvider": true,
    "signatureHelpProvider": {
      "triggerCharacters": [
        "(",
        ",",
        ")"
      ]
    },
    "completionProvider": {
      "triggerCharacters": [
        "."
      ],
      "resolveProvider": null
    },
    "hoverProvider": true,
    "textDocumentSync": {
      "willSaveWaitUntil": null,
      "willSave": null,
      "change": 2,
      "openClose": true
    }
  }
}


[Trace - 09:52:14 AM] Sending notification 'initialized'.
Params: {
}


[Trace - 09:52:14 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
  "settings": {
    "python": {
      "analysis": {
        "warnings": [
          "unresolved-import",
          "parameter-already-specified",
          "too-many-positional-arguments-before-star"
        ],
        "errors": [
          "unknown-parameter-name",
          "undefined-variable",
          "parameter-missing",
          "positional-argument-after-keyword",
          "too-many-function-arguments"
        ]
      }
    }
  }
}


[Trace - 09:52:14 AM] Sending notification 'textDocument/didOpen'.
Params: {
  "textDocument": {
    "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py",
    "languageId": "python",
    "version": 0,
    "text": "from l2.test import test_func\n\nif __name__ == \"__main__\":\n    for i in range(10):\n        test_func()\n"
  }
}


[Trace - 09:52:14 AM] Received request 'workspace/configuration - (2).
Params: {
  "items": [
    {
      "section": "python"
    }
  ]
}


[Trace - 09:52:14 AM] Sending response 'workspace/configuration - (2)'. Processing request took 0ms
Params: {
  "jsonrpc": "2.0",
  "id": 2,
  "result": [
    {
      "analysis": {
        "warnings": [
          "unresolved-import",
          "parameter-already-specified",
          "too-many-positional-arguments-before-star"
        ],
        "errors": [
          "unknown-parameter-name",
          "undefined-variable",
          "parameter-missing",
          "positional-argument-after-keyword",
          "too-many-function-arguments"
        ]
      }
    }
  ]
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Analysis cache path: /Users/ztlevi/Library/Caches/Microsoft/Python Language Server",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "GetCurrentSearchPaths /usr/local/anaconda3/bin/python3 ",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Interpreter search paths:",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /private/var/folders/vp/zdsnbd390ngbk_s3pcz4kc4r0000gp/T/0wdtvkp3.rej",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7/lib-dynload",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /Users/ztlevi/.local/lib/python3.7/site-packages",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7/site-packages",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "    /usr/local/anaconda3/lib/python3.7/site-packages/aeosa",
  "type": 3
}


[Trace - 09:52:14 AM] Received notification 'window/logMessage'.
Params: {
  "message": "User search paths:",
  "type": 3
}


[Trace - 09:52:15 AM] Sending request 'textDocument/definition - (2)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py"
  },
  "position": {
    "line": 4,
    "character": 14
  }
}


[Trace - 09:52:16 AM] Received notification 'python/beginProgress'.
Params: []


[Trace - 09:52:16 AM] Received notification 'python/reportProgress'.
Params: [
  "Analyzing in background, 1 items left..."
]


[Trace - 09:52:16 AM] Received notification 'python/endProgress'.
Params: []


[Trace - 09:52:16 AM] Received notification 'window/logMessage'.
Params: {
  "message": "Initializing for /usr/local/anaconda3/bin/python3",
  "type": 3
}


[Trace - 09:52:16 AM] Received notification 'python/languageServerStarted'.
Params: []


[Trace - 09:52:17 AM] Received notification 'telemetry/event'.
Params: {
  "Measurements": {
    "elapsedMs": 1730.4676000000002
  },
  "Properties": {
    "plsVersion": "0.3.76.0",
    "method": "textDocument/definition"
  },
  "EventName": "python_language_server/rpc.request"
}


[Trace - 09:52:17 AM] Received response 'textDocument/definition - (2)' in 755ms.
Result: []


[Trace - 09:52:18 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "diagnostics": [
    {
      "message": "unresolved import 'l2.test'",
      "source": "Python",
      "code": "unresolved-import",
      "severity": 2,
      "range": {
        "end": {
          "character": 12,
          "line": 0
        },
        "start": {
          "character": 5,
          "line": 0
        }
      }
    },
    {
      "message": "Undefined variable: 'test_func'",
      "source": "Python",
      "code": "undefined-variable",
      "severity": 1,
      "range": {
        "end": {
          "character": 17,
          "line": 4
        },
        "start": {
          "character": 8,
          "line": 4
        }
      }
    }
  ],
  "uri": "file:///Users/ztlevi/Developer/Github/python-test/test.py"
}

@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

lsp-clients-python-library-directories

This does not do what you think it does - it identifies the files that lsp-mode will consider as part of the project and does not affect the files that the language server will scan.

@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

(setq lsp-python-ms-extra-paths [ "/home/kyoncho/Sources/python-test/l1/" ])

IMO mspyls does not resolve symlinks - this fixed the imports on my side. Based on that I am closing the issue.

@yyoncho yyoncho closed this as completed Sep 21, 2019
@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

Ok, and yeah, I didn't manage to make pyls working previously. But I'm pretty sure I was able to resolve symlinked modules by modifying lsp-python-ms-extra-paths. Somehow after upgraduation, it broke up...

Anyway, what's the proper way to add files that lang server will scan?

Thanks!

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

mspyls can resolve symlinks according to the disscustion here.

And if you try set PYTHONPATH and open the python-test project in vscode, you will find out it does.

@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

@ztlevi have you tried to turn on the tracing in VScode and compare it with the tracing in lsp-mode?

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

@yyoncho I would like to, but how?

@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

C-S-p -> User settings -> type trace , look for python and then the trace is in the output view

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

@yyoncho This is the only python trace option I found.

image

After enable it, it doesn't provide as much information as lsp-mode does. But here is the log, and you will find user search paths has something.

[Info  - 11:00:35 AM] Microsoft Python Language Server version 0.3.76.0
[Info  - 11:00:35 AM] Analysis cache path: /Users/ztlevi/Library/Caches/Microsoft/Python Language Server
[Info  - 11:00:35 AM] GetCurrentSearchPaths /usr/local/anaconda3/bin/python 
[Info  - 11:00:35 AM] Interpreter search paths:
[Info  - 11:00:35 AM]     /private/var/folders/vp/zdsnbd390ngbk_s3pcz4kc4r0000gp/T/5eg41k2d.fnt
[Info  - 11:00:35 AM]     /usr/local/anaconda3/lib/python3.7
[Info  - 11:00:35 AM]     /usr/local/anaconda3/lib/python3.7/lib-dynload
[Info  - 11:00:35 AM]     /Users/ztlevi/.local/lib/python3.7/site-packages
[Info  - 11:00:35 AM]     /usr/local/anaconda3/lib/python3.7/site-packages
[Info  - 11:00:35 AM]     /usr/local/anaconda3/lib/python3.7/site-packages/aeosa
[Info  - 11:00:35 AM] User search paths:
[Info  - 11:00:35 AM]     /Users/ztlevi/Developer/Github/python-test/python_root
[Info  - 11:00:41 AM] Initializing for /usr/local/anaconda3/bin/python

In this case, it might be an issue for lsp-python-ms?

@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

the setting for python is actually called "Log Level"

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

@yyoncho Not much information provided cuz it can successfully jump to definition.

[Info  - 11:17:56 AM] Microsoft Python Language Server version 0.3.76.0
[Info  - 11:17:56 AM] Analysis cache path: /Users/ztlevi/Library/Caches/Microsoft/Python Language Server
[Info  - 11:17:56 AM] GetCurrentSearchPaths /usr/local/anaconda3/bin/python 
[Info  - 11:17:56 AM] Interpreter search paths:
[Info  - 11:17:56 AM]     /private/var/folders/vp/zdsnbd390ngbk_s3pcz4kc4r0000gp/T/ilz2ku0y.0ju
[Info  - 11:17:56 AM]     /usr/local/anaconda3/lib/python3.7
[Info  - 11:17:56 AM]     /usr/local/anaconda3/lib/python3.7/lib-dynload
[Info  - 11:17:56 AM]     /Users/ztlevi/.local/lib/python3.7/site-packages
[Info  - 11:17:56 AM]     /usr/local/anaconda3/lib/python3.7/site-packages
[Info  - 11:17:56 AM]     /usr/local/anaconda3/lib/python3.7/site-packages/aeosa
[Info  - 11:17:56 AM] User search paths:
[Info  - 11:17:56 AM]     /Users/ztlevi/Developer/Github/python-test/python_root
[Info  - 11:17:58 AM] Initializing for /usr/local/anaconda3/bin/python
Watching /usr/local/anaconda3/lib/python3.7
Watching /Users/ztlevi/.local/lib/python3.7/site-packages
Opening document file:///Users/ztlevi/Developer/Github/python-test/python_root/l2/test.py
Analysis of l2.test(User) queued
Analysis version 2 of 1 entries has started.
Analysis of l2.test (User) on depth 0 completed in 8.5323 ms.
Analysis complete: 1 modules in 9.8738 ms.
Analysis version 2 of 1 entries has been completed in 8.6601 ms.
Opening document file:///Users/ztlevi/Developer/Github/python-test/test.py
Analysis of test(User) queued
Analysis version 3 of 1 entries has started.
Analysis of test (User) on depth 0 completed in 22.4955 ms.
Analysis complete: 1 modules in 24.7019 ms.
Analysis version 3 of 1 entries has been completed in 22.676 ms.
Hover in file:///Users/ztlevi/Developer/Github/python-test/test.py at (4, 15)
Goto Definition in file:///Users/ztlevi/Developer/Github/python-test/test.py at (4, 13)

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

You might need to add "python.jediEnabled": false, to enable mspyls

@yyoncho
Copy link
Member

yyoncho commented Sep 21, 2019

I updated the language server via M-x lsp-python-ms-update-server and then (setq lsp-python-ms-extra-paths [ "/home/kyoncho/Sources/python-test/python_root" ]) works fine ...

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

That's so weird. Did you have the anything show in lsp-log's User search paths:?

@ztlevi
Copy link
Author

ztlevi commented Sep 21, 2019

Is there anything come across your mind that might cause my issue?

@yyoncho
Copy link
Member

yyoncho commented Sep 22, 2019

Here it is the log:

The following clients were selected based on priority: (server-id mspyls, priority 1)
Analysis cache path: /home/kyoncho/.cache/Microsoft/Python Language Server
GetCurrentSearchPaths /usr/bin/python 
Interpreter search paths:
    /usr/lib/python2.7
    /usr/lib/python2.7/plat-x86_64-linux-gnu
    /usr/lib/python2.7/lib-tk
    /usr/lib/python2.7/lib-dynload
    /home/kyoncho/.local/lib/python2.7/site-packages
    /usr/local/lib/python2.7/dist-packages
    /usr/lib/python2.7/dist-packages
    /usr/lib/python2.7/dist-packages/gtk-2.0
User search paths:
    /home/kyoncho/Sources/python-test/python_root
Microsoft Python Language Server version 1.0.0.0
Initializing for /usr/bin/python

I also tested with lsp-docker and it works fine on a clean install after upgrading lsp-ms-python.

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

2 participants