mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 03:23:09 +03:00
language-server: add completion JSON parsers
This commit is contained in:
parent
6912c4753a
commit
a00a371268
@ -31,8 +31,8 @@
|
||||
^- all:request:lsp
|
||||
|^
|
||||
?+ method [%unknown jon]
|
||||
%text-document--hover
|
||||
(text-document--hover params id)
|
||||
%text-document--hover (text-document--hover params id)
|
||||
%text-document--completion (text-document--completion params id)
|
||||
==
|
||||
::
|
||||
++ text-document--hover
|
||||
@ -47,6 +47,15 @@
|
||||
~
|
||||
==
|
||||
::
|
||||
++ text-document--completion
|
||||
|= [params=json id=cord]
|
||||
:+ %text-document--completion id
|
||||
%. params
|
||||
%: ot
|
||||
position+position
|
||||
'textDocument'^text-document-id
|
||||
~
|
||||
==
|
||||
--
|
||||
::
|
||||
++ notification
|
||||
@ -169,9 +178,6 @@
|
||||
~
|
||||
==
|
||||
--
|
||||
::
|
||||
:: TODO: fix
|
||||
|
||||
::
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
@ -205,8 +211,8 @@
|
||||
^- json
|
||||
|^
|
||||
?- -.res
|
||||
%text-document--hover
|
||||
(text-document--hover res)
|
||||
%text-document--hover (text-document--hover res)
|
||||
%text-document--completion (text-document--completion res)
|
||||
==
|
||||
::
|
||||
++ wrap-in-id
|
||||
@ -223,6 +229,11 @@
|
||||
?~ contents.hov
|
||||
~
|
||||
s+u.contents.hov
|
||||
::
|
||||
++ text-document--completion
|
||||
|= com=text-document--completion:response:lsp
|
||||
%+ wrap-in-id id.com
|
||||
[%a (turn completion.com completion-item)]
|
||||
--
|
||||
++ unparse-method
|
||||
|= =cord
|
||||
@ -245,6 +256,19 @@
|
||||
;~(less (jest '--') hep)
|
||||
(star alf)
|
||||
::
|
||||
++ completion-item
|
||||
|= com=completion-item:lsp
|
||||
^- json
|
||||
%: pairs
|
||||
label+s+label.com
|
||||
detail+s+detail.com
|
||||
kind+(numb kind.com)
|
||||
'documentation'^s+doc.com
|
||||
'insertText'^s+insert-text.com
|
||||
'insertTextFormat'^(numb insert-text-format.com)
|
||||
~
|
||||
==
|
||||
::
|
||||
++ position
|
||||
|= =position:lsp
|
||||
^- json
|
||||
|
@ -8,10 +8,13 @@
|
||||
+$ all
|
||||
$%
|
||||
text-document--hover
|
||||
text-document--completion
|
||||
unknown
|
||||
==
|
||||
+$ text-document--hover
|
||||
[%text-document--hover id=cord position versioned-doc-id]
|
||||
+$ text-document--completion
|
||||
[%text-document--completion id=cord position versioned-doc-id]
|
||||
+$ unknown
|
||||
[%unknown json]
|
||||
--
|
||||
@ -20,10 +23,26 @@
|
||||
+$ all
|
||||
$%
|
||||
text-document--hover
|
||||
text-document--completion
|
||||
==
|
||||
+$ text-document--hover
|
||||
[%text-document--hover id=cord contents=(unit @t)]
|
||||
+$ text-document--completion
|
||||
[%text-document--completion id=cord completion=(list completion-item)]
|
||||
--
|
||||
::
|
||||
+$ completion-item
|
||||
$:
|
||||
label=cord
|
||||
kind=@ud
|
||||
detail=cord
|
||||
doc=cord
|
||||
insert-text=cord
|
||||
insert-text-format=@ud
|
||||
==
|
||||
|
||||
|
||||
|
||||
::
|
||||
+$ diagnostic
|
||||
[=range severity=@ud message=@t]
|
||||
|
@ -83,6 +83,22 @@
|
||||
~
|
||||
==
|
||||
::
|
||||
++ completion-item
|
||||
^- completion-item:lsp-sur
|
||||
['label' 1 'detail' 'doc' 'snippet' 1]
|
||||
::
|
||||
++ completion-item-jon
|
||||
^- json
|
||||
%: pairs
|
||||
label+s+'label'
|
||||
detail+s+'detail'
|
||||
kind+n+'1'
|
||||
documentation+s+'doc'
|
||||
'insertText'^s+'snippet'
|
||||
'insertTextFormat'^n+'1'
|
||||
~
|
||||
==
|
||||
::
|
||||
++ make-notification-jon
|
||||
|= [method=@t params=json]
|
||||
^- json
|
||||
@ -174,6 +190,19 @@
|
||||
['textDocument' text-document-id-jon]
|
||||
~
|
||||
==
|
||||
++ test-parse-completion
|
||||
%+ expect-eq
|
||||
!> ^- all:request:lsp-sur
|
||||
[%text-document--completion '3' position text-document-id]
|
||||
!> %- request:dejs
|
||||
^- json
|
||||
%^ make-request-jon '3' 'textDocument/completion'
|
||||
:- %o
|
||||
%: malt
|
||||
['position' position-jon]
|
||||
['textDocument' text-document-id-jon]
|
||||
~
|
||||
==
|
||||
:: to JSON
|
||||
::
|
||||
:: notifications
|
||||
@ -199,4 +228,12 @@
|
||||
%+ make-response-jon '1'
|
||||
%+ frond 'contents'
|
||||
s+'text'
|
||||
::
|
||||
++ test-enjs-completion
|
||||
%+ expect-eq
|
||||
!> %- response:enjs
|
||||
[%text-document--completion '1' ~[completion-item]]
|
||||
!> ^- json
|
||||
%+ make-response-jon '1'
|
||||
[%a ~[completion-item-jon]]
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user