LuaLS / LuaLS/lua-language-server

inconsistent text edits from completion

Open
#2,688 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

### How are you using the lua-language-server?

NeoVim

### Which OS are you using?

MacOS

### What is the issue affecting?

Completion

### Expected Behaviour

I'm writing a completion engine for neovim which uses lsp to get completions among other things
I'm in the root directory of my plugin "neocomplete"
now I get completions for `require"neo|`, want to be able to select "neocomplete" and correctly get this completed to `require"neocomplete`

### Actual Behaviour

`require"neo|` -> selecting "neocomplete" -> `require"neocompleteo`
`require"neo|"` -> selecting "neocomplete" -> `require"neocomplete"`
I checked out the completion items returned by the server and it seems it provides a different `end` range for the text edit in these cases even though in both cases it should simply replace `neo` with `neocomplete`

### Reproduction steps

See above

### Additional Notes

Tell me if I can give you any additional information from the completion results

### Log File

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two completion cases in NeoVim using the `require"neo|` and `require"neo|"` examples, then inspect the completion items and their LSP text-edit ranges. The fix is complete when selecting `neocomplete` replaces `neo` correctly in both forms without leaving an extra character.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.