forked from SublimeCodeIntel/SublimeCodeIntel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenkomodo-codeintel2.patch
More file actions
61 lines (60 loc) · 2.96 KB
/
openkomodo-codeintel2.patch
File metadata and controls
61 lines (60 loc) · 2.96 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--- openkomodo/src/codeintel/lib/codeintel2/database/database.py
+++ openkomodo/src/codeintel/lib/codeintel2/database/database.py
@@ -445,15 +445,19 @@ class Database(object):
self.acquire_lock()
try:
log.debug("fs-write: create db skeleton in '%s'", self.base_dir)
- os.makedirs(self.base_dir)
+ if not exists(self.base_dir):
+ os.makedirs(self.base_dir)
open(join(self.base_dir, "README.txt"), 'w').write(dedent("""
This is a database for the Code Intelligence system (a
- subsystem of Komodo). Do NOT modify anything in here unless
- you know what you are doing.
+ subsystem of SublimeCodeIntel). Do NOT modify anything in here
+ unless you know what you are doing.
- See http://www.activestate.com/Products/Komodo/ for details.
+ See http://github.com/Kronuz/SublimeCodeIntel for details.
"""))
open(join(self.base_dir, "VERSION"), 'w').write(self.VERSION)
+ config_file = join(self.base_dir, "config")
+ if not exists(config_file):
+ open(config_file, 'w').write("{}")
os.mkdir(join(self.base_dir, "db"))
finally:
self.release_lock()
--- openkomodo/src/codeintel/lib/codeintel2/accessor.py
+++ openkomodo/src/codeintel/lib/codeintel2/accessor.py
def _token_at_pos(self, pos):
#XXX Locality of reference should offer an optimization here.
# Binary search for appropriate token.
- lower, upper = 0, len(self.tokens) # [lower-limit, upper-limit)
+ lower, upper = 0, len(self.tokens) - 1 # [lower-limit, upper-limit)
sentinel = 15
while sentinel > 0:
idx = ((upper - lower) / 2) + lower
token = self.tokens[idx]
- #print "_token_at_pos %d: token idx=%d text[%d:%d]=%r"\
+ # print "_token_at_pos %d: token idx=%d text[%d:%d]=%r"\
# % (pos, idx, token["start_index"], token["end_index"],
# token["text"])
- start, end = token["start_index"], token["end_index"]
- if pos < token["start_index"]:
+ # start, end = token["start_index"], token["end_index"]
+ if lower == upper:
+ return token
+ elif pos < token["start_index"]:
upper = idx
elif pos > token["end_index"]:
lower = idx + 1
--- openkomodo/src/codeintel/lib/codeintel2/constants_css3.py
+++ openkomodo/src/codeintel/lib/codeintel2/constants_css3.py
@@ -874,7 +874,7 @@ for attr, details in CSS3_DATA.items():
if attr_completions:
CSS3_SPECIFIC_ATTRS_DICT[attr] = attr_completions
else:
- CSS3_SPECIFIC_ATTRS_DICT[attr] = None
+ CSS3_SPECIFIC_ATTRS_DICT[attr] = {}
description = details.get("description")
if description:
desc_lines = textwrap.wrap(description, width=60)