Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pyls/hookspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def pyls_execute_command(config, workspace, command, arguments):
pass


@hookspec
def pyls_experimental_capabilities(config, workspace):
pass


@hookspec(firstresult=True)
def pyls_format_document(config, workspace, document):
pass
Expand Down
11 changes: 9 additions & 2 deletions pyls/python_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _hook(self, hook_name, doc_uri=None, **kwargs):
return self._hook_caller(hook_name)(config=self.config, workspace=self.workspace, document=doc, **kwargs)

def capabilities(self):
return {
server_capabilities = {
'codeActionProvider': True,
'codeLensProvider': {
'resolveProvider': False, # We may need to make this configurable
Expand All @@ -66,8 +66,11 @@ def capabilities(self):
'signatureHelpProvider': {
'triggerCharacters': ['(', ',']
},
'textDocumentSync': lsp.TextDocumentSyncKind.INCREMENTAL
'textDocumentSync': lsp.TextDocumentSyncKind.INCREMENTAL,
'experimental': merge(self._hook('pyls_experimental_capabilities'))
}
log.info("Server capabilities: %s", server_capabilities)
return server_capabilities

def initialize(self, root_uri, init_opts, _process_id):
self.workspace = Workspace(root_uri, lang_server=self)
Expand Down Expand Up @@ -200,3 +203,7 @@ def m_workspace__execute_command(self, command=None, arguments=None):

def flatten(list_of_lists):
return [item for lst in list_of_lists for item in lst]


def merge(list_of_dicts):
return {k: v for dictionary in list_of_dicts for k, v in dictionary.items()}
3 changes: 0 additions & 3 deletions test/test_pyls.py

This file was deleted.