Skip to content

Conversation

@Rogach
Copy link
Contributor

@Rogach Rogach commented Dec 5, 2024

I'm using Emacs and lsp-mode, and absense of "do" from completions really hurts - closest match in completions is "defoverridable", so every time I want to type "do" I have to type "do", cancel the completions dialog and only then press return.

This PR adds check for snippets_supported and returns a simple non-snippet response if necessary.

if Keyword.get(options, :snippets_supported, false) do
"do\n $0\nend"
else
"do"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to return "do\n " here, but I'm not sure - for my use-case (Emacs and lsp-mode) pressing return after plain do automatically inserts matching end, so if elixir-ls returns plain do then I can just press return twice to get the desired result (otherwise I will have to type end manually).

@lukaszsamson
Copy link
Collaborator

Doesn’t other reserved keywords need similar changes?

@Rogach
Copy link
Contributor Author

Rogach commented Dec 5, 2024

Possibly, but it's my first contribution and I wanted to take it slow.

Currently, for me typing some other reserved keywords (else, cond, case) results in an exception somewhere deep inside elixir-ls, so I planned to tackle it in a separate issue.

@Rogach
Copy link
Contributor Author

Rogach commented Dec 5, 2024

I see lots of CI tests failing. Looked at the logs and it seems to me that errors are not caused by my changes - am I correct?

@lukaszsamson
Copy link
Collaborator

Thanks

@lukaszsamson lukaszsamson merged commit b126569 into elixir-lsp:master Dec 5, 2024
5 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants