Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering markdown in documentation #896

Open
2 tasks done
juanlopez4691 opened this issue Jan 4, 2025 · 2 comments
Open
2 tasks done

Rendering markdown in documentation #896

juanlopez4691 opened this issue Jan 4, 2025 · 2 comments
Labels
bug Something isn't working windows Module which displays UI

Comments

@juanlopez4691
Copy link

juanlopez4691 commented Jan 4, 2025

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

Documentation markdown for autocompletion options doesn't render correctly. E.g.
Screenshot 2025-01-05 at 00 34 49
image

Those are samples of PHP code (from a WordPress project and from a Laravel file)

I am using a configuration based on LazyVim.
I also tried with just the default config for blink.cmp (no customizations at all) and got the same results.

Relevant configuration

No response

neovim version

NVIM v0.10.3

blink.cmp version: branch, tag, or commit

v0.9.2 (commit e3b7cb4)

@juanlopez4691 juanlopez4691 added the bug Something isn't working label Jan 4, 2025
@Saghen
Copy link
Owner

Saghen commented Jan 4, 2025

Do me a favor and send the output of vim.print(item) at this position: https://github.com/Saghen/blink.cmp/blob/main/lua/blink/cmp/completion/windows/documentation.lua#L64

@Saghen Saghen added the windows Module which displays UI label Jan 4, 2025
@juanlopez4691
Copy link
Author

@Saghen This is what got (a couple of samples):


  kind = 3,
  label = "wp",
  score = 26,
  score_offset = 0,
  sortText = "00002",
  source_id = "lsp",
  source_name = "LSP",
  textEdit = {
    newText = "wp($0)",
    range = {
      ["end"] = {
        character = 9,
        line = 85
      },
      start = {
        character = 7,
        line = 85
      }
    }
  }
}
{
  client_id = 2,
  command = {
    command = "editor.action.triggerParameterHints",
    title = "Trigger Parameter Hints"
  },
  cursor_column = 10,
  data = "8566268271529177",
  detail = "wp_die([$message [, $title [, $args]]])",
  documentation = {
    kind = "markdown",
    value = "__wp\\_die__\n\nKills WordPress execution and displays HTML page with an error message.\n\n```php\n<?php\nfunction wp_die($message = '', $title = '', $args = array()) { }\n```\n\nThis function complements the `die()` PHP function. The difference is that\nHTML will be displayed to the user. It is recommended to use this function\nonly when the execution should not continue any further. It is not recommended\nto call this function very often, and try to handle as many errors as possible\nsilently or more gracefully.\n\nAs a shorthand, the desired HTTP response code may be passed as an integer to\nthe `$title` parameter (the default title would apply) or the `$args` parameter.\n\n_@param_ `string|WP_Error $message`  \nOptional. Error message. If this is a WP_Error object,\nand not an Ajax or XML-RPC request, the error's messages are used.\nDefault empty string.\n\n_@param_ `string|int $title`  \nOptional. Error title. If `$message` is a `WP_Error` object,\nerror data with the key 'title' may be used to specify the title.\nIf `$title` is an integer, then it is treated as the response code.\nDefault empty string.\n\n_@param_ `string|array|int $args`  \n{\nOptional. Arguments to control behavior. If `$args` is an integer, then it is treated\nas the response code. Default empty array.\n\n_@return_ `void`\n\n_@global_ `WP_Query $wp_query` — WordPress Query object.\n\n_@since_ 2.0.4\n\n_@since_ 4.1.0  \nThe `$title` and `$args` parameters were changed to optionally accept\nan integer to be used as the response code.\n\n_@since_ 5.1.0 — The `$link_url`, `$link_text`, and `$exit` arguments were added.\n\n_@since_ 5.3.0 — The `$charset` argument was added.\n\n_@since_ 5.5.0  \nThe `$text_direction` argument has a priority over get_language_attributes()\nin the default handler.\n\n_@type_  \nint    $response       The HTTP response code. Default 200 for Ajax requests, 500 otherwise.\n\n_@type_  \nstring $link_url       A URL to include a link to. Only works in combination with $link_text.\nDefault empty string.\n\n_@type_  \nstring $link_text      A label for the link to include. Only works in combination with $link_url.\nDefault empty string.\n\n_@type_ — bool   $back_link      Whether to include a link to go back. Default false.\n\n_@type_  \nstring $text_direction The text direction. This is only useful internally, when WordPress is still\nloading and the site's locale is not set up yet. Accepts 'rtl' and 'ltr'.\nDefault is the value of is_rtl().\n\n_@type_ — string $charset        Character set of the HTML output. Default 'utf-8'.\n\n_@type_  \nstring $code           Error code to use. Default is 'wp_die', or the main error code if $message\nis a WP_Error.\n\n_@type_  \nbool   $exit           Whether to exit the process after completion. Default true.\n}"
  },
  filterText = "wp_die",
  insertTextFormat = 2,
  kind = 3,
  label = "wp_die",
  score = 30,
  score_offset = 0,
  sortText = "04992",
  source_id = "lsp",
  source_name = "LSP",
  textEdit = {
    newText = "wp_die($0)",
    range = {
      ["end"] = {
        character = 10,
        line = 85
      },
      start = {
        character = 7,
        line = 85
      }
    }
  }
}
{
  client_id = 2,
  command = {
    command = "editor.action.triggerParameterHints",
    title = "Trigger Parameter Hints"
  },
  cursor_column = 9,
  data = "8462285869681881",
  detail = "wp([$query_vars])",
  documentation = {
    kind = "markdown",
    value = "__wp__\n\nSets up the WordPress query.\n\n```php\n<?php\nfunction wp($query_vars = '') { }\n```\n\n_@param_ `string|array $query_vars` — Default WP_Query arguments.\n\n_@return_ `void`\n\n_@global_ `WP $wp` — Current WordPress environment instance.\n\n_@global_ `WP_Query $wp_query` — WordPress Query object.\n\n_@global_ `WP_Query $wp_the_query` — Copy of the WordPress Query object.\n\n_@since_ 2.0.0"
  },
  filterText = "wp",
  insertTextFormat = 2,
  kind = 3,
  label = "wp",
  score = 26,
  score_offset = 0,
  sortText = "00002",
  source_id = "lsp",
  source_name = "LSP",
  textEdit = {
    newText = "wp($0)",
    range = {
      ["end"] = {
        character = 9,
        line = 85
      },
      start = {
        character = 7,
        line = 85
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Module which displays UI
Projects
None yet
Development

No branches or pull requests

2 participants