Skip to content

Cast url parts to string to work around python future bug #33

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

Merged
merged 1 commit into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyls/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def handle(self):
while True:
try:
data = self._read_message()
log.debug("Got message: %s", data)
response = jsonrpc.JSONRPCResponseManager.handle(data, self)
if response is not None:
self._write_message(response.data)
Expand Down
9 changes: 7 additions & 2 deletions pyls/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ def find_config_files(self, document, names):
curdir = os.path.dirname(curdir)

def get_uri_like(self, doc_uri, path):
# Little bit hacky, but what' you gonna do
"""Replace the path in a uri. Little bit hacky!

Due to https://github.com/PythonCharmers/python-future/issues/273 we have to
cast all parts to the same type since jedi can return str and urlparse returns
unicode objects.
"""
parts = list(urlparse(doc_uri))
parts[2] = path
return urlunparse(parts)
return urlunparse([str(p) for p in parts])

def _check_in_workspace(self, doc_uri):
doc_path = urlparse(doc_uri).path
Expand Down