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

Pyright LSP completion lowercase to uppercase leaves first few characters #5469

Closed
Taywee opened this issue Jan 9, 2023 · 10 comments · Fixed by #5728
Closed

Pyright LSP completion lowercase to uppercase leaves first few characters #5469

Taywee opened this issue Jan 9, 2023 · 10 comments · Fixed by #5728
Labels
C-bug Category: This is a bug

Comments

@Taywee
Copy link
Contributor

Taywee commented Jan 9, 2023

Summary

When I use Pyright completion that changes case from lowercase to uppercase, the first two characters remain instead of being replaced.

The same does not happen using the same language server in neovim, so I don't think it's an issue with the language server itself.

Reproduction Steps

Using this languages.toml entry for Pyright:

[[language]]
name = "python"

[language.language-server]
command = "pyright-langserver"
args = ["--stdio"]

[language.config.python.analysis]
autoSearchPaths = true
diagnosticMode = "workspace"
useLibraryCodeForTypes = true

If I create a simple python project with a virtualenvironment and activate the language server:

$ cd $(mktemp -d)
$ touch pyproject.toml
$ mkdir src
$ python -mvenv ./venv
$ . ./venv/bin/activate
$ pip install --force pyright
$ hx src/example.py

Then add a simple uppercase Uppercase class, and start typing uppercase and complete it to the class, I end up with this:

class Uppercase:
    pass

upUppercase

If I type it in the right casing to begin with, it has no problem and does not duplicate the first two letters.

Helix log

