Skip to content
Commit 6dd88e34 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

lsp: enable snippet support

This change announces to the servers that we support snippets, even though
in reality we don't. However, we can still work with snippet-y text by
removing the snippet markers and using that with our own snippet handler
which is not quite ready to accept lsp style snippets.

The benefit of this change is that we don't have to put in hacks to add
"()" parens to stuff. We also don't have to move our cursor manually which
can be incorrect in many cases e.g., string.isEmpty(), with cursor in
between the parens doesn't make sense.

For cpp/clangd the existing logic was okay-ish. However some servers like
dart-analyzer do something different. If you dont have snippets, the
server will just remove the snippet markers from the text and send it to
you. This results in sometimes very annoying editing experience. For e.g.,

- maxLines: ,| // cursor position at the end is annoying
- initState() {
  // some comment
  }() // () what are parens doing here??

Thus its better to just remove those markers ourselves and then we can
just set the cursor position as we want and don't have to manually
decide anything.
parent cbee1809
Pipeline #267329 passed with stage
in 14 minutes and 16 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment