File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11# Copyright 2017 Palantir Technologies, Inc.
22import logging
3+ import os .path as osp
34import parso
45from pyls import hookimpl , lsp , _utils
56
2223 'builtinfunction' : lsp .CompletionItemKind .Function ,
2324 'module' : lsp .CompletionItemKind .Module ,
2425 'file' : lsp .CompletionItemKind .File ,
26+ 'path' : lsp .CompletionItemKind .Text ,
2527 'xrange' : lsp .CompletionItemKind .Class ,
2628 'slice' : lsp .CompletionItemKind .Class ,
2729 'traceback' : lsp .CompletionItemKind .Class ,
@@ -130,6 +132,12 @@ def _format_completion(d, include_params=True):
130132 'insertText' : d .name
131133 }
132134
135+ if d .type == 'path' :
136+ path = osp .normpath (d .name )
137+ path = path .replace ('\\ ' , '\\ \\ ' )
138+ path = path .replace ('/' , '\\ /' )
139+ completion ['insertText' ] = path
140+
133141 if (include_params and hasattr (d , 'params' ) and d .params and
134142 not is_exception_class (d .name )):
135143 positional_args = [param for param in d .params if '=' not in param .description ]
You can’t perform that action at this time.
0 commit comments