configuration-language-server/confls/plugins/hover_systemd.py

21 lines
533 B
Python
Raw Normal View History

2021-09-09 18:31:23 +02:00
# Copyright 2017 Palantir Technologies, Inc.
import logging
from confls import hookimpl
from pyls import _utils
from confls.helpers import SYSTEMD_COMPLETOR
log = logging.getLogger(__name__)
@hookimpl
def pyls_hover(document, position):
code_position = _utils.position_to_jedi_linecolumn(document, position)
word = document.word_at_position(position)
details = SYSTEMD_COMPLETOR.get_one(word)
if details is not None:
return {'contents': details.doc, "contentFormat": "markdown"}
else:
return