2023-01-09T10:07:44.240 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":0,"line":2},"start":{"character":0,"line":2}},"text":"\n"}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":23}}}
2023-01-09T10:07:44.501 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":23,"diagnostics":[]}}
2023-01-09T10:07:44.800 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":0,"line":3},"start":{"character":0,"line":3}},"text":"u"}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":24}}}
2023-01-09T10:07:44.984 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":1,"line":3},"start":{"character":1,"line":3}},"text":"p"}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":25}}}
2023-01-09T10:07:44.991 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":2,"line":3},"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py"}},"id":12}
2023-01-09T10:07:44.994 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":12,"result":{"items":[{"label":"Uppercase","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"Uppercase"},"sortText":"09.9999.Uppercase"},{"label":"super","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"super"},"sortText":"09.9999.super"},{"label":"tuple","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"tuple"},"sortText":"09.9999.tuple"},{"label":"KeyboardInterrupt","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"KeyboardInterrupt"},"sortText":"09.9999.KeyboardInterrupt"},{"label":"LookupError","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"LookupError"},"sortText":"09.9999.LookupError"},{"label":"InterruptedError","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"InterruptedError"},"sortText":"09.9999.InterruptedError"},{"label":"ProcessLookupError","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"ProcessLookupError"},"sortText":"09.9999.ProcessLookupError"},{"label":"BaseExceptionGroup","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"BaseExceptionGroup"},"sortText":"09.9999.BaseExceptionGroup"},{"label":"ExceptionGroup","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"ExceptionGroup"},"sortText":"09.9999.ExceptionGroup"},{"label":"UnionType","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"autoImportText":"from types import UnionType","symbolLabel":"UnionType"},"sortText":"12.9999.UnionType","detail":"Auto-import","labelDetails":{"description":"types"},"documentation":{"kind":"plaintext","value":"from types import UnionType"},"textEdit":{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":2}},"newText":"UnionType"}},{"label":"Unpack","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"autoImportText":"from typing import Unpack","symbolLabel":"Unpack"},"sortText":"12.9999.Unpack","detail":"Auto-import","labelDetails":{"description":"typing"},"documentation":{"kind":"plaintext","value":"from typing import Unpack"},"textEdit":{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":2}},"newText":"Unpack"}},{"label":"Unpack","kind":7,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"autoImportText":"from typing_extensions import Unpack","symbolLabel":"Unpack"},"sortText":"12.9999.Unpack","detail":"Auto-import","labelDetails":{"description":"typing_extensions"},"documentation":{"kind":"plaintext","value":"from typing_extensions import Unpack"},"textEdit":{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":2}},"newText":"Unpack"}},{"label":"update_abstractmethods","kind":3,"data":{"workspacePath":"/tmp/tmp.ZmHxbsplID","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"autoImportText":"from abc import update_abstractmethods","symbolLabel":"update_abstractmethods"},"sortText":"12.9999.update_abstractmethods","detail":"Auto-import","labelDetails":{"description":"abc"},"documentation":{"kind":"plaintext","value":"from abc import update_abstractmethods"},"textEdit":{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":2}},"newText":"update_abstractmethods"}}],"isIncomplete":true}}
2023-01-09T10:07:44.994 helix_lsp::transport [INFO] <- {"isIncomplete":true,"items":[{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"Uppercase","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"Uppercase","sortText":"09.9999.Uppercase"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"super","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"super","sortText":"09.9999.super"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"tuple","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"tuple","sortText":"09.9999.tuple"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"KeyboardInterrupt","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"KeyboardInterrupt","sortText":"09.9999.KeyboardInterrupt"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"LookupError","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"LookupError","sortText":"09.9999.LookupError"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"InterruptedError","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"InterruptedError","sortText":"09.9999.InterruptedError"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"ProcessLookupError","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"ProcessLookupError","sortText":"09.9999.ProcessLookupError"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"BaseExceptionGroup","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"BaseExceptionGroup","sortText":"09.9999.BaseExceptionGroup"},{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"ExceptionGroup","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"ExceptionGroup","sortText":"09.9999.ExceptionGroup"},{"data":{"autoImportText":"from types import UnionType","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"UnionType","workspacePath":"/tmp/tmp.ZmHxbsplID"},"detail":"Auto-import","documentation":{"kind":"plaintext","value":"from types import UnionType"},"kind":7,"label":"UnionType","labelDetails":{"description":"types"},"sortText":"12.9999.UnionType","textEdit":{"newText":"UnionType","range":{"end":{"character":2,"line":3},"start":{"character":0,"line":3}}}},{"data":{"autoImportText":"from typing import Unpack","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"Unpack","workspacePath":"/tmp/tmp.ZmHxbsplID"},"detail":"Auto-import","documentation":{"kind":"plaintext","value":"from typing import Unpack"},"kind":7,"label":"Unpack","labelDetails":{"description":"typing"},"sortText":"12.9999.Unpack","textEdit":{"newText":"Unpack","range":{"end":{"character":2,"line":3},"start":{"character":0,"line":3}}}},{"data":{"autoImportText":"from typing_extensions import Unpack","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"Unpack","workspacePath":"/tmp/tmp.ZmHxbsplID"},"detail":"Auto-import","documentation":{"kind":"plaintext","value":"from typing_extensions import Unpack"},"kind":7,"label":"Unpack","labelDetails":{"description":"typing_extensions"},"sortText":"12.9999.Unpack","textEdit":{"newText":"Unpack","range":{"end":{"character":2,"line":3},"start":{"character":0,"line":3}}}},{"data":{"autoImportText":"from abc import update_abstractmethods","filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"update_abstractmethods","workspacePath":"/tmp/tmp.ZmHxbsplID"},"detail":"Auto-import","documentation":{"kind":"plaintext","value":"from abc import update_abstractmethods"},"kind":3,"label":"update_abstractmethods","labelDetails":{"description":"abc"},"sortText":"12.9999.update_abstractmethods","textEdit":{"newText":"update_abstractmethods","range":{"end":{"character":2,"line":3},"start":{"character":0,"line":3}}}}]}
2023-01-09T10:07:45.136 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":2,"line":3},"start":{"character":2,"line":3}},"text":"p"}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":26}}}
2023-01-09T10:07:45.352 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":3,"line":3},"start":{"character":3,"line":3}},"text":"e"}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":27}}}
2023-01-09T10:07:45.472 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":4,"line":3},"start":{"character":4,"line":3}},"text":"r"}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":28}}}
2023-01-09T10:07:45.730 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":28,"diagnostics":[{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":5}},"message":"\"upper\" is not defined","severity":1,"code":"reportUndefinedVariable","source":"Pyright","codeDescription":{"href":"https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUndefinedVariable"}},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":5}},"message":"Expression value is unused","severity":2,"code":"reportUnusedExpression","source":"Pyright","codeDescription":{"href":"https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUnusedExpression"}}]}}
2023-01-09T10:07:45.992 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":5,"line":3},"start":{"character":2,"line":3}},"text":""}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":29}}}
2023-01-09T10:07:45.992 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":2,"line":3},"start":{"character":2,"line":3}},"text":"Uppercase"}],"textDocument":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":30}}}
2023-01-09T10:07:45.999 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"completionItem/resolve","params":{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"Uppercase","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"Uppercase","sortText":"09.9999.Uppercase"},"id":13}
2023-01-09T10:07:46.002 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":13,"result":{"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"Uppercase","workspacePath":"/tmp/tmp.ZmHxbsplID"},"kind":7,"label":"Uppercase","sortText":"09.9999.Uppercase","documentation":{"kind":"plaintext","value":"class Uppercase()"}}}
2023-01-09T10:07:46.002 helix_lsp::transport [INFO] <- {"data":{"filePath":"/tmp/tmp.ZmHxbsplID/src/example.py","position":{"character":2,"line":3},"symbolLabel":"Uppercase","workspacePath":"/tmp/tmp.ZmHxbsplID"},"documentation":{"kind":"plaintext","value":"class Uppercase()"},"kind":7,"label":"Uppercase","sortText":"09.9999.Uppercase"}
2023-01-09T10:07:46.250 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/tmp.ZmHxbsplID/src/example.py","version":30,"diagnostics":[{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":11}},"message":"\"upUppercase\" is not defined","severity":1,"code":"reportUndefinedVariable","source":"Pyright","codeDescription":{"href":"https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUndefinedVariable"}},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":11}},"message":"Expression value is unused","severity":2,"code":"reportUnusedExpression","source":"Pyright","codeDescription":{"href":"https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUnusedExpression"}}]}}

