aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-01-20 20:48:42 +0100
committerTristan Gingold <tgingold@free.fr>2021-01-20 20:48:42 +0100
commit20c5d3b2ef15833d6f01eefc5b2b2a89736c1538 (patch)
tree7e60a77809855b910419ae20dee824af19e3bada
parent4f484625f9587d2f12a6e2f8ed9cac2fff467183 (diff)
downloadghdl-20c5d3b2ef15833d6f01eefc5b2b2a89736c1538.tar.gz
ghdl-20c5d3b2ef15833d6f01eefc5b2b2a89736c1538.tar.bz2
ghdl-20c5d3b2ef15833d6f01eefc5b2b2a89736c1538.zip
LanguageServer: quote URI, adjust lsp.py (for Windows)
URI on windows have the colon character (':') quoted.
-rw-r--r--pyGHDL/lsp/lsp.py3
-rw-r--r--testsuite/pyunit/lsp/LanguageServer.py3
2 files changed, 3 insertions, 3 deletions
diff --git a/pyGHDL/lsp/lsp.py b/pyGHDL/lsp/lsp.py
index 1806db8d8..7d869d484 100644
--- a/pyGHDL/lsp/lsp.py
+++ b/pyGHDL/lsp/lsp.py
@@ -47,8 +47,7 @@ def path_from_uri(uri):
def path_to_uri(path):
# Convert path to file uri (add html like head part)
if is_windows:
- # Do not quote ':' (nor '/').
- return "file:///" + quote(path.replace("\\", "/"), "/:")
+ return "file:///" + quote(path.replace("\\", "/"))
else:
return "file://" + quote(path)
diff --git a/testsuite/pyunit/lsp/LanguageServer.py b/testsuite/pyunit/lsp/LanguageServer.py
index 2ef378b9a..39d23184e 100644
--- a/testsuite/pyunit/lsp/LanguageServer.py
+++ b/testsuite/pyunit/lsp/LanguageServer.py
@@ -4,6 +4,7 @@ from sys import executable
from io import BytesIO
from json import load as json_load, loads as json_loads, dumps as json_dumps
from pathlib import Path
+from urllib.parse import quote
from subprocess import run as subprocess_run, PIPE
from typing import Optional
from unittest import TestCase, skip
@@ -69,7 +70,7 @@ def root_subst(obj, root):
if k in ('rootUri', 'uri'):
assert v.startswith("file://@ROOT@/")
p = "file://" + ("/" if is_windows else "")
- obj[k] = p + root + v[13:]
+ obj[k] = p + quote(root + v[13:])
elif k in ('rootPath', 'message'):
obj[k] = v.replace('@ROOT@', root)
else: