language-server: dynamically compute subject
Dynamically compute subject so that language server can see arms
from imports. Fall back to -:!>(..zuse) if the build is an app,
because of opaque payloads.
==
[cards state]
::
+++ get-subject
+ |= uri=@t
+ ^- type
+ =/ =path
+ (parse-uri:build uri)
+ ?: ?=([%app *] path)
+ (get-app-subject uri)
+ -:(~(gut by builds) uri !>(..zuse))
+::
+++ get-app-subject
+ |= uri=@t
+ ^- type
+ -:!>(..zuse)
+::
++ handle-completion
|= com=text-document--completion:request:lsp-sur
^- (quip card _state)
=+ (get-id:auto pos txt)
?~ id ~
=/ matches=(list (option:auto type))
- (search-prefix:auto u.id (get-identifiers:auto -:!>(..zuse)))
+ (search-prefix:auto u.id (get-identifiers:auto (get-subject uri.com)))
?~ matches ~
(turn matches make-completion-item)
::
?~ id
[(give-rpc-response [%text-document--hover id.hov ~]) state]
=/ match=(unit (option:auto type))
- (search-exact:auto u.id (get-identifiers:auto -:!>(..zuse)))
+ (search-exact:auto u.id (get-identifiers:auto (get-subject uri.hov)))
?~ match
[(give-rpc-response [%text-document--hover id.hov ~]) state]
=/ contents
