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

Add indentation following "do" completion #606

Merged
merged 2 commits into from
Nov 14, 2021
Merged

Add indentation following "do" completion #606

merged 2 commits into from
Nov 14, 2021

Conversation

aj-foster
Copy link
Contributor

Related to #593, and specifically the comment by @axelson here, this PR adds a single tab1 of indentation before the cursor after the do autocompletion.

I'm testing exclusively in VS Code, but the behavior of this change seems to be that the editor adds one relative level of indentation. So, for example, the autocompletion naturally forms the following structure (using exclusively the do completion):

defmodule Hello do
  def world do
    case something do
      # ...
    end
  end
end

It is always possible that other editors do not match this behavior. If that's the case, apologies for the confusion.


1 According to sources and my experience while testing, using \t will tell VS Code to insert one TAB-worth of whichever form indentation is currently active in the editor. In my case, it correctly added two spaces.

Copy link
Member

@axelson axelson left a comment

Choose a reason for hiding this comment

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

Thanks for this!

It is always possible that other editors do not match this behavior. If that's the case, apologies for the confusion.

Unfortunately that is a bit true. I tested this in Emacs with lsp-mode and it added a literal tab character (which makes sense). Then I tested using two space characters instead and I'm happy to report that it fixed the indentation in Emacs and VSCode! 🎉

And I figured I'd make it an update to your PR since you went through the effort of contributing ❤️

@aj-foster
Copy link
Contributor Author

Thank you, that's very kind! It makes sense that other editors would take it literally. Glad to know that spaces work. 👍🏼

@axelson axelson merged commit 4a6145d into elixir-lsp:master Nov 14, 2021
@aj-foster aj-foster deleted the fix/aj/do-completion branch November 15, 2021 00:06
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