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

Error with symbol containing newlines #73

Closed
ten3roberts opened this issue Mar 30, 2022 · 1 comment
Closed

Error with symbol containing newlines #73

ten3roberts opened this issue Mar 30, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ten3roberts
Copy link
Contributor

Describe the bug
API error for nvim_buf_set_lines when a symbol/line contains newlines.

This happens for some language servers which return multiline symbols or empty symbols.

System information

  • OS: linux
  • Neovim version:NVIM v0.7.0-dev+1356-g75ff156d9 (issue has persisted in earlier versions)
  • AerialInfo:
Aerial Info
-----------
Filetype: svelte
Configured backends:
  lsp (supported) (attached)
  treesitter (not supported) [No query file for 'svelte']
  markdown (not supported) [Filetype is not markdown]
Show symbols: Class, Constructor, Enum, Function, Interface, Module, Method, Struct

  • Aerial config:
-- Call the setup function to change the default behavior
require("aerial").setup({
  backends = { "lsp", "treesitter", "markdown" },

  close_behavior = "global",

  default_bindings = true,
  default_direction = "prefer_left",

  disable_max_lines = 10000,

  highlight_mode = "split_width",

  -- When jumping to a symbol, highlight the line for this many ms.
  -- Set to false to disable
  highlight_on_jump = 300,

  icons = {
    Function = ""
  },

  -- When you fold code with za, zo, or zc, update the aerial tree as well.
  -- Only works when manage_folds = true
  link_folds_to_tree = false,

  -- Fold code when you open/collapse symbols in the tree.
  -- Only works when manage_folds = true
  link_tree_to_folds = true,

  -- Use symbol tree for folding. Set to true or false to enable/disable
  -- 'auto' will manage folds if your previous foldmethod was 'manual'
  manage_folds = false,

  -- The maximum width of the aerial window
  max_width = 40,

  -- The minimum width of the aerial window.
  -- To disable dynamic resizing, set this to be equal to max_width
  min_width = 10,

  -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/)
  -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed.
  nerd_font = "auto",

  -- Call this function when aerial attaches to a buffer.
  -- Useful for setting keymaps. Takes a single `bufnr` argument.
  on_attach = nil,

  -- Automatically open aerial when entering supported buffers.
  -- This can be a function (see :help aerial-open-automatic)
  open_automatic = true,

  -- Set to true to only open aerial at the far right/left of the editor
  -- Default behavior opens aerial relative to current window
  placement_editor_edge = true,

  -- Run this command after jumping to a symbol (false will disable)
  post_jump_cmd = "normal! zz",

  -- When true, aerial will automatically close after jumping to a symbol
  close_on_select = false,

  -- Show box drawing characters for the tree hierarchy
  -- show_guides = false,

  lsp = {
    -- Fetch document symbols when LSP diagnostics change.
    -- If you set this to false, you will need to manually fetch symbols
    diagnostics_trigger_update = true,

    -- Set to false to not update the symbols when there are LSP errors
    update_when_errors = true,
  },

  treesitter = {
    -- How long to wait (in ms) after a buffer change before updating
    update_delay = 300,
  },

  markdown = {
    -- How long to wait (in ms) after a buffer change before updating
    update_delay = 300,
  },

})

To Reproduce
Steps to reproduce the behavior:

  1. Open aerial
  2. Edit a svelte file with the svelte language server
  3. Use an await block
    The issue also occurs in lua files when creating a new function and the symbol is empty, though it is not reliably reproduced. The underlying issue is symbol sanitation
{#await { foo }}
  <h1>Loading</h1>
{/await}

Screenshots
Screenshot from 2022-03-30 10-41-29

The following is the value which is supplied to nvim_buf_set_lines in render.lua:155 (using vim.inspect)
image

@ten3roberts ten3roberts added the bug Something isn't working label Mar 30, 2022
@stevearc
Copy link
Owner

Should be fixed. Thanks for the report!

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

No branches or pull requests

2 participants