Skip to content

Fix auto-closing quotes for heredocs #101

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

Merged
merged 2 commits into from
Jun 22, 2020
Merged

Fix auto-closing quotes for heredocs #101

merged 2 commits into from
Jun 22, 2020

Conversation

jarrodldavis
Copy link
Contributor

@jarrodldavis jarrodldavis commented Jun 3, 2020

Add triple double quotes (""") as an auto-closing pair in the Elixir language configuration to prevent extra quotes from being inserted when starting a heredoc string.

Add triple double quotes (`"""`) as an auto-closing pair in the Elixir
language configuration to prevent extra quotes from being inserted when
starting a heredoc string.
@jayjun
Copy link
Contributor

jayjun commented Jun 4, 2020

Can you make it work with sigils?

sigil

Ideally typing ~ L " " " auto closes with """.

@jarrodldavis
Copy link
Contributor Author

Sure thing, but the list of applicable sigils will have to be hard coded (I don’t think VS Code allows something like “a tilde followed by any letter and three double quotes”). I’m new to Elixir, so what sigils (besides ~L) are commonly used with triple double-quotes?

@jayjun
Copy link
Contributor

jayjun commented Jun 5, 2020

sigil_* macros provided by Elixir are in Kernel. sigil_L is provided by LiveView. These should cover most cases.

@axelson
Copy link
Member

axelson commented Jun 14, 2020

@jarrodldavis emacs-elixir has a good list that was just updated for ~L: https://github.com/elixir-editors/emacs-elixir/pull/454/files

- add auto-closing pairs for triple double quotes with sigils
- since adding those auto closing pairs breaks single double quote
  pairs, add pairs for single double quotes with sigils as well
- the sigil list is from
  elixir-editors/emacs-elixir#454
@jarrodldavis
Copy link
Contributor Author

@axelson @jayjun I've updated the auto-closing pairs configuration with sigils for single double quotes and triple double quotes.

@jayjun
Copy link
Contributor

jayjun commented Jun 15, 2020

Sweet, it works perfectly.

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! This makes typing sigils and heredocs feel significantly better ❤️

@axelson axelson merged commit b9e284f into elixir-lsp:master Jun 22, 2020
@jarrodldavis jarrodldavis deleted the fix-heredoc-autoclose branch June 22, 2020 06:36
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.

3 participants