File tree Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
-
3
- try :
4
- import Queue
5
- except ImportError :
6
- import queue as Queue
7
-
8
2
import os
3
+ import queue
9
4
import threading
10
5
from collections import deque
11
-
12
- try :
13
- from urllib .parse import quote , unquote
14
- except ImportError :
15
- from urllib2 import quote
16
- from urlparse import unquote
6
+ from pathlib import Path
7
+ from urllib .parse import quote , unquote
17
8
18
9
from fortls .constants import log
19
10
@@ -26,7 +17,7 @@ def path_from_uri(uri: str) -> str:
26
17
_ , path = uri .split ("file:///" , 1 )
27
18
else :
28
19
_ , path = uri .split ("file://" , 1 )
29
- return os . path . normpath ( unquote (path ))
20
+ return str ( Path ( unquote (path )). resolve ( ))
30
21
31
22
32
23
def path_to_uri (path : str ) -> str :
@@ -185,7 +176,7 @@ def send_request_batch(self, requests):
185
176
186
177
# We communicate the request ids using a thread safe queue.
187
178
# It also allows us to bound the number of concurrent requests.
188
- q = Queue .Queue (100 )
179
+ q = queue .Queue (100 )
189
180
190
181
def send ():
191
182
for method , params in requests :
Original file line number Diff line number Diff line change @@ -703,7 +703,7 @@ def check_return(results, ref_results):
703
703
assert errcode == 0
704
704
results .extend (res [1 :])
705
705
706
- root = Path ( test_dir )
706
+ root = path_to_uri ( str (( test_dir / "diag" / "test_external.f90" ). resolve ()) )
707
707
ref_results = [
708
708
[],
709
709
[],
@@ -720,7 +720,7 @@ def check_return(results, ref_results):
720
720
"relatedInformation" : [
721
721
{
722
722
"location" : {
723
- "uri" : f"file:// { root / 'diag' / 'test_external.f90' } " ,
723
+ "uri" : str ( root ) ,
724
724
"range" : {
725
725
"start" : {"line" : 5 , "character" : 0 },
726
726
"end" : {"line" : 5 , "character" : 0 },
@@ -740,7 +740,7 @@ def check_return(results, ref_results):
740
740
"relatedInformation" : [
741
741
{
742
742
"location" : {
743
- "uri" : f"file:// { root / 'diag' / 'test_external.f90' } " ,
743
+ "uri" : str ( root ) ,
744
744
"range" : {
745
745
"start" : {"line" : 3 , "character" : 0 },
746
746
"end" : {"line" : 3 , "character" : 0 },
You can’t perform that action at this time.
0 commit comments