Skip to content

Commit d22dad4

Browse files
committed
wip
1 parent 11baf27 commit d22dad4

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

lsp/lsp.jq

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,41 @@ def handle($state):
965965
contents: env_func_markdown
966966
})
967967
)
968+
elif $method == "textDocument/semanticTokens/full" then
969+
# "params": {"textDocument":{"uri":"file:///a"}}
970+
( $params.textDocument.uri as $uri
971+
| _readfile_uri($state; $uri) as $file
972+
| if $file == null then null_result end
973+
| result(
974+
{ data:
975+
[ $file.query
976+
| query_walk($uri; []; true)
977+
| .q
978+
| select(.term.func)
979+
| debug
980+
| .term.func as $t
981+
# line, startChar, length, tokenType, tokenModifiers
982+
| (( $file.text | byte_pos_to_lc($t.name.start)) | .line, .character)
983+
, ($t.name.stop - $t.name.start)
984+
, SemanticTokenTypeFunctionNr
985+
, 0
986+
# | .q.func_defs[] as $f
987+
# | { name : ($f | func_def_signature),
988+
# kind: SymbolKindFunction,
989+
# location:
990+
# { uri: $uri,
991+
# range:
992+
# { start: ($file.text | byte_pos_to_lc($f.name.start)),
993+
# end: ($file.text | byte_pos_to_lc($f.name.stop))
994+
# }
995+
# },
996+
# }
997+
]
998+
}
999+
| debug
1000+
# TODO: just traverse, no env
1001+
)
1002+
)
9681003
else
9691004
null
9701005
end
@@ -974,7 +1009,7 @@ def handle($state):
9741009
def serve:
9751010
( . as $state
9761011
| jsonrpc_read as $request
977-
#| debug({$request})
1012+
| debug({$request})
9781013
| $request
9791014
| try handle($state)
9801015
catch

0 commit comments

Comments
 (0)