jq-lsp icon indicating copy to clipboard operation
jq-lsp copied to clipboard

change function_name/1 to function(x)

Open Freed-Wu opened this issue 1 year ago • 4 comments

Screenshot from 2024-10-12 10-23-03

  1. How about change the label of path/1 to path(a) like:

Screenshot from 2024-10-12 10-27-28

  1. Can we have a function signature like clangd for path(?

Screenshot from 2024-10-12 10-25-47

  1. some variable like $JQ_BUILD_CONFIGURATION doesn't exist in gojq. Should they be added manually?

Freed-Wu avatar Oct 12 '24 02:10 Freed-Wu

Screenshot from 2024-10-12 10-23-03

  1. How about change the label of path/1 to path(a) like:

Screenshot from 2024-10-12 10-27-28

That should be possible and i'm a bit surprised i didn't already do it, wonder if there was some issue? ill have a look

  1. Can we have a function signature like clangd for path(?

Screenshot from 2024-10-12 10-25-47

Show signature and documentation? with jq-lsp and vscode this is already possible using "textDocument/hover" but maybe other editors want something else?

Screenshot 2024-10-13 at 00 01 39

or do i misunderstand the issue?

  1. some variable like $JQ_BUILD_CONFIGURATION doesn't exist in gojq. Should they be added manually?

Yeap i've just forgot to add them, they can be added to https://github.com/wader/jq-lsp/blob/master/lsp/builtin_env.jq, for the most part the file is generated using this mess https://github.com/wader/jq-lsp/blob/master/lsp/gen_builtin_env.jq and i wonder if there is some way to find all globals automatically? 🤔

wader avatar Oct 12 '24 22:10 wader

Show signature and documentation

It should be signature help? https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_signatureHelp

Freed-Wu avatar Oct 13 '24 01:10 Freed-Wu

Show signature and documentation

It should be signature help? https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_signatureHelp

Thanks, yeap! i did a quick hack and can get vscode to send textDocument/signatureHelp on ( but there is some problems with how jq-lsp works atm, for example func() is not valid jq so parsing fails, need to do some pre-massaging of the source 🤔 also noticed that you keep getting signature help calls when moving the cursor amoung the args, not sure how that can supported, maybe simplest possible for now.

wader avatar Oct 14 '24 08:10 wader

@Freed-Wu signature helper kind of works but i can't figure out how communicate via LSP that a completion should "switch" over to signature help. Ex: you write "gsu" and complete it o "gsub()" no signature help is shown, but if you write "gsub(" it will work. gopls seems to be able to do this but i'm not sure if it's done entirely thru LSP or with help from the client somehow. A completion item can have a command thingy but not sure that is the correct way and also it does not seem to work well.

wader avatar Nov 19 '24 18:11 wader