Skip to content

Usage from nvim-cmp missing and naive approach with using name = 'ctags' does not work. #3

@matu3ba

Description

@matu3ba

I would have expected that

local cmp = require 'cmp'
cmp.setup {
  mapping = cmp.mapping.preset.insert {
    ['<C-b>'] = cmp.mapping.scroll_docs(-4),
    ['<C-f>'] = cmp.mapping.scroll_docs(4),
    ['<C-Space>'] = cmp.mapping.complete(),
    ['<C-e>'] = cmp.mapping.abort(),
    ['<CR>'] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
  },
  sources = cmp.config.sources({
    { name = 'buffer' },
    { name = 'ctags' },
    { name = 'nvim_lsp' },
    -- { name = 'vsnip' }, -- For vsnip users.
    -- { name = 'luasnip' }, -- For luasnip users.
    -- { name = 'ultisnips' }, -- For ultisnips users.
    -- { name = 'snippy' }, -- For snippy users.
  }),
}

would do the job for me, but completions are not showing up.
For example, I checked that C-] jumps to the correct enum, but the field values are not completed.

For additional context, I use the following script to generate the tags (with universal ctags)

#!/bin/sh
set -e
PATH="/usr/local/bin:$PATH"
PID=$$
#if [ -z ${var+x} ]; then echo "'$1' is unset, need paths to create ctags for"; exit; fi

if test "$#" -lt 1; then
  echo "Usage: $0 FILE1 [.. FILEN], need paths to create ctags for" >&2
  exit 1
fi

trap 'rm -f "${PID}tags"' EXIT
ctags --recurse=yes --kinds-c++=+p -f "${PID}tags" --extras=+fq --sort=foldcase \
  --c++-kinds=+p --fields=+iaS --extras=+q "$@"
mv "${PID}tags" "tags"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions