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

Lsp-mode doesn't filter input text #3408

Open
2 of 3 tasks
victorpigmeo opened this issue Mar 16, 2022 · 5 comments
Open
2 of 3 tasks

Lsp-mode doesn't filter input text #3408

victorpigmeo opened this issue Mar 16, 2022 · 5 comments
Labels

Comments

@victorpigmeo
Copy link

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

I'm using lsp-dart and I'm experiencing a glitch that I described on this issue.
When I type a { anywhere in my code, specially when is a function start the snippets menu open to fast, so when I tap Enter to break the line, it applies the snippet selected on the context menu opened. According to the other issue this occurs because lsp-mode doesn't filter the input text.

Steps to reproduce

  • install dart-lsp
  • open a .dart file
  • type something like void test(){<enter>}

Expected behavior

The expected behavior is that the menu doesn't open on some places, like the example above.

Which Language Server did you use?

lsp-dart

OS

Linux

Error callstack

No response

Anything else?

maybe @ericdallo can provide more information about this on lsp-dart side

@ericdallo
Copy link
Member

It may help providing the communication between server and client, you can achieve that following https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/#log-client-server-json

@victorpigmeo
Copy link
Author

[Trace - 09:27:13 PM] Sending request 'textDocument/completion - (1550)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 33
  },
  "context": {
    "triggerCharacter": "{",
    "triggerKind": 2
  }
}


[Trace - 09:27:13 PM] Sending request 'textDocument/codeAction - (1551)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "range": {
    "start": {
      "line": 141,
      "character": 33
    },
    "end": {
      "line": 141,
      "character": 33
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 09:27:13 PM] Sending request 'textDocument/documentHighlight - (1552)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 33
  }
}


[Trace - 09:27:13 PM] Sending request 'textDocument/hover - (1553)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 33
  }
}


[Trace - 09:27:13 PM] Received notification '$/progress'.
Params: {
  "value": {
    "title": "Analyzing…",
    "kind": "begin"
  },
  "token": "ANALYZING"
}


[Trace - 09:27:13 PM] Received notification '$/progress'.
Params: {
  "value": {
    "kind": "end"
  },
  "token": "ANALYZING"
}


[Trace - 09:27:13 PM] Received response 'textDocument/completion - (1550)' in 30ms.
Result: []


[Trace - 09:27:13 PM] Sending request 'textDocument/completion - (1554)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 33
  },
  "context": {
    "triggerCharacter": "{",
    "triggerKind": 2
  }
}


[Trace - 09:27:13 PM] Received response 'textDocument/completion - (1554)' in 13ms.
Result: []


[Trace - 09:27:13 PM] Sending request 'textDocument/completion - (1555)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 33
  },
  "context": {
    "triggerCharacter": "{",
    "triggerKind": 2
  }
}


[Trace - 09:27:13 PM] Received response 'textDocument/completion - (1555)' in 21ms.
Result: []


[Trace - 09:27:13 PM] Sending request 'textDocument/completion - (1556)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 33
  },
  "context": {
    "triggerCharacter": "{",
    "triggerKind": 2
  }
}


[Trace - 09:27:13 PM] Received response 'textDocument/completion - (1556)' in 21ms.
Result: []


[Trace - 09:27:15 PM] Sending notification '$/cancelRequest'.
Params: {
  "id": 1553
}


[Trace - 09:27:15 PM] Sending request 'textDocument/hover - (1557)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 32
  }
}


[Trace - 09:27:15 PM] Sending notification '$/cancelRequest'.
Params: {
  "id": 1551
}


[Trace - 09:27:15 PM] Sending request 'textDocument/codeAction - (1558)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "range": {
    "start": {
      "line": 141,
      "character": 32
    },
    "end": {
      "line": 141,
      "character": 32
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 09:27:15 PM] Sending notification '$/cancelRequest'.
Params: {
  "id": 1552
}


[Trace - 09:27:15 PM] Sending request 'textDocument/documentHighlight - (1559)'.
Params: {
  "textDocument": {
    "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
  },
  "position": {
    "line": 141,
    "character": 32
  }
}


[Trace - 09:27:15 PM] Received response 'textDocument/hover - (1557)' in 32ms.
Result: null


[Trace - 09:27:15 PM] Received response 'textDocument/codeAction - (1558)' in 27ms.
Result: [
  {
    "command": {
      "arguments": [
        "/home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
      ],
      "command": "edit.sortMembers",
      "title": "Sort Members"
    },
    "kind": "source.sortMembers",
    "title": "Sort Members"
  },
  {
    "command": {
      "arguments": [
        "/home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
      ],
      "command": "edit.organizeImports",
      "title": "Organize Imports"
    },
    "kind": "source.organizeImports",
    "title": "Organize Imports"
  },
  {
    "command": {
      "arguments": [
        "/home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart"
      ],
      "command": "edit.fixAll",
      "title": "Fix All"
    },
    "kind": "source.fixAll",
    "title": "Fix All"
  },
  {
    "edit": {
      "documentChanges": [
        {
          "edits": [
            {
              "newText": "async ",
              "range": {
                "end": {
                  "character": 32,
                  "line": 141
                },
                "start": {
                  "character": 32,
                  "line": 141
                }
              }
            }
          ],
          "textDocument": {
            "uri": "file:///home/victor/dev/belvedere/lib/comanda/screens/comanda_screen.dart",
            "version": 1335
          }
        }
      ]
    },
    "diagnostics": [],
    "kind": "refactor.convert.bodyToAsync",
    "title": "Convert to async function body"
  }
]


[Trace - 09:27:15 PM] Received response 'textDocument/documentHighlight - (1559)' in 40ms.
Result: null

is this the right log?

@ericdallo
Copy link
Member

It seems server is returning empty results for { which seems correct, @yyoncho any thoughts?
Maybe completion cache?

@ericdallo
Copy link
Member

I can confirm that if typing c and quickly calling company to complete it's inserted the comment snippet wrongly, any thoughts @yyoncho ?

@yyoncho
Copy link
Member

yyoncho commented Oct 31, 2022

seems like a cache bug... It has to be investigated.

cc @kiennq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants