Skip to content

json: omni completion (schema values) doesn't work #797

@kmARC

Description

@kmARC

The following should work in a package.json file where | is the cursor, and triggering omni completion <i_Ctrl-X_Ctrl-O> would propose "author":

{
    "au|
}

Instead, "Pattern not found".

how to reproduce

Minimal vimrc:

set nocompatible

call plug#begin('~/.vim-debug/plugged')
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
call plug#end()

function! s:on_lsp_buffer_enabled() abort
  setlocal omnifunc=lsp#complete
endfunction

augroup lsp_install
  au!
  autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END

Example:

vim -u ~/.vim-debug/vimrc package.json
:LspStatus
vscode-json-language-server: running

I also tried with explicit schema, same problem:

{
    "$schema": "https://json.schemastore.org/package.json",
    "au|
}

remarks

  • Other languages (tried python) work perfectly with the same minimal vimrc.
  • :LspSettingsLocalEdit and :LspSettingsGlobalEdit are both empty.
  • vim-lsp-settings version: 4f8471d (Mon Jan 13 16:01:08 2025)
  • vim-lsp version: 04428c9 (Mon Sep 23 01:16:10 2024)
  • vim version:
    VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Mar 02 2025 21:28:22)
    Included patches: 1-1165
    Compiled by Arch Linux
    

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