ndonfris / fish-lsp

LSP implementation for the fish shell langauge 🐠
https://fish-lsp.dev
MIT License
97 stars 6 forks source link

BUG There is no hover on `function` keyword options #32

Closed kmoschcau closed 5 months ago

kmoschcau commented 5 months ago

Describe the bug When hovering on options for the function keyword, there is no result returned.

To Reproduce Write this in a fish file:

function foo \
    --description "For demonstration purposes"
end

Then hover over --description and observe that there is no hover result.

Expected behavior There should be a hover result as with other command and keyword options.

Screenshots N/A

Please complete the following information:

OS NAME: GNU/Linux
YARN VERSION: 1.22.19
NODE VERSION: v21.6.1
FISH VERSION: fish, version 3.7.1
FISH-LSP VERSION: 1.0.4

Additional context Here are excerpts of fish-lsp's logs.txt and of nvim's lsp.log. They both reflect first a hover on function and then on --description.

fish-lsp logs.txt ``` { "handler": "onHover", "params": [ { "position": { "line": 0, "character": 0 }, "textDocument": { "uri": "file:///home/kmoschcau/.config/fish/functions/ll.fish" } } ] } {"date":"6/5/2024, 10:33:44 AM","message":"docCache found true"} { "handler": "onHover", "params": [ { "position": { "line": 1, "character": 4 }, "textDocument": { "uri": "file:///home/kmoschcau/.config/fish/functions/ll.fish" } } ] } {"date":"6/5/2024, 10:33:49 AM","message":"docCache found true"} ```
nvim lsp.log ``` [DEBUG][2024-06-05 10:33:44] ...m/lsp/client.lua:678 "LSP[fish_lsp]" "client.request" 2 "textDocument/hover" { position = { character = 0, line = 0 }, textDocument = { uri = "file:///home/kmoschcau/.config/fish/functions/ll.fish" }} 1 [DEBUG][2024-06-05 10:33:44] .../vim/lsp/rpc.lua:286 "rpc.send" { id = 4, jsonrpc = "2.0", method = "textDocument/hover", params = { position = { character = 0, line = 0 }, textDocument = { uri = "file:///home/kmoschcau/.config/fish/functions/ll.fish" } }} [DEBUG][2024-06-05 10:33:44] .../vim/lsp/rpc.lua:408 "rpc.receive" { id = 4, jsonrpc = "2.0", result = { contents = { kind = "markdown", value = "__FUNCTION__ - _https://fishshell.com/docs/current/cmds/function.html_\n___\n```man\nNAME\n function - create a function\n\nSYNOPSIS\n function NAME [OPTIONS]; BODY; end\n\nDESCRIPTION\n function creates a new function NAME with the body BODY.\n\n A function is a list of commands that will be executed when the name of\n the function is given as a command.\n\n The following options are available:\n\n -a NAMES or --argument-names NAMES\n Assigns the value of successive command-line arguments to the\n names given in NAMES. These are the same arguments given in\n argv, and are still available there. See also Argument Handling.\n\n -d DESCRIPTION or --description DESCRIPTION\n A description of what the function does, suitable as a comple‐\n tion description.\n\n -w WRAPPED_COMMAND or --wraps WRAPPED_COMMAND\n Inherit completions from the given WRAPPED_COMMAND. See the doc‐\n umentation for complete for more information.\n\n -e EVENT_NAME or --on-event EVENT_NAME\n Run this function when the specified named event is emitted.\n Fish internally generates named events, for example, when show‐\n ing the prompt. Custom events can be emitted using the emit com‐\n mand.\n\n -v VARIABLE_NAME or --on-variable VARIABLE_NAME\n Run this function when the variable VARIABLE_NAME changes value.\n Note that fish makes no guarantees on any particular timing or\n even that the function will be run for every single set. Rather\n it will be run when the variable has been set at least once,\n possibly skipping some values or being run when the variable has\n been set to the same value (except for universal variables set\n in other shells - only changes in the value will be picked up\n for those).\n\n -j PID or --on-job-exit PID\n Run this function when the job containing a child process with\n the given process identifier PID exits. Instead of a PID, the\n string 'caller' can be specified. This is only allowed when in a\n command substitution, and will result in the handler being trig‐\n gered by the exit of the job which created this command substi‐\n tution.\n\n -p PID or --on-process-exit PID\n Run this function when the fish child process with process ID\n PID exits. Instead of a PID, for backward compatibility, \"%self\"\n can be specified as an alias for $fish_pid, and the function\n will be run when the current fish instance exits.\n\n -s SIGSPEC or --on-signal SIGSPEC\n Run this function when the signal SIGSPEC is delivered. SIGSPEC\n can be a signal number, or the signal name, such as SIGHUP (or\n just HUP). Note that the signal must have been delivered to\n fish; for example, Ctrl-C sends SIGINT to the foreground process\n group, which will not be fish if you are running another command\n at the time. Observing a signal will prevent fish from exiting\n in response to that signal.\n\n -S or --no-scope-shadowing\n Allows the function to access the variables of calling func‐\n tions. Normally, any variables inside the function that have the\n same name as variables from the calling function are \"shadowed\",\n and their contents are independent of the calling function.\n\n It's important to note that this does not capture referenced\n variables or the scope at the time of function declaration! At\n this time, fish does not have any concept of closures, and vari‐\n able lifetimes are never extended. In other words, by using\n --no-scope-shadowing the scope of the function each time it is\n run is shared with the scope it was called from rather than the\n scope it was defined in.\n\n -V or --inherit-variable NAME\n Snapshots the value of the variable NAME and defines a local\n variable with that same name and value when the function is de‐\n fined. This is similar to a closure in other languages like\n Python but a bit different. Note the word \"snapshot\" in the\n first sentence. If you change the value of the variable after\n defining the function, even if you do so in the same scope (typ‐\n ically another function) the new value will not be used by the\n function you just created using this option. See the function\n notify example below for how this might be used.\n\n The event handler switches (on-event, on-variable, on-job-exit,\n on-process-exit and on-signal) cause a function to run automatically at\n specific events. New named events for --on-event can be fired using the\n emit builtin. Fish already generates a few events, see Event handlers\n for more.\n\n Functions may not be named the same as a reserved keyword. These are\n elements of fish syntax or builtin commands which are essential for the\n operations of the shell. Current reserved words are [, _, and, arg‐\n parse, begin, break, builtin, case, command, continue, else, end, eval,\n exec, for, function, if, not, or, read, return, set, status, string,\n switch, test, time, and while.\n\nEXAMPLE\n function ll\n ls -l $argv\n end\n\n will run the ls command, using the -l option, while passing on any ad‐\n ditional files and switches to ls.\n\n function mkdir -d \"Create a directory and set CWD\"\n command mkdir $argv\n if test $status = 0\n switch $argv[(count $argv)]\n case '-*'\n\n case '*'\n cd $argv[(count $argv)]\n return\n end\n end\n end\n\n This will run the mkdir command, and if it is successful, change the\n current working directory to the one just created.\n\n function notify\n set -l job (jobs -l -g)\n or begin; echo \"There are no jobs\" >&2; return 1; end\n\n function _notify_job_$job --on-job-exit $job --inherit-variable job\n echo -n \\a # beep\n functions -e _notify_job_$job\n end\n end\n\n This will beep when the most recent job completes.\n\nNOTES\n Events are only received from the current fish process as there is no\n way to send events from one fish process to another.\n\nSEE MORE\n For more explanation of how functions fit into fish, see Functions.\n\nCOPYRIGHT\n 2023, fish-shell developers\n\n3.7 Mar 19, 2024 FUNCTION(1)\n```" } }} [TRACE][2024-06-05 10:33:44] ...lsp/handlers.lua:712 "default_handler" "textDocument/hover" { config = { border = "rounded" }, ctx = '{\n bufnr = 1,\n client_id = 2,\n method = "textDocument/hover",\n params = {\n position = {\n character = 0,\n line = 0\n },\n textDocument = {\n uri = "file:///home/kmoschcau/.config/fish/functions/ll.fish"\n }\n },\n version = 4\n}', result = { contents = { kind = "markdown", value = "__FUNCTION__ - _https://fishshell.com/docs/current/cmds/function.html_\n___\n```man\nNAME\n function - create a function\n\nSYNOPSIS\n function NAME [OPTIONS]; BODY; end\n\nDESCRIPTION\n function creates a new function NAME with the body BODY.\n\n A function is a list of commands that will be executed when the name of\n the function is given as a command.\n\n The following options are available:\n\n -a NAMES or --argument-names NAMES\n Assigns the value of successive command-line arguments to the\n names given in NAMES. These are the same arguments given in\n argv, and are still available there. See also Argument Handling.\n\n -d DESCRIPTION or --description DESCRIPTION\n A description of what the function does, suitable as a comple‐\n tion description.\n\n -w WRAPPED_COMMAND or --wraps WRAPPED_COMMAND\n Inherit completions from the given WRAPPED_COMMAND. See the doc‐\n umentation for complete for more information.\n\n -e EVENT_NAME or --on-event EVENT_NAME\n Run this function when the specified named event is emitted.\n Fish internally generates named events, for example, when show‐\n ing the prompt. Custom events can be emitted using the emit com‐\n mand.\n\n -v VARIABLE_NAME or --on-variable VARIABLE_NAME\n Run this function when the variable VARIABLE_NAME changes value.\n Note that fish makes no guarantees on any particular timing or\n even that the function will be run for every single set. Rather\n it will be run when the variable has been set at least once,\n possibly skipping some values or being run when the variable has\n been set to the same value (except for universal variables set\n in other shells - only changes in the value will be picked up\n for those).\n\n -j PID or --on-job-exit PID\n Run this function when the job containing a child process with\n the given process identifier PID exits. Instead of a PID, the\n string 'caller' can be specified. This is only allowed when in a\n command substitution, and will result in the handler being trig‐\n gered by the exit of the job which created this command substi‐\n tution.\n\n -p PID or --on-process-exit PID\n Run this function when the fish child process with process ID\n PID exits. Instead of a PID, for backward compatibility, \"%self\"\n can be specified as an alias for $fish_pid, and the function\n will be run when the current fish instance exits.\n\n -s SIGSPEC or --on-signal SIGSPEC\n Run this function when the signal SIGSPEC is delivered. SIGSPEC\n can be a signal number, or the signal name, such as SIGHUP (or\n just HUP). Note that the signal must have been delivered to\n fish; for example, Ctrl-C sends SIGINT to the foreground process\n group, which will not be fish if you are running another command\n at the time. Observing a signal will prevent fish from exiting\n in response to that signal.\n\n -S or --no-scope-shadowing\n Allows the function to access the variables of calling func‐\n tions. Normally, any variables inside the function that have the\n same name as variables from the calling function are \"shadowed\",\n and their contents are independent of the calling function.\n\n It's important to note that this does not capture referenced\n variables or the scope at the time of function declaration! At\n this time, fish does not have any concept of closures, and vari‐\n able lifetimes are never extended. In other words, by using\n --no-scope-shadowing the scope of the function each time it is\n run is shared with the scope it was called from rather than the\n scope it was defined in.\n\n -V or --inherit-variable NAME\n Snapshots the value of the variable NAME and defines a local\n variable with that same name and value when the function is de‐\n fined. This is similar to a closure in other languages like\n Python but a bit different. Note the word \"snapshot\" in the\n first sentence. If you change the value of the variable after\n defining the function, even if you do so in the same scope (typ‐\n ically another function) the new value will not be used by the\n function you just created using this option. See the function\n notify example below for how this might be used.\n\n The event handler switches (on-event, on-variable, on-job-exit,\n on-process-exit and on-signal) cause a function to run automatically at\n specific events. New named events for --on-event can be fired using the\n emit builtin. Fish already generates a few events, see Event handlers\n for more.\n\n Functions may not be named the same as a reserved keyword. These are\n elements of fish syntax or builtin commands which are essential for the\n operations of the shell. Current reserved words are [, _, and, arg‐\n parse, begin, break, builtin, case, command, continue, else, end, eval,\n exec, for, function, if, not, or, read, return, set, status, string,\n switch, test, time, and while.\n\nEXAMPLE\n function ll\n ls -l $argv\n end\n\n will run the ls command, using the -l option, while passing on any ad‐\n ditional files and switches to ls.\n\n function mkdir -d \"Create a directory and set CWD\"\n command mkdir $argv\n if test $status = 0\n switch $argv[(count $argv)]\n case '-*'\n\n case '*'\n cd $argv[(count $argv)]\n return\n end\n end\n end\n\n This will run the mkdir command, and if it is successful, change the\n current working directory to the one just created.\n\n function notify\n set -l job (jobs -l -g)\n or begin; echo \"There are no jobs\" >&2; return 1; end\n\n function _notify_job_$job --on-job-exit $job --inherit-variable job\n echo -n \\a # beep\n functions -e _notify_job_$job\n end\n end\n\n This will beep when the most recent job completes.\n\nNOTES\n Events are only received from the current fish process as there is no\n way to send events from one fish process to another.\n\nSEE MORE\n For more explanation of how functions fit into fish, see Functions.\n\nCOPYRIGHT\n 2023, fish-shell developers\n\n3.7 Mar 19, 2024 FUNCTION(1)\n```" } }} [DEBUG][2024-06-05 10:33:49] ...m/lsp/client.lua:678 "LSP[fish_lsp]" "client.request" 2 "textDocument/hover" { position = { character = 4, line = 1 }, textDocument = { uri = "file:///home/kmoschcau/.config/fish/functions/ll.fish" }} 1 [DEBUG][2024-06-05 10:33:49] .../vim/lsp/rpc.lua:286 "rpc.send" { id = 5, jsonrpc = "2.0", method = "textDocument/hover", params = { position = { character = 4, line = 1 }, textDocument = { uri = "file:///home/kmoschcau/.config/fish/functions/ll.fish" } }} [DEBUG][2024-06-05 10:33:49] .../vim/lsp/rpc.lua:408 "rpc.receive" { id = 5, jsonrpc = "2.0"} [TRACE][2024-06-05 10:33:49] ...lsp/handlers.lua:712 "default_handler" "textDocument/hover" { config = { border = "rounded" }, ctx = '{\n bufnr = 1,\n client_id = 2,\n method = "textDocument/hover",\n params = {\n position = {\n character = 4,\n line = 1\n },\n textDocument = {\n uri = "file:///home/kmoschcau/.config/fish/functions/ll.fish"\n }\n },\n version = 4\n}'} ```
ndonfris commented 5 months ago

I like how you format your functions!

Never thought of using the multi line escape char there before. I rarely use \ or SyntaxNode.type.escape_sequence in fish, and am unsure how it effects the current feature set. I'll work on improving that before the next release.

It looks like, from the nvim lsp.log, that your client shows that it received a proper response message for the function hover.

lines 3 and 4 ``` [DEBUG][2024-06-05 10:33:44] .../vim/lsp/rpc.lua:408 "rpc.receive" { id = 4, jsonrpc = "2.0", result = { contents = { kind = "markdown", value = "__FUNCTION__ - _https://fishshell.com/docs/current/cmds/function.html_\n___\n```man\nNAME\n function - create a function\n\nSYNOPSIS\n function NAME [OPTIONS]; BODY; end\n\nDESCRIPTION\n function creates a new function NAME with the body BODY.\n\n A function is a list of commands that will be executed when the name of\n the function is given as a command.\n\n The following options are available:\n\n -a NAMES or --argument-names NAMES\n Assigns the value of successive command-line arguments to the\n names given in NAMES. These are the same arguments given in\n argv, and are still available there. See also Argument Handling.\n\n -d DESCRIPTION or --description DESCRIPTION\n A description of what the function does, suitable as a comple‐\n tion description.\n\n -w WRAPPED_COMMAND or --wraps WRAPPED_COMMAND\n Inherit completions from the given WRAPPED_COMMAND. See the doc‐\n umentation for complete for more information.\n\n -e EVENT_NAME or --on-event EVENT_NAME\n Run this function when the specified named event is emitted.\n Fish internally generates named events, for example, when show‐\n ing the prompt. Custom events can be emitted using the emit com‐\n mand.\n\n -v VARIABLE_NAME or --on-variable VARIABLE_NAME\n Run this function when the variable VARIABLE_NAME changes value.\n Note that fish makes no guarantees on any particular timing or\n even that the function will be run for every single set. Rather\n it will be run when the variable has been set at least once,\n possibly skipping some values or being run when the variable has\n been set to the same value (except for universal variables set\n in other shells - only changes in the value will be picked up\n for those).\n\n -j PID or --on-job-exit PID\n Run this function when the job containing a child process with\n the given process identifier PID exits. Instead of a PID, the\n string 'caller' can be specified. This is only allowed when in a\n command substitution, and will result in the handler being trig‐\n gered by the exit of the job which created this command substi‐\n tution.\n\n -p PID or --on-process-exit PID\n Run this function when the fish child process with process ID\n PID exits. Instead of a PID, for backward compatibility, \"%self\"\n can be specified as an alias for $fish_pid, and the function\n will be run when the current fish instance exits.\n\n -s SIGSPEC or --on-signal SIGSPEC\n Run this function when the signal SIGSPEC is delivered. SIGSPEC\n can be a signal number, or the signal name, such as SIGHUP (or\n just HUP). Note that the signal must have been delivered to\n fish; for example, Ctrl-C sends SIGINT to the foreground process\n group, which will not be fish if you are running another command\n at the time. Observing a signal will prevent fish from exiting\n in response to that signal.\n\n -S or --no-scope-shadowing\n Allows the function to access the variables of calling func‐\n tions. Normally, any variables inside the function that have the\n same name as variables from the calling function are \"shadowed\",\n and their contents are independent of the calling function.\n\n It's important to note that this does not capture referenced\n variables or the scope at the time of function declaration! At\n this time, fish does not have any concept of closures, and vari‐\n able lifetimes are never extended. In other words, by using\n --no-scope-shadowing the scope of the function each time it is\n run is shared with the scope it was called from rather than the\n scope it was defined in.\n\n -V or --inherit-variable NAME\n Snapshots the value of the variable NAME and defines a local\n variable with that same name and value when the function is de‐\n fined. This is similar to a closure in other languages like\n Python but a bit different. Note the word \"snapshot\" in the\n first sentence. If you change the value of the variable after\n defining the function, even if you do so in the same scope (typ‐\n ically another function) the new value will not be used by the\n function you just created using this option. See the function\n notify example below for how this might be used.\n\n The event handler switches (on-event, on-variable, on-job-exit,\n on-process-exit and on-signal) cause a function to run automatically at\n specific events. New named events for --on-event can be fired using the\n emit builtin. Fish already generates a few events, see Event handlers\n for more.\n\n Functions may not be named the same as a reserved keyword. These are\n elements of fish syntax or builtin commands which are essential for the\n operations of the shell. Current reserved words are [, _, and, arg‐\n parse, begin, break, builtin, case, command, continue, else, end, eval,\n exec, for, function, if, not, or, read, return, set, status, string,\n switch, test, time, and while.\n\nEXAMPLE\n function ll\n ls -l $argv\n end\n\n will run the ls command, using the -l option, while passing on any ad‐\n ditional files and switches to ls.\n\n function mkdir -d \"Create a directory and set CWD\"\n command mkdir $argv\n if test $status = 0\n switch $argv[(count $argv)]\n case '-*'\n\n case '*'\n cd $argv[(count $argv)]\n return\n end\n end\n end\n\n This will run the mkdir command, and if it is successful, change the\n current working directory to the one just created.\n\n function notify\n set -l job (jobs -l -g)\n or begin; echo \"There are no jobs\" >&2; return 1; end\n\n function _notify_job_$job --on-job-exit $job --inherit-variable job\n echo -n \\a # beep\n functions -e _notify_job_$job\n end\n end\n\n This will beep when the most recent job completes.\n\nNOTES\n Events are only received from the current fish process as there is no\n way to send events from one fish process to another.\n\nSEE MORE\n For more explanation of how functions fit into fish, see Functions.\n\nCOPYRIGHT\n 2023, fish-shell developers\n\n3.7 Mar 19, 2024 FUNCTION(1)\n```" } }} [TRACE][2024-06-05 10:33:44] ...lsp/handlers.lua:712 "default_handler" "textDocument/hover" { config = { border = "rounded" }, ctx = '{\n bufnr = 1,\n client_id = 2,\n method = "textDocument/hover",\n params = {\n position = {\n character = 0,\n line = 0\n },\n textDocument = {\n uri = "file:///home/kmoschcau/.config/fish/functions/ll.fish"\n }\n },\n version = 4\n}', result = { contents = { kind = "markdown", value = "__FUNCTION__ - _https://fishshell.com/docs/current/cmds/function.html_\n___\n```man\nNAME\n function - create a function\n\nSYNOPSIS\n function NAME [OPTIONS]; BODY; end\n\nDESCRIPTION\n function creates a new function NAME with the body BODY.\n\n A function is a list of commands that will be executed when the name of\n the function is given as a command.\n\n The following options are available:\n\n -a NAMES or --argument-names NAMES\n Assigns the value of successive command-line arguments to the\n names given in NAMES. These are the same arguments given in\n argv, and are still available there. See also Argument Handling.\n\n -d DESCRIPTION or --description DESCRIPTION\n A description of what the function does, suitable as a comple‐\n tion description.\n\n -w WRAPPED_COMMAND or --wraps WRAPPED_COMMAND\n Inherit completions from the given WRAPPED_COMMAND. See the doc‐\n umentation for complete for more information.\n\n -e EVENT_NAME or --on-event EVENT_NAME\n Run this function when the specified named event is emitted.\n Fish internally generates named events, for example, when show‐\n ing the prompt. Custom events can be emitted using the emit com‐\n mand.\n\n -v VARIABLE_NAME or --on-variable VARIABLE_NAME\n Run this function when the variable VARIABLE_NAME changes value.\n Note that fish makes no guarantees on any particular timing or\n even that the function will be run for every single set. Rather\n it will be run when the variable has been set at least once,\n possibly skipping some values or being run when the variable has\n been set to the same value (except for universal variables set\n in other shells - only changes in the value will be picked up\n for those).\n\n -j PID or --on-job-exit PID\n Run this function when the job containing a child process with\n the given process identifier PID exits. Instead of a PID, the\n string 'caller' can be specified. This is only allowed when in a\n command substitution, and will result in the handler being trig‐\n gered by the exit of the job which created this command substi‐\n tution.\n\n -p PID or --on-process-exit PID\n Run this function when the fish child process with process ID\n PID exits. Instead of a PID, for backward compatibility, \"%self\"\n can be specified as an alias for $fish_pid, and the function\n will be run when the current fish instance exits.\n\n -s SIGSPEC or --on-signal SIGSPEC\n Run this function when the signal SIGSPEC is delivered. SIGSPEC\n can be a signal number, or the signal name, such as SIGHUP (or\n just HUP). Note that the signal must have been delivered to\n fish; for example, Ctrl-C sends SIGINT to the foreground process\n group, which will not be fish if you are running another command\n at the time. Observing a signal will prevent fish from exiting\n in response to that signal.\n\n -S or --no-scope-shadowing\n Allows the function to access the variables of calling func‐\n tions. Normally, any variables inside the function that have the\n same name as variables from the calling function are \"shadowed\",\n and their contents are independent of the calling function.\n\n It's important to note that this does not capture referenced\n variables or the scope at the time of function declaration! At\n this time, fish does not have any concept of closures, and vari‐\n able lifetimes are never extended. In other words, by using\n --no-scope-shadowing the scope of the function each time it is\n run is shared with the scope it was called from rather than the\n scope it was defined in.\n\n -V or --inherit-variable NAME\n Snapshots the value of the variable NAME and defines a local\n variable with that same name and value when the function is de‐\n fined. This is similar to a closure in other languages like\n Python but a bit different. Note the word \"snapshot\" in the\n first sentence. If you change the value of the variable after\n defining the function, even if you do so in the same scope (typ‐\n ically another function) the new value will not be used by the\n function you just created using this option. See the function\n notify example below for how this might be used.\n\n The event handler switches (on-event, on-variable, on-job-exit,\n on-process-exit and on-signal) cause a function to run automatically at\n specific events. New named events for --on-event can be fired using the\n emit builtin. Fish already generates a few events, see Event handlers\n for more.\n\n Functions may not be named the same as a reserved keyword. These are\n elements of fish syntax or builtin commands which are essential for the\n operations of the shell. Current reserved words are [, _, and, arg‐\n parse, begin, break, builtin, case, command, continue, else, end, eval,\n exec, for, function, if, not, or, read, return, set, status, string,\n switch, test, time, and while.\n\nEXAMPLE\n function ll\n ls -l $argv\n end\n\n will run the ls command, using the -l option, while passing on any ad‐\n ditional files and switches to ls.\n\n function mkdir -d \"Create a directory and set CWD\"\n command mkdir $argv\n if test $status = 0\n switch $argv[(count $argv)]\n case '-*'\n\n case '*'\n cd $argv[(count $argv)]\n return\n end\n end\n end\n\n This will run the mkdir command, and if it is successful, change the\n current working directory to the one just created.\n\n function notify\n set -l job (jobs -l -g)\n or begin; echo \"There are no jobs\" >&2; return 1; end\n\n function _notify_job_$job --on-job-exit $job --inherit-variable job\n echo -n \\a # beep\n functions -e _notify_job_$job\n end\n end\n\n This will beep when the most recent job completes.\n\nNOTES\n Events are only received from the current fish process as there is no\n way to send events from one fish process to another.\n\nSEE MORE\n For more explanation of how functions fit into fish, see Functions.\n\nCOPYRIGHT\n 2023, fish-shell developers\n\n3.7 Mar 19, 2024 FUNCTION(1)\n```" } }} ```

Which part is not working for you?

Kooha-2024-06-05-13-41-09


As for the --description flag, I am aware of the hover result not being provided to functions. Due to the way tree-sitter-fish structures it's syntax tree, --flag hover documentation is only avaliable to command nodes currently. I don't think adding an edge case for supporting the function_definition case shouldn't be too difficult though.

Once, I get a better working demo of signature support completed, the hover handler will be reworked to support creating more types of documentaion.

For anyone interested in helping implement the signatureHandler features for a function will include:

  • --argument-names popups for signature during autocomplete
  • --description "value" using "value" for describing the function
  • possibly other relevant flags requested
ndonfris commented 5 months ago

The logs, are a little misleading in the current state.

The logs, typically are only used to show what parameters a function retrieved.

The docCache not found message, just means that there wasn't an already stored description available for the function foo, before it searches for what type of result to build.

kmoschcau commented 5 months ago

I like how you format your functions!

Thanks. I think it's just more readable that way.

My concern was only that there was no hover for --description and other flag type options. If that's already a known problem in general, we can close this issue.