Platform

Fedora Linux 37

Terminal Emulator

gnome-terminal

Helix Version

helix 22.12

@Taywee Taywee added the C-bug Category: This is a bug label Jan 9, 2023
@Taywee
Copy link
Contributor Author

Taywee commented Jan 9, 2023

It looks like this might be a language server issue, actually. Looks like the completionItem/resolve response doesn't properly give a textEdit. The request and two communications from the language server look like this, when formatted:

-> {
  "jsonrpc": "2.0",
  "method": "completionItem/resolve",
  "params": {
    "data": {
      "filePath": "/tmp/tmp.ZmHxbsplID/src/example.py",
      "position": {
        "character": 2,
        "line": 3
      },
      "symbolLabel": "Uppercase",
      "workspacePath": "/tmp/tmp.ZmHxbsplID"
    },
    "kind": 7,
    "label": "Uppercase",
    "sortText": "09.9999.Uppercase"
  },
  "id": 13
}
<- {
  "jsonrpc": "2.0",
  "id": 13,
  "result": {
    "data": {
      "filePath": "/tmp/tmp.ZmHxbsplID/src/example.py",
      "position": {
        "character": 2,
        "line": 3
      },
      "symbolLabel": "Uppercase",
      "workspacePath": "/tmp/tmp.ZmHxbsplID"
    },
    "kind": 7,
    "label": "Uppercase",
    "sortText": "09.9999.Uppercase",
    "documentation": {
      "kind": "plaintext",
      "value": "class Uppercase()"
    }
  }
}
<- {
  "data": {
    "filePath": "/tmp/tmp.ZmHxbsplID/src/example.py",
    "position": {
      "character": 2,
      "line": 3
    },
    "symbolLabel": "Uppercase",
    "workspacePath": "/tmp/tmp.ZmHxbsplID"
  },
  "documentation": {
    "kind": "plaintext",
    "value": "class Uppercase()"
  },
  "kind": 7,
  "label": "Uppercase",
  "sortText": "09.9999.Uppercase"
}

But the equivalent from rust-analyzer, for instance, look like this:

-> {
  "jsonrpc": "2.0",
  "method": "textDocument/didChange",
  "params": {
    "contentChanges": [
      {
        "range": {
          "end": {
            "character": 6,
            "line": 4
          },
          "start": {
            "character": 4,
            "line": 4
          }
        },
        "text": "Uppercase"
      }
    ],
    "textDocument": {
      "uri": "file:///tmp/tmp.a2fOsJD8aq/src/main.rs",
      "version": 27
    }
  }
}
-> {
  "jsonrpc": "2.0",
  "method": "completionItem/resolve",
  "params": {
    "additionalTextEdits": [],
    "deprecated": false,
    "filterText": "Uppercase",
    "kind": 22,
    "label": "Uppercase",
    "preselect": true,
    "sortText": "ffffffef",
    "textEdit": {
      "insert": {
        "end": {
          "character": 6,
          "line": 4
        },
        "start": {
          "character": 4,
          "line": 4
        }
      },
      "newText": "Uppercase",
      "replace": {
        "end": {
          "character": 6,
          "line": 4
        },
        "start": {
          "character": 4,
          "line": 4
        }
      }
    }
  },
  "id": 20
}
<- {
  "jsonrpc": "2.0",
  "id": 20,
  "result": {
    "label": "Uppercase",
    "kind": 22,
    "deprecated": false,
    "preselect": true,
    "sortText": "ffffffef",
    "filterText": "Uppercase",
    "textEdit": {
      "newText": "Uppercase",
      "insert": {
        "start": {
          "line": 4,
          "character": 4
        },
        "end": {
          "line": 4,
          "character": 6
        }
      },
      "replace": {
        "start": {
          "line": 4,
          "character": 4
        },
        "end": {
          "line": 4,
          "character": 6
        }
      }
    },
    "additionalTextEdits": []
  }
}
<- {
  "additionalTextEdits": [],
  "deprecated": false,
  "filterText": "Uppercase",
  "kind": 22,
  "label": "Uppercase",
  "preselect": true,
  "sortText": "ffffffef",
  "textEdit": {
    "insert": {
      "end": {
        "character": 6,
        "line": 4
      },
      "start": {
        "character": 4,
        "line": 4
      }
    },
    "newText": "Uppercase",
    "replace": {
      "end": {
        "character": 6,
        "line": 4
      },
      "start": {
        "character": 4,
        "line": 4
      }
    }
  }
}

