Skip to content

Commit

Permalink
Rework textDocument/signatureHelp
Browse files Browse the repository at this point in the history
- Proper handling of markdown parameter docs.
- Don't assume that function signatures have an `(` and `)`.
- Put the *active parameter docs* at the top, font-size 1rem.
- Put the *signature docs* under that, font-size 0.9rem.
- Use 0.9rem font-size for the intro message.
- KISS.
  • Loading branch information
rwols committed Dec 6, 2020
1 parent bb897e5 commit 9c9e5e5
Show file tree
Hide file tree
Showing 5 changed files with 435 additions and 561 deletions.
38 changes: 36 additions & 2 deletions plugin/core/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
TextDocumentSyncKindIncremental = 2


class DiagnosticSeverity(object):
class DiagnosticSeverity:
Error = 1
Warning = 2
Information = 3
Expand All @@ -26,13 +26,19 @@ class InsertTextFormat:
Snippet = 2


class DocumentHighlightKind(object):
class DocumentHighlightKind:
Unknown = 0
Text = 1
Read = 2
Write = 3


class SignatureHelpTriggerKind:
Invoked = 1
TriggerCharacter = 2
ContentChange = 3


ExecuteCommandParams = TypedDict('ExecuteCommandParams', {
'command': str,
'arguments': Optional[List[Any]],
Expand All @@ -56,6 +62,34 @@ class DocumentHighlightKind(object):
})


ParameterInformation = TypedDict('ParameterInformation', {
'label': Union[str, List[int]],
'documentation': Union[str, Dict[str, str]]
}, total=False)


SignatureInformation = TypedDict('SignatureInformation', {
'label': str,
'documentation': Union[str, Dict[str, str]],
'parameters': List[ParameterInformation]
}, total=False)


SignatureHelp = TypedDict('SignatureHelp', {
'signatures': List[SignatureInformation],
'activeSignature': int,
'activeParameter': int,
}, total=False)


SignatureHelpContext = TypedDict('SignatureHelpContext', {
'triggerKind': int,
'triggerCharacter': str,
'isRetrigger': bool,
'activeSignatureHelp': SignatureHelp
}, total=False)


class Request:

__slots__ = ('method', 'params', 'view')
Expand Down
Loading

0 comments on commit 9c9e5e5

Please sign in to comment.