Code Monkey home page Code Monkey logo

Comments (7)

scottming avatar scottming commented on July 30, 2024 3

@hrsh7th thanks for your reminder, after I change the result of the single-character response, it works. I'll send a PR for lexical.

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on July 30, 2024 1

Thank you detailed response.

Hmm. . . Let's track how VSCode handles null return values for textDocument/completion.

Also, I think the server should return isIncomplete=true instead of just returning null. What are your thoughts on this?

from cmp-nvim-lsp.

Shougo avatar Shougo commented on July 30, 2024

Can you upload the example LSP?

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on July 30, 2024

If that's true, I think it could be a bug in the LSP server.
Which language server are you having problems with?

from cmp-nvim-lsp.

scottming avatar scottming commented on July 30, 2024

If that's true, I think it could be a bug in the LSP server.
Which language server are you having problems with?

I'm using Lexical, I'm the committer too. We intentionally don't allow one character completion: https://github.com/lexical-lsp/lexical/blob/main/apps/server/lib/lexical/server/code_intelligence/completion.ex#L69

I don't think it's a server-side bug because VScode and Emacs work fine.

from cmp-nvim-lsp.

scottming avatar scottming commented on July 30, 2024

This is the code, when I type S(send completion request), and t(only send didChange request)

image

and this is the log

[DEBUG][2023-04-25 18:23:40] .../vim/lsp/rpc.lua:284	"rpc.send"	{
  id = 2,
  jsonrpc = "2.0",
  method = "textDocument/completion",
  params = {
    context = {
      triggerKind = 1
    },
    position = {
      character = 5,
      line = 3
    },
    textDocument = {
      uri = "file:///Users/scottming/Code/dummy/lib/dummy.ex"
    }
  }
}
[DEBUG][2023-04-25 18:23:40] .../vim/lsp/rpc.lua:387	"rpc.receive"	{
  id = 2,
  jsonrpc = "2.0",
  result = {}
}
[DEBUG][2023-04-25 18:23:40] .../vim/lsp/rpc.lua:387	"rpc.receive"	{
  jsonrpc = "2.0",
  method = "textDocument/publishDiagnostics",
  params = {
    diagnostics = {},
    uri = "file:///Users/scottming/Code/dummy/lib/dummy.ex"
  }
}
[DEBUG][2023-04-25 18:23:41] .../vim/lsp/rpc.lua:284	"rpc.send"	{
  jsonrpc = "2.0",
  method = "textDocument/didChange",
  params = {
    contentChanges = { {
        range = {
          ["end"] = {
            character = 5,
            line = 3
          },
          start = {
            character = 5,
            line = 3
          }
        },
        rangeLength = 0,
        text = "t"
      } },
    textDocument = {
      uri = "file:///Users/scottming/Code/dummy/lib/dummy.ex",
      version = 12
    }
  }
}
[DEBUG][2023-04-25 18:23:41] .../vim/lsp/rpc.lua:387	"rpc.receive"	{
  jsonrpc = "2.0",
  method = "textDocument/publishDiagnostics",
  params = {
    diagnostics = {},
    uri = "file:///Users/scottming/Code/dummy/lib/dummy.ex"
  }
}

Above is the behavior of neovim, and below is VScode

image

from cmp-nvim-lsp.

scottming avatar scottming commented on July 30, 2024

Also, I think the server should return isIncomplete=true instead of just returning null. What are your thoughts on this?

I think what you said makes sense.

for speed clients should be able to filter an already received completion list if the user continues typing. Servers can opt out of this using a CompletionList and mark it as isIncomplete.
Let me try to return a struct like

{isIncomplete: true, items: []}

from cmp-nvim-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.