Neovim (and presumably Visual Studio Code) must be papering over the difference.

@Taywee
Copy link
Contributor Author

Taywee commented Jan 9, 2023

rust-analyzer seems to give its completions as TextEdits, properly replacing the prompt text, while Pyright just gives them as raw suggestions and lets the editor decide how to format it. I'm not certain, because I don't know much at all about LSP implementation.

@the-mikedavis
Copy link
Member

Duplicate of #4851

@the-mikedavis the-mikedavis marked this as a duplicate of #4851 Jan 10, 2023
@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
@the-mikedavis the-mikedavis added the R-duplicate Duplicated issue: please refer to the linked issue label Jan 10, 2023
@gabydd
Copy link
Member

gabydd commented Jan 10, 2023

I think this a bit different then the referenced issue, I tested with the proposed fix in #1819 (I rebased it onto master but either I did something wrong or there is something that needs to be fixed in the implementation because I found it made the editor quite slow) and it doesn't replace the up. I think it's illustrated well above that this is because the lsp doesn't send TextEdits and I guess we don't handle this specific case of lowercase to uppercase, not that the lsp is too slow which is what the other issue targets. Ideally I guess whatever fix we implement for completion should be all encompassing.

@Taywee
Copy link
Contributor Author

Taywee commented Jan 10, 2023

@the-mikedavis This isn't the same issue, because it's completely deterministic here and related only to capitalization.

@the-mikedavis the-mikedavis marked this as not a duplicate of #4851 Jan 10, 2023
@the-mikedavis the-mikedavis reopened this Jan 10, 2023
@the-mikedavis the-mikedavis removed the R-duplicate Duplicated issue: please refer to the linked issue label Jan 10, 2023
@Taywee
Copy link
Contributor Author

Taywee commented Jan 10, 2023

Looks likely to me like the relevant bit is in helix-term/src/ui/completion.rs line 136, where trim_start_matches is not case-insensitive. Adding a case insensitive version and using that would probably be an appropriate fix.

@Taywee
Copy link
Contributor Author

Taywee commented Jan 10, 2023

Ah, it wouldn't just be a case-insensitive version, but having to replace the case-insensitive-matching prefix entirely, or figuring out otherwise how to entirely replace the entered text that prompted the completion. I'm not sure if that could just be calculated with the Completion's start_offset and trigger_offset or not.

Taywee pushed a commit to Taywee/helix that referenced this issue Jan 10, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
pascalkuthe pushed a commit to pascalkuthe/helix that referenced this issue Jan 30, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
pascalkuthe pushed a commit to pascalkuthe/helix that referenced this issue Jan 31, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
pascalkuthe pushed a commit to pascalkuthe/helix that referenced this issue Feb 16, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
pascalkuthe pushed a commit to pascalkuthe/helix that referenced this issue Mar 7, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
pascalkuthe pushed a commit to pascalkuthe/helix that referenced this issue Mar 7, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
pascalkuthe pushed a commit to pascalkuthe/helix that referenced this issue Mar 8, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
@archseer
Copy link
Member

archseer commented Mar 9, 2023

Should be fixed by #6173

@archseer archseer closed this as completed Mar 9, 2023
@gabydd
Copy link
Member

gabydd commented Mar 9, 2023

I think #5728 fixes this actually

@archseer
Copy link
Member

archseer commented Mar 9, 2023

Good point :)

@archseer archseer reopened this Mar 9, 2023
pascalkuthe pushed a commit to pascalkuthe/helix that referenced this issue Mar 9, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
archseer pushed a commit that referenced this issue Mar 10, 2023
Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
sagnibak pushed a commit to sagnibak/helix that referenced this issue Mar 21, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
wes-adams pushed a commit to wes-adams/helix that referenced this issue Jul 4, 2023
…5469)

Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
4 participants