halfbrained / cuda_lsp

LSP Client plugin for CudaText
6 stars 4 forks source link

signature help? #53

Closed Alexey-T closed 3 years ago

Alexey-T commented 3 years ago

https://github.com/palantir/python-language-server Signature Help: https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/signature-help.gif

у нас по 'function hint' совсем не то показывает- для sys.stdin.read кажет "n"

halfbrained commented 3 years ago

Из вики:

on_func_hint ... Method should return function-hint string (comma-separated parameters, brackets are optional).

Я просто следовал букве закона :)

Я с огромным удовольствием показывал бы типа параметров и активный параметр; описание функции наверное достаточно иметь в hover? Вот что сервер дает в этом случае:

{'activeParameter': 0,
 'activeSignature': 0,
 'message_id': 1,
 'signatures': [{'activeParameter': None,
                 'documentation': '',
                 'label': 'read(n: int=...) -> AnyStr',
                 'parameters': [{'documentation': None, 'label': 'n'}]}]}

и например еще re.match() (это из команды плагина - Server responses)

{'activeParameter': 0,
 'activeSignature': 0,
 'message_id': 2,
 'signatures': [{'activeParameter': None,
                 'documentation': 'Try to apply the pattern at the start of the string, returning\n'
                                  'a Match object, or None if no match was found.',
                 'label': 'match(pattern: AnyStr, string: AnyStr, flags: _FlagsType=...) -> '
                          'Optional[Match[AnyStr]]',
                 'parameters': [{'documentation': None, 'label': 'pattern'},
                                {'documentation': None, 'label': 'string'},
                                {'documentation': None, 'label': 'flags'}]}]}

Есть шанс добавить сюда цвета или хотя бы bold,italic? Потому что простой текст не очень помогает

func_hint

Alexey-T commented 3 years ago

you can return str, or True!

on_func_hint(self, ed_self): Called by "show function-hint" command (default hotkey: Ctrl+Shift+Space). Method should return function-hint string (comma-separated parameters, brackets are optional). Empty string or None mean that no hint was found. True return value means that plugin handled the event, don't call other plugins.

if True, show func-tip with msg_status_alt()

2) bold html tags in result str-- Todo for me

3) why linked pic shows different params-tooltip?

Alexey-T commented 3 years ago

нужен небольшой фикс- on_func_hint отдавать не '' а True, потом плаг все равно показывает msg_status_alt.

halfbrained commented 3 years ago

I meant that wiki quote says result should be just a

comma-separated parameters

I understood that I should give just parameter names coma-separated... for sys.stdin.read it is just n

...anyway, does this looks alright for now?

hint2

Alexey-T commented 3 years ago

it can be

Alexey-T commented 3 years ago

new variant looks better!

halfbrained commented 3 years ago

changed