Skip to content

Commit 875f54c

Browse files
committed
add mypi typings and config
1 parent ae65ed8 commit 875f54c

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

main.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@
99
from urllib.parse import urljoin
1010
import html
1111
import mdpopups
12+
try:
13+
from typing import List, Dict, Tuple, Callable
14+
except Exception as e:
15+
pass
1216

1317
PLUGIN_NAME = 'LSP'
1418
SUBLIME_WORD_MASK = 515
1519
show_status_messages = True
1620
show_view_status = True
1721

18-
configs = []
22+
configs = [] # type: List[Config]
1923

2024

2125
class SymbolKind(object):
@@ -407,7 +411,7 @@ def client_for_view(view):
407411
return clients[config.name]
408412

409413

410-
clients_by_window = {}
414+
clients_by_window = {} # type: Dict[int, Dict[str, Client]]
411415

412416

413417
def window_clients(window):
@@ -470,7 +474,7 @@ def notify_did_save(view):
470474

471475

472476
# TODO: this should be per-window ?
473-
document_states = {}
477+
document_states = {} # type: Dict[str, DocumentState]
474478

475479

476480
class DocumentState:
@@ -489,7 +493,7 @@ def get_document_state(path):
489493
return document_states.get(path)
490494

491495

492-
pending_buffer_changes = dict()
496+
pending_buffer_changes = dict() # type: Dict[int, Dict]
493497

494498

495499
def queue_did_change(view):
@@ -896,7 +900,7 @@ def run(self, edit):
896900
| sublime.DRAW_NO_OUTLINE
897901
| sublime.DRAW_EMPTY_AS_OVERWRITE)
898902

899-
window_file_diagnostics = dict()
903+
window_file_diagnostics = dict() # type: Dict[int, Dict[str, Dict[str, List[Tuple[Tuple[int,int], str, str]]]]]
900904

901905

902906
def update_file_diagnostics(window, relative_file_path, source,
@@ -924,7 +928,7 @@ def update_view_diagnostics(view, source, location_severity_messages):
924928
update_output_panel(window)
925929

926930

927-
phantom_sets_by_buffer = {}
931+
phantom_sets_by_buffer = {} # type: Dict[int, sublime.PhantomSet]
928932

929933
file_diagnostics = {}
930934

@@ -1227,7 +1231,7 @@ def __repr__(self):
12271231

12281232

12291233
class Events:
1230-
listener_dict = dict()
1234+
listener_dict = dict() # type: Dict[str, Callable[..., None]]
12311235

12321236
@classmethod
12331237
def subscribe(cls, key, listener):

mypy.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mypy]
2+
ignore_missing_imports = True

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py33
7+
envlist = py3
88

99
[pycodestyle]
1010
max-line-length = 120

0 commit comments

Comments
 (0)