Skip to content

Fix completion item text selection priority #1610

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

heavenshell
Copy link
Contributor

Hi,

I found vtslp and typescript-language-server complete invalid item.

Steps to reproduce

type Address = {
  state?: string
  town?: string
}

type Person = {
  name?: string
  age?: number
  address?: Address
}

const foo: Person = {
  name: 'foo',
  age: 20,                 
}

When I type like following

foo.address.<c-x><c-o>
            +--------------+
            | state? field |
            | town?  field |
            +--------------+

and select state?, text insert like following

foo.address.?.state

expected behavior is

foo.address?.state

According to the Language Server Protocol 3.17 specification:

  • filterText is only used for filtering and sorting completion items
  • When textEdit is provided, insertText must be ignored

In vim-lsp completion context, l:completion_item['filterText'] was set.
I think this is unnecessary.

I would appreciate it if someone could review this.

Before

Kapture.2025-08-10.17.11.10.mp4

After

Kapture.2025-08-10.17.38.26.mp4

According to the Language Server Protocol 3.17 specification:

- filterText is only used for filtering and sorting completion items
- When textEdit is provided, insertText must be ignored
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant